Comments (4)
Even though urllib3 doesn't use httplib too much, a full rewrite of something this fundamental can be involved. I would highly recommend these links for the lazy:
- httplib docs
- httplib source
- urllib3's Connection Pool (first major usage of httplib)
- urllib3's Response (second major usage)
As for the design thus far, the enhancements are tentatively broken into creating specialized Managers (aka Pool Managers) that implement specialized behavior (e.g., proxying, caching, etc.) and lower-level httplib-replacement classes like Connection, Request (HTTPRequest), and Response (HTTPResponse). Connection manages basic socket behaviors and more advanced transport behaviors like handshaking. Request/Response mostly handle parsing/serialization stuff.
General patterns for customization are inheritance (i.e., HTTPSRequest could be a child of HTTPRequest. Other requests like FTPRequest should be possible), and type passing (i.e., telling Manager type Foo
to use Connection type Bar
).
As for enhancement-specific links, I recommend:
- benoitc's http-parser - Modern and much improved handling of the response parsing side. Ported from mongrel/node.js for use in gunicorn, it has pure Python and Cython versions available in the linked repo.
- py-nonblocking-http - A Google project from 2010 that provides a non-blocking-socket-compatible replacement for httplib's Connection class. While not directly applicable on the whole, it does demonstrate:
- How to replace 90% of httplib
- How to unify HTTP and HTTPS Connections, if that is desirable
- Some of the complexities of handshaking and redirects in a non-httplib context
You'll note that it is still quite opaque and monolithic, so, again, just for reference.
from urllib3.
@makuro Thanks for organizing this and writing it up. :)
from urllib3.
This is so exciting.
from urllib3.
Still hopeful for this someday but it'd be a huge project. Maybe with a sponsor or something.
✨
from urllib3.
Related Issues (20)
- Emscripten support emits an InsecureRequestWarning even when using HTTPS
- Path toward testing with a released version of hypercorn? HOT 3
- Handle HTTP/2 informational responses (1xx) HOT 2
- urllib3 2.2 explicitly casts all headers to HTTPHeaderDict HOT 4
- Streaming responses using urllib3 HOT 5
- verbose logging output
- Excess leading path separators causes ConnectionPool.urlopen to parse URL as host & port HOT 1
- ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) HOT 1
- SSL: UNEXPECTED_EOF_WHILE_READING HOT 7
- imprecise types on `urllib3.Retry.new` / `urllib3.Retry.increment` HOT 1
- Investigate CI failures with Python 3.13.0a5 HOT 2
- "unable to get local issuer certificate", even though cURL works with the same website HOT 3
- Unclosed socket warning after HTTP 407 response from HTTP CONNECT proxy HOT 1
- All Retry backoff_factor to optionally start applying from first retry HOT 4
- Retry backoff_factor offset from second retry incorrectly computed HOT 2
- HTTPConnection.request chunked=False doesn't work properly HOT 8
- Need to exception for "SSLEOFError" on python 3.10, 3.11, 3.12 HOT 3
- After upgrading to 2.2.1: 'HTTPResponse' object has no attribute 'json' HOT 1
- Comment typo settimout settimeout HOT 1
- Dependency management issue HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from urllib3.