My favorites | Sign in
Google
                
New issue | Search
for
| Advanced search | Search tips
Issue 970: HTTP header parity in SDK urlfetch
9 people starred this issue and may be notified of changes. Back to list
Status:  Acknowledged
Owner:  ----
Type-Feature
Priority-Medium
Component-SDK
Component-Urlfetch


Sign in to add a comment
 
Reported by niall.kennedy, Jan 04, 2009
The urlfetch API currently limits HTTP headers in both a production and SDK
environment. I would like the SDK to include values for these untrusted
request headers that mimic values used in production.

Some websites require a valid User-Agent string to process a request. The
presence of a User-Agent string identifies the request's originator for
tracking, permission, or other means.


Example:
Digg requires a User-Agent header for API requests. The site returns a 403
error if no User-Agent is present. App Engine SDK does not currently set
this header and I cannot override.
http://apidoc.digg.com/BasicConcepts#UserAgents


Proposed fix:
Add adjusted header values to urlfetch_stub.py to mimic a production
environment while differentiating production from localhost.

urlfetch_stub.py:
http://code.google.com/p/googleappengine/source/browse/trunk/google/appengine/api/urlfetch_stub.py

line 152:
"""
adjusted_headers = {
  'Content-Length': len(payload),
  'Host': host,
  'Accept': '*/*',
}
"""

new:
"""
adjusted_headers = {
  'Content-Length': len(payload),
  'Host': host,
  'Accept': '*/*',
  'User-Agent' : 'AppEngine-Google; (+http://code.google.com/appengine)
Development/1.0',
}
"""
urlfetch_stub.py
7.9 KB Download
Comment 1 by deo@google.com, Jan 12, 2009
(No comment was entered for this change.)
Labels: -Type-Defect Type-Feature Component-SDK Component-Urlfetch
Comment 2 by deo@google.com, Jan 12, 2009
(No comment was entered for this change.)
Status: Acknowledged
Comment 3 by SRabbelier, Aug 07, 2009
Fixed in 1.2.3 according to the Release Notes [0].

[0] http://code.google.com/p/googleappengine/wiki/SdkReleaseNotes
Sign in to add a comment