Giter Site home page Giter Site logo

Comments (19)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
当服务器返回的 header 中有多个 Set-Cookie 域时,比如一般的 
wordpress 返回的 header
中,Set-Cookie 域至少有三个,GAPPProxy 
会把它作为一个串传给本地浏览器。
---------------------------
Confirmed, it's indeed a bug.



解决办法很简单,将这个长串用 split(', 
')切开,同样设置三个 Set-Cookie 域即可。
---------------------------
"," is a valid character in cookie. for instance:

wordpress=lovelywcm%7C1248344625%7C26c45bab991dcd0b1f3bce6ae6c78c92; 
expires=Thu,
23-Jul-2009 10:23:45 GMT; path=/wp-content/plugins; domain=.wordpress.com; 
httponly

split(', ') would result in another bug.

Original comment by lovelywcm on 10 Jul 2009 at 1:53

  • Changed state: Accepted

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
"," is a valid character in cookie. for instance:

wordpress=lovelywcm%7C1248344625%7C26c45bab991dcd0b1f3bce6ae6c78c92; 
expires=Thu,
23-Jul-2009 10:23:45 GMT; path=/wp-content/plugins; domain=.wordpress.com; 
httponly

split(', ') would result in another bug.
--------------------------------------------
OK. Then we have to work on the server side...;)

Original comment by solrex on 10 Jul 2009 at 2:58

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
A update patch to fix this bug:

Index: fetch.py
===================================================================
--- fetch.py    (revision 92)
+++ fetch.py    (working copy)
@@ -29,6 +29,7 @@
 from google.appengine.ext import webapp
 from google.appengine.api import urlfetch
 from google.appengine.api import urlfetch_errors
+import re
 # from accesslog import logAccess


@@ -153,14 +154,12 @@
             if header.strip().lower() in self.HtohHdrs:
                 # don't forward
                 continue
-            ## there may have some problems on multi-cookie process in 
urlfetch.
-            #if header.lower() == 'set-cookie':
-            #    logging.info('O %s: %s' % (header, resp.headers[header]))
-            #    scs = resp.headers[header].split(',')
-            #    for sc in scs:
-            #        logging.info('N %s: %s' % (header, sc.strip()))
-            #        self.response.out.write('%s: %s\r\n' % (header, 
sc.strip()))
-            #    continue
+            # there may have some problems on multi-cookie process in urlfetch.
+            if header.lower() == 'set-cookie':
+                scs = re.sub(r', ([^;]+=)', r'\n\1', 
resp.headers[header]).split('\n')
+                for sc in scs:
+                    self.response.out.write('%s: %s\r\n' % (header, 
sc.strip()))
+                continue
             # other
             self.response.out.write('%s: %s\r\n' % (header, resp.headers[header]))
             # check Content-Type

Original comment by solrex on 10 Jul 2009 at 5:18

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
Update:

To avoid ', ' appears near the end of a cookie line, 

scs = re.sub(r', ([^;]+=)', r'\n\1', resp.headers[header]).split('\n')

should be modified to:

scs = re.sub(r', ([^,;]+=)', r'\n\1', resp.headers[header]).split('\n')

Original comment by solrex on 10 Jul 2009 at 6:23

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
Add a patched fetch.py file for ease of use.

Original comment by solrex on 10 Jul 2009 at 6:56

Attachments:

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
我也遇到过类似情形,nokia 
s40系统只能获取到单行的Set-Cookie信息。

单行Set-Cookie设置多个cookie信息,他们之间的分割符采用的是�
��么,是\n么?
我使用\n会报错,最后用的是\r。

Original comment by bit.kevin on 18 Aug 2009 at 7:18

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
修改上传以后,facebook还是有问题啊

Original comment by [email protected] on 11 Oct 2009 at 1:09

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
都到现在了 还没有一个完美的解决方案吗?真让人头疼
那些修改过的补丁我也试过 但是依然出现很多问题

Original comment by [email protected] on 24 Oct 2009 at 2:35

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
试用solrex2上传到服务端,用webkit内核的浏览器登陆twitter没问
题。

Original comment by [email protected] on 20 Nov 2009 at 5:39

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
我用了新的fetch.py依然无法登录twitter

Original comment by [email protected] on 28 Jan 2010 at 2:36

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
用了新的fetch.py后可以登录twitter。
继续测试facebook

Original comment by [email protected] on 28 Jan 2010 at 10:33

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
twitter facebook登录都可以。 
在浏览器里排除一些不需要代理的外国网站,还可以玩facebook
的网页flash游戏,效果不错

Original comment by [email protected] on 29 Jan 2010 at 1:31

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
my patch
--- fetch.py    2010-03-03 11:30:41.000000000 +0800
+++ fetch.py    2010-03-03 11:30:21.000000000 +0800
@@ -156,13 +156,14 @@
                 # don't forward
                 continue
             ## there may have some problems on multi-cookie process in urlfetch.
-            #if header.lower() == 'set-cookie':
-            #    logging.info('O %s: %s' % (header, resp.headers[header]))
-            #    #scs = resp.headers[header].split(',')
-            #    for sc in scs:
-            #        logging.info('N %s: %s' % (header, sc.strip()))
-            #        self.response.out.write('%s: %s\r\n' % (header, 
sc.strip()))
-            #    continue
+            if header.lower() == 'set-cookie':
+                logging.info('O %s: %s' % (header, resp.headers[header]))
+                #scs = resp.headers[header].split(',')
+                scs = re.split('(?<!Mon|Tue|Wed|Thu|Fri|Sat|Sun), ', 
resp.headers[header])
+                for sc in scs:
+                    logging.info('N %s: %s' % (header, sc.strip()))
+                    self.response.out.write('%s: %s\r\n' % (header, 
sc.strip()))
+                continue
             # other
             self.response.out.write('%s: %s\r\n' % (header, resp.headers[header]))
             # check Content-Type

Original comment by [email protected] on 3 Mar 2010 at 5:50

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
xlambda's patch is working!LOL

Original comment by [email protected] on 30 May 2010 at 7:11

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
用了那个9.7k的fetch.py 还是无法正常登陆facebook & twitter。 
期望有人能早日做出解决这个bug的新版本程序

Original comment by [email protected] on 17 Jun 2010 at 9:42

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
#15 try http://zi.mu/kst, upload gae_server with SDUpload

Original comment by [email protected] on 17 Jun 2010 at 2:28

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
Thanks for upstairs, but I don't know how to download anything from the site 
you leave to me. If possible, could you please sent the new version of py file 
to my email: [email protected] 
Thank you so much.

Original comment by [email protected] on 27 Jun 2010 at 5:31

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
[deleted comment]

from gappproxy.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
This patch solves problem that multi-Set-Cookie which a following cookie name 
start with number(0~9) will be returned together in version 113.

Index: fetch.py
===================================================================
--- fetch.py    (版本 113)
+++ fetch.py    (工作副本)
@@ -167,8 +167,8 @@
                 for sc in scs:
                     if nsc == "":
                         nsc = sc
-                    elif re.match(r"[ \t]*[0-9]", sc):
-                        # expires 2nd part
+                    elif nsc[-3:] in 
("Mon","Tue","Wed","Thu","Fri","Sat","Sun"):
+                       # expires 2nd part
                         nsc += "," + sc
                     else:
                         # new one

Original comment by [email protected] on 19 Jan 2011 at 1:04

from gappproxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.