summaryrefslogtreecommitdiff
path: root/requests/api.py
diff options
context:
space:
mode:
authorJohn Szakmeister <john@szakmeister.net>2012-12-02 11:25:18 -0500
committerJohn Szakmeister <john@szakmeister.net>2012-12-02 11:25:18 -0500
commited642cfb6d471f2462953ac5f4f33a443750bd02 (patch)
treea909f433d8dcd15f6283b3ed0559c191efdfa8f1 /requests/api.py
parent63243b1e3b435c7736acf1e51c0f6fa6666d861d (diff)
downloadpython-requests-ed642cfb6d471f2462953ac5f4f33a443750bd02.tar.gz
Add the ability to turn off HTTP 0.9 support.
While debugging an issue I discovered requests was coming back with 200 response, when it really shouldn't have. It turns out this happened for two reasons: the jetty server running the app was rather lame and didn't fail the request as a Bad Request, and httplib was happy to let malformed data through and call it success. It turns out httplib's strict flag controls this behavior of whether or not to validate the status line. The underlying urllib3 supports the concept as well. There was a bug there to that is now fixed upstream. The last step is exposing this through requests. This introduces a supports_http0.9 flag to help control this behavior. It defaults to to True to preserve the current behavior. Setting it to False will allow the underlying HTTPConnection to validate the status line.
Diffstat (limited to 'requests/api.py')
-rw-r--r--requests/api.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/requests/api.py b/requests/api.py
index ded79352..ce8495c6 100644
--- a/requests/api.py
+++ b/requests/api.py
@@ -44,7 +44,7 @@ def request(method, url, **kwargs):
adhoc_session = False
session = kwargs.pop('session', None)
if session is None:
- session = sessions.session()
+ session = sessions.session(config=kwargs.get('config', None))
adhoc_session = True
try: