Opened 11 years ago

Last modified 11 years ago

#235 defect closed fixed (fixed)

[PATCH]guard problem with urls with '?some=thing'

Reported by: LordVan Owned by:
Priority: high Milestone:
Component: Keywords:
Cc: glyph, radix, LordVan, dp, moshez Branch:
Author: Launchpad Bug:

Description


Change History (11)

comment:1 Changed 11 years ago by LordVan

guard just overwrites the ?some=thing part with his session
started ?.... there should be some logic to detect that imho
(just do &session-=started=1 instead of ?=..)

regards

comment:2 Changed 11 years ago by moshez

The following patch should fix the issue. Please check
if it works for you.

Index: twisted/web/woven/guard.py
===================================================================
RCS file: /cvs/Twisted/twisted/web/woven/guard.py,v
retrieving revision 1.32
diff -u -r1.32 guard.py
--- twisted/web/woven/guard.py  17 Sep 2003 16:40:46 -0000      1.32
+++ twisted/web/woven/guard.py  2 Oct 2003 02:56:26 -0000
@@ -30,6 +30,7 @@
 import time
 import md5
 import warnings
+import urllib

 # Twisted Imports

@@ -213,10 +214,12 @@
                 #                  ^
                 #                  we are this getChild
                 # with a matching cookie
-                rd = Redirect(urlToChild(*request.postpath) +
-                              # this next bit prevents 'redirect cycles' in
-                              # wget (and possibly other browsers)
-                              "?__session_just_started__=1")
+                childname = (urlToChild(*request.postpath)+
+                             "?__session_just_started__=1")
+                # the addition of __session_just_started__ prevents
+                # 'redirect cycles' in wget (and possibly other browsers)
+                childname += '&'+urllib.urlencode(request.args)
+                rd = Redirect(childname)
                 rd.isLeaf = 1
                 return rd
             else:

comment:3 Changed 11 years ago by moshez

I think this should be upgraded to urgent, radix

comment:4 Changed 11 years ago by moshez

Of course, my patch isn't correct, it should have the
childname += line preceded by if request.args:

But this shows the right place the code should go, at least :)

comment:5 Changed 11 years ago by moshez

<moshez> who's responsible for guard?
<itamar> moshez: glyph

comment:6 Changed 11 years ago by moshez

upgrading to urgent

comment:7 Changed 11 years ago by moshez

Downgrading back to bug

comment:8 Changed 11 years ago by moshez

Patch for this and 138 at
http://twistedmatrix.com/~moshez/guard.patch.txt

comment:9 Changed 11 years ago by LordVan

works4me! :)

thanks :)

comment:10 Changed 11 years ago by radix

patch has been committed

comment:11 Changed 4 years ago by <automation>

  • Owner glyph deleted
Note: See TracTickets for help on using tickets.