Commit Graph

57 Commits

Author SHA1 Message Date
Tom Christie
5dda2aa306
Just use default safe=... characters for urlescape (#3376) 2024-10-28 17:38:16 +00:00
Tom Christie
ba2e51215e
Review urlescape percent-safe set, and use + behavior for form spaces. (#3373) 2024-10-28 16:19:59 +00:00
Tom Christie
d293374b66
Review URL percent escaping sets, from whatwg. (#3371) 2024-10-28 15:06:10 +00:00
Tom Christie
8e36f2bc68
Introduce new SSLContext API & escalate deprecations. (#3319)
Co-authored-by: Kar Petrosyan <92274156+karpetrosyan@users.noreply.github.com>
Co-authored-by: T-256 <132141463+T-256@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-10-28 14:30:08 +00:00
Tom Christie
7c0cda153d
Improve InvalidURL error message. (#3250) 2024-07-26 09:36:03 +01:00
Tom Christie
db9072f998
Add URL parsing tests from WHATWG (#3188)
Co-authored-by: Kar Petrosyan <92274156+karpetrosyan@users.noreply.github.com>
2024-06-13 14:46:36 +01:00
Tom Christie
a7092af2fd
Resolve queryparam quoting (#3187) 2024-05-03 01:09:08 +01:00
Tom Christie
a11fc3849b
Cleanup URL percent-encoding behavior. (#2990)
* Replace path_query_fragment encoding tests

* Remove replaced test cases

* Fix test case to use correct hex sequence for 'abc'

* Fix 'quote' behaviour so we don't double-escape.

* Add '/' to safe chars in query strings

* Update docstring

* Linting

* Update outdated comment.

* Revert unrelated change

---------

Co-authored-by: Kar Petrosyan <92274156+karpetrosyan@users.noreply.github.com>
2023-12-15 11:35:16 +00:00
Tom Christie
b471f01d66
Allow URLs where username or password contains unescaped '@'. (#2986)
* Add test cases for userinfo in URL

* Resolve failing test cases

* Update CHANGELOG.md

* Update CHANGELOG.md
2023-12-07 10:08:14 +00:00
Tom Christie
5b5f6d8e17
Moving test cases into 'test_url.py' (#2982)
* Moving test cases into 'test_url.py'

* Move test_url to test_basic_url

* Linting

* Move TypeError test case. Move basic httpx.URL cases.

* Linting

* Merge invalid URL cases

* Move percent encoding test cases

* Move remaining test cases

* Linting

* Add missing test cases
2023-12-05 15:36:05 +00:00
Tom Christie
724eced022
Reorganise tests in 'test_url.py' (#2981)
* Reorganise tests in 'test_url.py'

* Linting
2023-12-05 13:24:34 +00:00
Zanie Adkins
920333ea98
Always encode forward slashes as %2F in query parameters (#2723)
* Always encode forward slashes as `%2F` in query parameters

* Revert inclusion of "%"

This is expected to fail tests due to double escaping

* Update `urlencode`

---------

Co-authored-by: Tom Christie <tom@tomchristie.com>
2023-06-09 10:06:56 +01:00
Tom Christie
a6af45edac
Use '%20' for encoding spaces in query parameters. (#2543)
* Add failing test

* Fix failing test case

* Add urlencode

* Update comment
2023-01-10 11:16:09 +00:00
Tom Christie
57daabf673
Drop rfc3986 requirement. (#2252)
* Drop RawURL

* First pass at adding urlparse

* Update urlparse

* Add urlparse

* Add urlparse

* Unicode non-printables can be valid in IDNA hostnames

* Update _urlparse.py docstring

* Linting

* Trim away ununsed codepaths

* Tweaks for path validation depending on scheme and authority presence

* Minor cleanups

* Minor cleanups

* full_path -> raw_path, forr internal consistency

* Linting fixes

* Drop rfc3986 dependency

* Add test for #1833

* Linting

* Drop 'rfc3986' dependancy from README and docs homepage

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2023-01-10 10:36:15 +00:00
Demetri
40a0da093b
Add back in URL.raw with NamedTuple (#2481)
* add back in URL.raw with NamedTuple

* Update _urls.py

* Update _urls.py

Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-12-02 16:20:05 +00:00
Tom Christie
9baf3a6cd2
Drop RawURL (#2241) 2022-05-30 14:54:47 +01:00
Alan Li
e9b0c85dd4
Patch copy_with (#2185)
* Patch `copy_with`

* Add a new test for `copy_with`
2022-05-03 11:33:13 +01:00
Tom Christie
0a8b44e67d
Perform port normalization for http, https, ws, wss, and ftp schemes (#1603) 2021-04-27 14:06:23 +01:00
Tom Christie
e67b0dd15b
Expand URL interface (#1601)
* Expand URL interface

* Add URL query param manipulation methods
2021-04-27 09:01:14 +01:00
Tom Christie
39d8ee619e
Differentiate between 'url.host' and 'url.raw_host' (#1590)
* Differentiate between 'url.host' and 'url.raw_host'
2021-04-23 11:00:53 +01:00
Tom Christie
6cb1672459
Fix some cases of merging with base_url (#1532)
* Fix some cases of merging with base_url

* Fix for joining relative URLs

* Improve code comment in _merge_url implementation
2021-03-24 10:51:33 +00:00
cdeler
7fda99fcef
Correctly handle ipv6 addresses as a part of URL (#1349)
* Correctly handle ipv6 addresses as a host

* Fixed typo

* Added an extra rfc reference

* Update tests/models/test_url.py

* Update tests/models/test_url.py
2020-10-08 11:37:13 +03:00
Tom Christie
8e4a8a1c73
Finesse URL properties (#1285)
* url.userinfo should be URL encoded bytes

* Neater copy_with implementation

* Finesse API around URL properties and copy_with

* Docstring for URL, and drop url.authority

* Support url.copy_with(raw_path=...)

* Docstrings on URL methods

* Tweak docstring
2020-09-21 11:35:25 +01:00
Tyler Wozniak
42c66863d0
Raise a proper type error on invalid URL type (#1259)
* Added test for expected URL class behavior

* Updated URL class, tests pass

* Updated to include type in error message
2020-09-04 23:14:59 +02:00
Tom Christie
28c72050e0
Better test case consistency. Prefer import httpx and httpx.Client. (#1222)
* Prefer httpx.Client over httpx.AsyncClient in test cases, unless required.

* Prefer httpx.Client in test_headers

* Consistent httpx imports and httpx.Client usage

* Use 'import httpx' consistently in tests. Prefer httpx.Client.
2020-08-26 14:10:23 +01:00
Tom Christie
655773e1c1
Handle URL quoting username and password components. (#1159)
* Handle URL quoting username and password components

* Tweak userinfo quoting
2020-08-11 17:18:12 +01:00
Joe
45de714592
Map rfc3986 exceptions (#1163)
* Map rfc3896 exceptions
2020-08-11 09:44:56 +01:00
Tom Christie
c089480260
URL.port becomes Optional[int] (#1080)
* URL.port becomes Optional[int], not int

* Minor _transport_for_url refactor

* Add docstring
2020-07-24 11:42:13 +01:00
Tom Christie
7e6e35160f
Drop URL(allow_relative=bool) (#1073)
* Drop URL(allow_relative=bool)

* Update httpx/_models.py

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>

* Linting

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-07-23 10:16:51 +01:00
Tom Christie
247ee0dc49
Drop private Origin model (#1070)
* Drop private Origin model

* Drop Origin from docs

* Update tests/test_utils.py

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>

* Drop full_path test

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-07-23 09:54:45 +01:00
Tom Christie
8ed7e52a37
Drop fullpath setter (#1069) 2020-07-23 09:43:11 +01:00
Josep Cugat
620b0670db
Increase test coverage - take 2 (#1012)
* Fix HttpError -> HTTPError typo

* Increased test coverage

* Increase coverage threshold

* Reuse sync/async transport code in test_auth.py

* Removed close_client check inside StreamContextManager

It's never set as True when used in async

* Reuse sync/async transport code in test_redirects.py
2020-06-02 10:24:45 +01:00
Josep Cugat
8c84210555
Increased test coverage & cleanup (#1003)
* Remove unused/untested headers copy() method

Last usage was removed in #804

* Remove unused premature_close server endpoint

Last usage was removed in #804

* Increased test coverage

* Revert removal of headers copy() method

Documented and added tests for it.

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-05-30 23:22:03 +02:00
Florimond Manca
82dc6f32f8 Switch to private module names (#785)
* Rename modules

* Update names in package

* Fix tests

* Review docs
2020-01-28 14:34:43 +00:00
Andrés Álvarez
2b92a78c41 Drop Origin from public API (#688)
- Drop the url.origin property.
  - Drop Origin from the top-level export.
  - Use origin = Origin(url) in our internal usage, rather than
    url.origin.

Closes #656

Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-01-07 10:39:47 +00:00
Tom Christie
74e5115b86
params argument on URL should merge, not replace. (#653) 2019-12-20 10:46:35 +00:00
Tom Christie
5ee512d803
Fix Host header and HSTS when the default port is explicitly included in URL (#649) 2019-12-20 10:25:42 +00:00
Tom Christie
d15dc0b1f8
Tighten up top-level API to only expose public API (#608)
* Tighten up top-level API to only expose public API

* Leave HTTPProxyMode for backwards compat, raising warnings.

* Add missing import
2019-12-06 15:20:01 +00:00
Can Sarıgöl
e6da325e8b added authority copy feature in URL.copy_with (#436) 2019-10-04 09:17:25 +01:00
Seth Michael Larson
57c27cac36
Implement HTTPProxy dispatcher (#259) 2019-09-15 10:47:35 -05:00
Yeray Diaz Diaz
fa74aaa6db Add test for origin from URL string (#312) 2019-09-04 13:43:24 +02:00
Seth Michael Larson
80dc3e274e
Use nox for automation and CI (#128) 2019-08-13 08:39:35 -05:00
Seth Michael Larson
9142a893ff Move HSTS preload checking to client (#184) 2019-08-01 10:26:45 +01:00
Stephen Brown II
40849bffcb Update IDNA encoding to 2008 spec (#161)
* Update IDNA encoding to 2008 spec

* Add Unicode IDNA Compatibility Processing

* Parametrize idna test

* Use rfc3986 iri_reference for IDNA names

* Add test for IRI object

* Remove test_iri as this interface has been removed
2019-07-31 14:41:40 +01:00
Seth Michael Larson
3ba2e8c328
Switch hosts on HSTS preload to HTTPS (#151) 2019-07-28 12:02:21 -05:00
Can Sarıgöl
7e9110b978 Add additional flake8 plugins (#157) 2019-07-28 11:40:05 -05:00
Tom Christie
00e4fdb05d Fix URL.join(...) (#144) 2019-07-25 17:01:03 -05:00
Stephen Brown II
8db36ed6a5 Allow string comparison for URL().__eq__ (#139) 2019-07-24 16:28:16 +01:00
Tom Christie
2d09d5b36c
Renaming -> httpx (#129)
* Renaming -> httpx

* Renaming to httpx
2019-07-19 15:15:16 +01:00
Tom Christie
c9747aa357
http3 (#86)
* Start fleshing out documentation

* Docs work

* http3

* Update docs

* Include lowercase status codes, for requests compat

* Updating docs

* Docs tweaks
2019-06-12 15:02:16 +01:00