Show More
@@ -737,6 +737,11 b" coreconfigitem('http_proxy', 'passwd'," | |||||
737 | coreconfigitem('http_proxy', 'user', |
|
737 | coreconfigitem('http_proxy', 'user', | |
738 | default=None, |
|
738 | default=None, | |
739 | ) |
|
739 | ) | |
|
740 | ||||
|
741 | coreconfigitem('http', 'timeout', | |||
|
742 | default=None, | |||
|
743 | ) | |||
|
744 | ||||
740 | coreconfigitem('logtoprocess', 'commandexception', |
|
745 | coreconfigitem('logtoprocess', 'commandexception', | |
741 | default=None, |
|
746 | default=None, | |
742 | ) |
|
747 | ) |
@@ -1322,6 +1322,15 b' proxy.' | |||||
1322 | Optional. Always use the proxy, even for localhost and any entries |
|
1322 | Optional. Always use the proxy, even for localhost and any entries | |
1323 | in ``http_proxy.no``. (default: False) |
|
1323 | in ``http_proxy.no``. (default: False) | |
1324 |
|
1324 | |||
|
1325 | ``http`` | |||
|
1326 | ---------- | |||
|
1327 | ||||
|
1328 | Used to configure access to Mercurial repositories via HTTP. | |||
|
1329 | ||||
|
1330 | ``timeout`` | |||
|
1331 | If set, blocking operations will timeout after that many seconds. | |||
|
1332 | (default: None) | |||
|
1333 | ||||
1325 | ``merge`` |
|
1334 | ``merge`` | |
1326 | --------- |
|
1335 | --------- | |
1327 |
|
1336 |
@@ -172,8 +172,9 b' class ConnectionManager(object):' | |||||
172 | return dict(self._hostmap) |
|
172 | return dict(self._hostmap) | |
173 |
|
173 | |||
174 | class KeepAliveHandler(object): |
|
174 | class KeepAliveHandler(object): | |
175 | def __init__(self): |
|
175 | def __init__(self, timeout=None): | |
176 | self._cm = ConnectionManager() |
|
176 | self._cm = ConnectionManager() | |
|
177 | self._timeout = timeout | |||
177 | self.requestscount = 0 |
|
178 | self.requestscount = 0 | |
178 | self.sentbytescount = 0 |
|
179 | self.sentbytescount = 0 | |
179 |
|
180 | |||
@@ -234,7 +235,7 b' class KeepAliveHandler(object):' | |||||
234 | h = self._cm.get_ready_conn(host) |
|
235 | h = self._cm.get_ready_conn(host) | |
235 | else: |
|
236 | else: | |
236 | # no (working) free connections were found. Create a new one. |
|
237 | # no (working) free connections were found. Create a new one. | |
237 | h = http_class(host) |
|
238 | h = http_class(host, timeout=self._timeout) | |
238 | if DEBUG: |
|
239 | if DEBUG: | |
239 | DEBUG.info("creating new connection to %s (%d)", |
|
240 | DEBUG.info("creating new connection to %s (%d)", | |
240 | host, id(h)) |
|
241 | host, id(h)) |
@@ -317,8 +317,8 b' class logginghttpconnection(keepalive.HT' | |||||
317 |
|
317 | |||
318 | class logginghttphandler(httphandler): |
|
318 | class logginghttphandler(httphandler): | |
319 | """HTTP handler that logs socket I/O.""" |
|
319 | """HTTP handler that logs socket I/O.""" | |
320 | def __init__(self, logfh, name, observeropts): |
|
320 | def __init__(self, logfh, name, observeropts, timeout=None): | |
321 | super(logginghttphandler, self).__init__() |
|
321 | super(logginghttphandler, self).__init__(timeout=timeout) | |
322 |
|
322 | |||
323 | self._logfh = logfh |
|
323 | self._logfh = logfh | |
324 | self._logname = name |
|
324 | self._logname = name | |
@@ -365,8 +365,8 b' if has_https:' | |||||
365 | sslutil.validatesocket(self.sock) |
|
365 | sslutil.validatesocket(self.sock) | |
366 |
|
366 | |||
367 | class httpshandler(keepalive.KeepAliveHandler, urlreq.httpshandler): |
|
367 | class httpshandler(keepalive.KeepAliveHandler, urlreq.httpshandler): | |
368 | def __init__(self, ui): |
|
368 | def __init__(self, ui, timeout=None): | |
369 | keepalive.KeepAliveHandler.__init__(self) |
|
369 | keepalive.KeepAliveHandler.__init__(self, timeout=timeout) | |
370 | urlreq.httpshandler.__init__(self) |
|
370 | urlreq.httpshandler.__init__(self) | |
371 | self.ui = ui |
|
371 | self.ui = ui | |
372 | self.pwmgr = passwordmgr(self.ui, |
|
372 | self.pwmgr = passwordmgr(self.ui, | |
@@ -525,18 +525,19 b' def opener(ui, authinfo=None, useragent=' | |||||
525 | ``sendaccept`` allows controlling whether the ``Accept`` request header |
|
525 | ``sendaccept`` allows controlling whether the ``Accept`` request header | |
526 | is sent. The header is sent by default. |
|
526 | is sent. The header is sent by default. | |
527 | ''' |
|
527 | ''' | |
|
528 | timeout = ui.configwith(float, 'http', 'timeout') | |||
528 | handlers = [] |
|
529 | handlers = [] | |
529 |
|
530 | |||
530 | if loggingfh: |
|
531 | if loggingfh: | |
531 | handlers.append(logginghttphandler(loggingfh, loggingname, |
|
532 | handlers.append(logginghttphandler(loggingfh, loggingname, | |
532 | loggingopts or {})) |
|
533 | loggingopts or {}, timeout=timeout)) | |
533 | # We don't yet support HTTPS when logging I/O. If we attempt to open |
|
534 | # We don't yet support HTTPS when logging I/O. If we attempt to open | |
534 | # an HTTPS URL, we'll likely fail due to unknown protocol. |
|
535 | # an HTTPS URL, we'll likely fail due to unknown protocol. | |
535 |
|
536 | |||
536 | else: |
|
537 | else: | |
537 | handlers.append(httphandler()) |
|
538 | handlers.append(httphandler(timeout=timeout)) | |
538 | if has_https: |
|
539 | if has_https: | |
539 | handlers.append(httpshandler(ui)) |
|
540 | handlers.append(httpshandler(ui, timeout=timeout)) | |
540 |
|
541 | |||
541 | handlers.append(proxyhandler(ui)) |
|
542 | handlers.append(proxyhandler(ui)) | |
542 |
|
543 |
General Comments 0
You need to be logged in to leave comments.
Login now