thirdparty/google_appengine/google/appengine/api/urlfetch_stub.py
changeset 2864 2e0b0af889be
parent 2413 d0b7dac5325c
--- a/thirdparty/google_appengine/google/appengine/api/urlfetch_stub.py	Sat Sep 05 14:04:24 2009 +0200
+++ b/thirdparty/google_appengine/google/appengine/api/urlfetch_stub.py	Sun Sep 06 23:31:53 2009 +0200
@@ -55,7 +55,6 @@
 _UNTRUSTED_REQUEST_HEADERS = frozenset([
   'content-length',
   'host',
-  'referer',
   'vary',
   'via',
   'x-forwarded-for',
@@ -168,7 +167,6 @@
       adjusted_headers = {
           'User-Agent':
           'AppEngine-Google; (+http://code.google.com/appengine)',
-          'Referer': 'http://localhost/',
           'Host': host,
           'Accept-Encoding': 'gzip',
       }
@@ -212,7 +210,10 @@
           socket.setdefaulttimeout(deadline)
           connection.request(method, full_path, payload, adjusted_headers)
           http_response = connection.getresponse()
-          http_response_data = http_response.read()
+          if method == 'HEAD':
+            http_response_data = ''
+          else:
+            http_response_data = http_response.read()
         finally:
           socket.setdefaulttimeout(orig_timeout)
           connection.close()
@@ -239,7 +240,7 @@
               header_value == 'gzip'):
             continue
           if header_key.lower() == 'content-length':
-            header_value = len(response.content())
+            header_value = str(len(response.content()))
           header_proto = response.add_header()
           header_proto.set_key(header_key)
           header_proto.set_value(header_value)