Commit Graph

340 Commits

Author SHA1 Message Date
Nate Prewitt bbdbcc8f05 wrap url parsing exceptions from urllib3's PoolManager 2018-09-30 18:36:05 -06:00
Bruce Merry 857e9b7ac2 Rework authorization stripping logic as discussed
The exception for http->https upgrade now requires the standard HTTP(S)
ports to be used, either implicitly (no port specified) or explicitly.
2018-09-14 10:44:43 +02:00
Bruce Merry 3331e2aecd Strip Authorization header whenever root URL changes
Previously the header was stripped only if the hostname changed, but in
an https -> http redirect that can leak the credentials on the wire
(#4716). Based on with RFC 7235 section 2.2, the header is now stripped
if the "canonical root URL" (scheme+authority) has changed, by checking
scheme, hostname and port.
2018-09-14 10:44:43 +02:00
Alex Chan d1fab0b60c Fix a typo in a test docstring 2018-09-13 06:26:59 +01:00
Kale Franz 8023a01dba Fix assumed hostname when using a 'file' URI scheme adapter 2018-08-13 11:28:35 -05:00
Lucy Linder 907c927d60 make content-type's charset information case-insensitive
see issue https://github.com/requests/requests/issues/4748 for more information
2018-07-24 18:13:50 +02:00
Antti Kaihola 691e9520ed Add test for multivalued form-encoded element as a list (#4700) 2018-07-20 10:30:31 +03:00
Steven M. Vascellaro 4d51e6d201 Remove unused httpbin parameters
httpbin is used to mock HTTP endpoints. In these methods, the parameter
goes unused.
2018-07-17 19:39:18 -07:00
Steven M. Vascellaro 28da72b616 Remove unused session variables
Removed local session variables that go unused during testing.
2018-06-26 12:34:15 -04:00
Raymond Hettinger 7e297ed95b Separate collections from collections.abc 2018-06-11 22:14:59 -07:00
Laurent Bachelier 10915e3b0d Add a public method to get the cookie policy 2018-06-11 22:13:07 -07:00
Laurent Bachelier ace0c200f4 Add cookie policy related tests 2018-06-11 22:13:07 -07:00
Rajiv Mayani 8546a15587 The library raises NoneType error when file-pointer (fp) resolves to None.
>>> from requests import post
>>> r = post("https://example.com", files={"file-name": None})

However, when a param value or json field is None they are not included in the request body.

>>> from requests import get
>>> r = get("https://example.com", params={"file-name": None})
>>> r.request.url

This commit makes the beahviour consistent for files.
2018-05-17 13:56:17 -07:00
David Poole 85ec7d759e Merge branch 'master' into master 2018-03-05 09:07:12 -07:00
Nate Prewitt f60324a3de append previous url fragment on redirect 2018-01-21 09:55:45 -08:00
Darren Dormer 2255c34a65 Fix DNS resolution by using hostname instead of netloc and strip username and password when comparing against proxy bypass items. 2018-01-16 10:18:06 +01:00
dbairaktaris1 e0ab287317 added more to test scenarios 2018-01-04 10:59:47 -06:00
dbairaktaris1 cb0914407b Continue to refactor, remove list comprehension, add double quotes test case. 2018-01-04 10:30:50 -06:00
dbairaktaris1 071796d83f implement changes after code review 2018-01-03 23:40:08 -06:00
dbairaktaris1 1988d9cf72 Move nested function up to module level and rename. Add more tests for function. 2018-01-01 14:20:55 -06:00
David Poole efacb9e312 Merge branch 'master' into master 2017-11-29 07:13:07 -07:00
David Poole 1e46cbb4f0 add test for HTTP Digest auth algorithms SHA-256 and SHA-512 2017-11-29 07:10:57 -07:00
Mingyuan Xia acd2645444 #4373, fix possible winreg value type difference (#4377)
* #4373, fix possible winreg value type difference

* add a test for ProxyOverride and ProxyEnable on win32

* add tests for winreg key ProxyEnable with two possible types

* fixing AppVeyor failures
2017-11-20 20:01:04 +00:00
Nehal J Wani 9a8a826f22 Check if host is invalid for proxy
According to RFC3986, the authority section can be empty for a given URL,
however, for a proxy URL, it shouldn't be. This patch adds a check to verify
that the parsed URL will have a valid host before creating the proxy manager.

Fixes #4353
2017-11-15 08:58:54 -05:00
Arthur Vigil c86b09b3c6 support extraction of certificate bundle from a zip archive 2017-11-05 12:14:17 -08:00
Alvaro Gutierrez Perez d165b18b6e Split test in two better-defined tests 2017-10-19 17:04:48 +02:00
Alvaro Gutierrez Perez e11989e8ec Add test for Session.get_adapter() prefix matching 2017-10-19 16:50:13 +02:00
Alvaro Gutierrez Perez af88af64e6 Add test for Session.get_adapter() case-insensitivity 2017-10-19 16:50:13 +02:00
kennethreitz 28ae74dbad update tests
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-17 11:46:33 -04:00
Remi Rampin 8e411d0f99 Add test case for empty Link: header 2017-08-17 12:56:45 -04:00
mgasvoda cbc7c2d1c9 Modifying tests to include header name info 2017-08-11 17:18:58 -04:00
Cory Benfield 8b3f20ca91 Add failing test for #4209 2017-07-29 12:09:04 +01:00
Alex Chan 39b121d791 Add idna version info to requests.help 2017-07-27 21:33:42 +01:00
Nate Prewitt 51feabbc27 test ssl version check functions as expected in python 2.6 2017-07-04 00:33:16 -06:00
Felix Yan a0f0258eee Fix a typo: paramters -> parameters 2017-06-12 01:27:11 +08:00
Justin Mayhew c6a6347156 Remove exec permission from files that shouldn't have it 2017-06-10 20:38:45 -03:00
mlcrazy 613f61d77c Merge remote-tracking branch 'upstream/master' 2017-06-09 14:32:27 -04:00
mlcrazy 1d7fd6c8b3 Fixes error swallowing in set_environ 2017-06-09 14:10:47 -04:00
Ed Morley 4847f5b8cd Allow Requests.Response to be used as a context manager
This saves having to wrap the call to requests with
`contextlib.closing()`, allowing it to be used directly in a
`with` statement, like so:

```
with requests.get('http://httpbin.org/get', stream=True) as r:
    # Do things with the response here.
```

Fixes #4136.
2017-06-06 23:30:47 +01:00
Ryan Pineo 1278ecdf71 Fix requests.packages not having package attributes
Fixes #4104
2017-05-29 17:27:10 -04:00
kennethreitz 7f14db17c8 new requests namespace 2017-05-29 12:11:43 -04:00
kennethreitz 2ccecf6dbd skip for now 2017-05-28 13:05:09 -04:00
kennethreitz c3a00771e3 todo 2017-05-28 00:43:54 -04:00
kennethreitz 276024b170 fix tests 2017-05-27 19:33:40 -04:00
kennethreitz 4c155de9fd test entrypoints 2017-05-27 11:06:53 -04:00
kennethreitz af52bf795e remove bunk tests 2017-05-26 22:55:44 -04:00
kennethreitz 47f170bb35 fix __init__.py 2017-05-26 22:53:28 -04:00
kennethreitz 818daff12a more test removal of old imports 2017-05-26 22:48:58 -04:00
kennethreitz 0bb200515c remove test imports from packages 2017-05-26 22:48:01 -04:00
Jonas Laursen af66521381 Fix #4025 2017-05-18 09:04:34 -07:00