Issue #1061 resolved

path_info missing leading slash on requests for absolute URIs

Jason R. Coombs
created an issue

A simple request for a resource which includes an absolute URI will result in a path_info without a leading slash. For example:

{{{ GET http://myhost.com/path/name HTTP/1.1 }}}

I created a simple server and client to reproduce this issue:

{{{

!python

server reports path_info

import cherrypy

class Root: @cherrypy.expose def default(self, args, *kwargs): return cherrypy.request.path_info

cherrypy.quickstart(Root()) }}}

{{{

!python

import socket conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = 'localhost' conn.connect((host, 8080)) bytes = """GET http://myhost.com/path/name HTTP/1.1 Host: {host} Connection: close

""".format(**vars()).replace('\n', '\r\n') conn.send(bytes) data = conn.recv(2048) data += conn.recv(2048) leader, sep, content = data.rpartition('\r\n\r\n') assert content == '/path/name', "content was " + content

}}}

The client should run and return, but instead returns

{{{ Traceback (most recent call last): File "send_absoluteUri.py", line 15, in <module> assert content == '/path/name', "content was " + content AssertionError: content was path/name }}}

Comments (3)

  1. Log in to comment