|
11 | 11 | import aiohttp |
12 | 12 | from asyncio import Lock |
13 | 13 |
|
14 | | -from tornado import gen, web, httpclient, simple_httpclient, httputil, process, websocket, ioloop, version_info |
| 14 | +from tornado import gen, web, httpclient, httputil, process, websocket, ioloop, version_info |
15 | 15 |
|
16 | 16 | from notebook.utils import url_path_join |
17 | 17 | from notebook.base.handlers import IPythonHandler, utcnow |
@@ -216,11 +216,14 @@ async def proxy(self, host, port, proxied_path): |
216 | 216 |
|
217 | 217 | try: |
218 | 218 | response = await client.fetch(req, raise_error=False) |
219 | | - except simple_httpclient.HTTPTimeoutError as err: |
220 | | - self._record_activity() |
221 | | - self.set_status(408) |
222 | | - self.write(str(err)) |
223 | | - return |
| 219 | + except httpclient.HTTPError as err: |
| 220 | + if err.code == 599: |
| 221 | + self._record_activity() |
| 222 | + self.set_status(599) |
| 223 | + self.write(str(err)) |
| 224 | + return |
| 225 | + else: |
| 226 | + raise |
224 | 227 |
|
225 | 228 | # record activity at start and end of requests |
226 | 229 | self._record_activity() |
@@ -316,7 +319,7 @@ def proxy_request_headers(self): |
316 | 319 | def proxy_request_options(self): |
317 | 320 | '''A dictionary of options to be used when constructing |
318 | 321 | a tornado.httpclient.HTTPRequest instance for the proxy request.''' |
319 | | - return dict(follow_redirects=False, request_timeout=75.0) |
| 322 | + return dict(follow_redirects=False, connect_timeout=250, request_timeout=300.0) |
320 | 323 |
|
321 | 324 | def check_xsrf_cookie(self): |
322 | 325 | ''' |
|
0 commit comments