diff -r 26491ee91e33 -r e4cb9c53db3e thirdparty/google_appengine/google/appengine/api/urlfetch_stub.py --- a/thirdparty/google_appengine/google/appengine/api/urlfetch_stub.py Tue Apr 21 16:28:13 2009 +0000 +++ b/thirdparty/google_appengine/google/appengine/api/urlfetch_stub.py Fri Apr 24 14:16:00 2009 +0000 @@ -55,7 +55,6 @@ 'content-length', 'host', 'referer', - 'user-agent', 'vary', 'via', 'x-forwarded-for', @@ -104,6 +103,11 @@ raise apiproxy_errors.ApplicationError( urlfetch_service_pb.URLFetchServiceError.INVALID_URL) + if not host: + logging.error('Missing host.') + raise apiproxy_errors.ApplicationError( + urlfetch_service_pb.URLFetchServiceError.FETCH_ERROR) + sanitized_headers = self._SanitizeHttpHeaders(_UNTRUSTED_REQUEST_HEADERS, request.header_list()) request.clear_header() @@ -146,7 +150,12 @@ 'urlfetch received %s ; port %s is not allowed in production!' % (url, port)) - if host == '' and protocol == '': + if protocol and not host: + logging.error('Missing host on redirect; target url is %s' % url) + raise apiproxy_errors.ApplicationError( + urlfetch_service_pb.URLFetchServiceError.FETCH_ERROR) + + if not host and not protocol: host = last_host protocol = last_protocol