lnln1111 / gappproxy

Automatically exported from code.google.com/p/gappproxy
GNU General Public License v3.0
0 stars 1 forks source link

submit a patch #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. login twitter.com
2. goto http://twitter.com/account/settings
3. try to upload a picture

you'll get an error:

Error Code: 590
Message: Wrong length of post data

I just get a solution to resolve this problem:

1. localproxy/proxy.py

after:
        # get post data
        postData = ''
        if postDataLen > 0:
            postData = self.rfile.read(postDataLen)
            if len(postData) != postDataLen:
                # bad request
                self.send_error(400)
                self.connection.close()
                return
            # ADD this line
            postData = base64.b64encode(postData)

IN:
        params = urllib.urlencode({'method': method, 
                                   #'path': path, 
                                   'encoded_path': base64.b64encode(path), 
                                   'headers': self.headers, 
                                   'encodeResponse': 'compress', 
                                   # 'postdata': postData, 
                                   # change to:
                                   'encoded_postdata': postData,
                                   'version': '1.0.0 beta'})

2. fetch.py

after:

    def post(self):
        try:
            # get post data
            origMethod = self.request.get('method')
            origPath = self.request.get('encoded_path')
            if origPath != '':
                origPath = base64.b64decode(origPath)
            else:
                origPath = self.request.get('path')
            origHeaders = self.request.get('headers')
            encodeResponse = self.request.get('encodeResponse')
            # change this line to:
            # origPostData = self.request.get('postdata')
            origPostData = self.request.get('encoded_postdata')
            if origPostData != '':
                origPostData = base64.b64decode(origPostData)
            if origPostData == '':
                origPostData = self.request.get('postdata')         

I just create two patch file attached.

Original issue reported on code.google.com by doude...@gmail.com on 9 Jul 2009 at 7:05

Attachments:

GoogleCodeExporter commented 9 years ago
我傻×了,英文这么烂,用什么英文啊。

据我友 serock(s.rock.e@gmail.com) 观察,附加的 postdata 
从本机上肯定是发出去了的,但
为什么到 appspot 
那里会被截断,原因暂时不明。所以我们在本地先对 postdata 
用 base64 进
行编码,服务器收到以后解码再发到目的网址。经测试,这��
�做是可以工作的。

希望能合并到服务器的版本里。谢谢。:)

Original comment by doude...@gmail.com on 9 Jul 2009 at 7:13

GoogleCodeExporter commented 9 years ago
昨天刚知道这个代理今天就来给作者反馈。竟然发现大侠发��
�丁了。希望可以解决。
可是我用的windows版没proxy.py文件?

Original comment by yjd...@gmail.com on 9 Jul 2009 at 9:14

GoogleCodeExporter commented 9 years ago
囧没看懂。不知道怎么更新。。。

Original comment by yjd...@gmail.com on 9 Jul 2009 at 9:23

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. login twitter.com
2. goto http://twitter.com/account/settings
3. try to upload a picture

you'll get an error:

Error Code: 590
Message: Wrong length of post data
-----------------------------------------------

Confirmed.

Original comment by lovelywcm on 9 Jul 2009 at 10:01

GoogleCodeExporter commented 9 years ago
我不会打包python的exe,如果你是直接用的 proxy.py 
来做代理的话,立刻就可以应用这个补丁。

不过反正这个问题已经被 owner comfirmed 了,估计很快就会有 
fix 出来。只需要等着就可以
了。呵呵。

Original comment by doude...@gmail.com on 9 Jul 2009 at 11:25