def request_httprepr(request):
 parsed = urlparse_cached(request)
 path = urlunparse(('', '', (parsed.path or '/'), parsed.params, parsed.query, ''))
 s = (((to_bytes(request.method) + ' ') + to_bytes(path)) + ' HTTP/1.1\r\n')
 s += (('Host: ' + to_bytes((parsed.hostname or ''))) + '\r\n')
 if request.headers:
  s += (request.headers.to_string() + '\r\n')
 s += '\r\n'
 s += request.body
 return s

def request_httprepr ( request ) : parsed = urlparse_cached ( request ) path = urlunparse ( ( '' , '' , ( parsed . path or '/' ) , parsed . params , parsed . query , '' ) ) s = ( ( ( to_bytes ( request . method ) + ' ' ) + to_bytes ( path ) ) + ' HTTP/1.1\r\n' ) s += ( ( 'Host: ' + to_bytes ( ( parsed . hostname or '' ) ) ) + '\r\n' ) if request . headers : s += ( request . headers . to_string ( ) + '\r\n' ) s += '\r\n' s += request . body return s
return the raw http representation of the given request .