John Harding - Insert Catchy Title Here

Insert witty phrase/saying here.

Sunday, May 18, 2008

Bug in appengine's urlfetch

Unfortunately, I wasted about an hour assuming I was doing something wrong before realizing I could dig into the development app server and debug. The issue is that, at least with the development app server on Windows, urlfetch.fetch(url) will discard any query parameters in the url passed in. This works fine on the actual hosted service.

I filed a a bug on google code, but you can fix it locally in the meantime. The relevant file is in your appengine install folder, in google/appengine/api. Edit urlfetch_stub.py, search for "connection.request" and fix it. I modified mine to:

# Up to request, then s/path/path+query/
path_and_query = path
if len(query) > 0:
path_and_query = path_and_query + '?' + query
connection.request(method, path_and_query, payload, adjusted_headers)

Which still leaves off the fragment, but I'm OK with that.

2 Comments:

At 12:46 AM , Blogger ylDave said...

Good catch on this bug. I burned up some time trying to track this down. Downloaded the latest and it seems to be working correctly now. Any tips for us on how you debugged? I use IDLE on Windows and am unable to import some modules despite sys.path looking correct.

 
At 7:14 PM , Blogger John said...

I went old school and just dumped a bunch of logging statements in until I found the culprit. Nice that all the code is there locally.

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home