def _urlfetch_to_gcs_stub(url, payload, method, headers, request, response, follow_redirects=False, deadline=None, validate_certificate=None):
 headers_map = dict(((header.key().lower(), header.value()) for header in headers))
 result = dispatch(method, headers_map, url, payload)
 response.set_statuscode(result.status_code)
 response.set_content(result.content[:urlfetch_stub.MAX_RESPONSE_SIZE])
 for (k, v) in result.headers.iteritems():
  if ((k.lower() == 'content-length') and (method != 'HEAD')):
   v = len(response.content())
  header_proto = response.add_header()
  header_proto.set_key(k)
  header_proto.set_value(str(v))
 if (len(result.content) > urlfetch_stub.MAX_RESPONSE_SIZE):
  response.set_contentwastruncated(True)

def _urlfetch_to_gcs_stub ( url , payload , method , headers , request , response , follow_redirects = False , deadline = None , validate_certificate = None ) : headers_map = dict ( ( ( header . key ( ) . lower ( ) , header . value ( ) ) for header in headers ) ) result = dispatch ( method , headers_map , url , payload ) response . set_statuscode ( result . status_code ) response . set_content ( result . content [ : urlfetch_stub . MAX_RESPONSE_SIZE ] ) for ( k , v ) in result . headers . iteritems ( ) : if ( ( k . lower ( ) == 'content-length' ) and ( method != 'HEAD' ) ) : v = len ( response . content ( ) ) header_proto = response . add_header ( ) header_proto . set_key ( k ) header_proto . set_value ( str ( v ) ) if ( len ( result . content ) > urlfetch_stub . MAX_RESPONSE_SIZE ) : response . set_contentwastruncated ( True )
forwards gcs urlfetch requests to gcs_dispatcher .