From 05fc9c480ab2f7cd9f205874b7bf0292921d2a5e Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Thu, 29 Aug 2019 09:57:00 +0200 Subject: [PATCH] Remove the default 30-second connection timeout limit --- CHANGELOG.rst | 1 + README.rst | 4 ++-- httpie/cli.py | 10 +++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0618c193..32e17514 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,7 @@ This project adheres to `Semantic Versioning `_. `2.0.0-dev`_ (unreleased) ------------------------- * Removed Python 2.7 support (`EOL Jan 2020 `_). +* Removed the default 30-second connection ``--timeout`` limit. * Removed Python’s default limit of 100 response headers. * Added ``--max-headers`` to allow setting the max header limit. diff --git a/README.rst b/README.rst index 91bfc343..32c887e7 100644 --- a/README.rst +++ b/README.rst @@ -1576,8 +1576,8 @@ expecting that the request body will be passed through. And since there's no data nor ``EOF``, it will be stuck. So unless you're piping some data to HTTPie, this flag should be used in scripts. -Also, it might be good to override the default ``30`` second ``--timeout`` to -something that suits you. +Also, it might be good to set a connection ``--timeout`` limit to prevent +your program from hanging if the server never responds. diff --git a/httpie/cli.py b/httpie/cli.py index 96a701fe..87035120 100644 --- a/httpie/cli.py +++ b/httpie/cli.py @@ -526,11 +526,15 @@ network.add_argument( network.add_argument( '--timeout', type=float, - default=30, + default=0, metavar='SECONDS', help=""" - The connection timeout of the request in seconds. The default value is - 30 seconds. + The connection timeout of the request in seconds. + The default value is 0, i.e., there is no timeout limit. + This is not a time limit on the entire response download; + rather, an error is reported if the server has not issued a response for + timeout seconds (more precisely, if no bytes have been received on + the underlying socket for timeout seconds). """ )