Skip to content

Instantly share code, notes, and snippets.

@clayg
Last active March 8, 2017 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clayg/2ae111dcc8aec459a6b3838853ddc43f to your computer and use it in GitHub Desktop.
Save clayg/2ae111dcc8aec459a6b3838853ddc43f to your computer and use it in GitHub Desktop.
If you can find a library low level enough to let you send unescape urls your webserver *should* reject the request
import httplib
conn = httplib.HTTPConnection('localhost', 8080)
conn.connect()
conn.putrequest('GET', '/v1/auth/container/a b x?')
conn.endheaders()
resp = conn.getresponse()
print resp.read()
ubuntu@saio:~/python-swiftclient$ python /vagrant/.scratch/bad_request.py
<head>
<title>Error response</title>
</head>
<body>
<h1>Error response</h1>
<p>Error code 400.
<p>Message: Bad request syntax ('GET /v1/auth/container/a b x? HTTP/1.1').
<p>Error code explanation: 400 = Bad request syntax or unsupported method.
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment