vladmunteanu / th2c Goto Github PK
View Code? Open in Web Editor NEWTornado HTTP/2 Client
License: MIT License
Tornado HTTP/2 Client
License: MIT License
According to PEP 373, the End Of Life date for Python 2 is 2020 (less than two years from the time of this issue). According to PEP 404 it is further cemented that Python 2 will no longer be actively developed due to their not being a Python 2.8 planned.
For the sake of the project's longevity it is in its best interest to, at the very least, provide a port to Python 3.
The project looks great and I would hate to see it fall to the wayside solely due to it being made for Python 2.x.
Follow redirects if configured so, by identifying the next host and spawning a new client to handle the new request.
The new client should not auto_reconnect ( see #5 ).
At the moment, connection timeout is passed as a globally defined constant.
Should be configurable through the client's constructor.
The client should be usable without defining a new instance for each new host:port. The logic from the client for connection reusability should be moved inside HTTP2ClientConnection.
Given the HTTP/2 context, we'd like this to be stable for a long period of time, so on a specific set of exceptions, we should try reconnecting. Connection cleanup must be properly implemented before we go through with this, or we should create a new connection object.
HTTPError is automatically raised in client.py
We should accept a parameter in fetch
and return the response object if necessary.
in Stream.finish, the line self.connection.end_stream(self) can raise:
Exception in callback <functools.partial object at 0x7fef7c1355d0>#012 Traceback (most recent call last):#012 File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line 605, in _run_callback#012 ret = callback()#012 File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 277, in null_wrapper#012 return fn(*args, **kwargs)#012 File "/usr/local/lib/python2.7/dist-packages/th2c/stream.py", line 78, in on_timeout#012 None#012 File "/usr/local/lib/python2.7/dist-packages/th2c/stream.py", line 86, in handle_exception#012 self.finish(val)#012 File "/usr/local/lib/python2.7/dist-packages/th2c/stream.py", line 259, in finish#012 self.connection.end_stream(self)#012 File "/usr/local/lib/python2.7/dist-packages/th2c/connection.py", line 417, in end_stream#012 del self._ongoing_streams[stream.stream_id]#012KeyError: 3
Noticed this after a RequestTimeout exception
Streams should handle write futures and exit if anything goes bad.
Can be done easily because streams use connection.flush() in a coroutine so we can yield the future and retry I guess.
Connection should handle its write futures exceptions as failures, gracefully closing the http2 connection.
This is temporary, until we find a better solution for handling these edge cases.
Seems the client which is using the write buffer to flush de data obtained from h2 is not able to send data after a certain amount of time sending reqs (PUTs) writing it in the buffer but not realising them towards the server. Is this an expected behaviour or am i missing something?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.