python-trio / hip

A new Python HTTP client for everybody

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Timeout handling

njsmith opened this issue · comments

We don't have a coherent story for timeout handling yet. I think at this point we do pass timeouts through from the external APIs into the backends, but:

  • the Trio and Twisted don't actually implement timeouts yet

  • we don't have a general strategy for reporting timeouts

It used to be that timeout handling involved some coordination between the urllib3 code and the network layer, where urllib3 would set some special options to make timeouts happen, and then catch the native timeout exceptions (like socket.timeout) and translate them into the exceptions used in urllib3's public API.

I think we should figure out what exceptions our users are expecting, and make all the backends responsible for raising these directly, and remove the translation layer.

An issue with the timeout handling in urllib3 is that not timeout is applied when sending the actual request, see #57 (comment).