#701032 wget tries to reuse connection despite http/1.0 and no connection: keep-alive

Package:
wget
Source:
wget
Description:
retrieves files from the web
Submitter:
Moritz Molle
Date:
2023-06-03 16:09:02 UTC
Severity:
normal
Tags:
#701032#5
Date:
2013-02-20 17:56:27 UTC
From:
To:
   * What led up to the situation?

   i built a simple webserver with pythons BaseHTTPServer, which
   requires a basic http auth. the server answers in http 1.0 and
   sends no Connection: keep-alive header.

   Now i tried to test it with wget, which sent at first (even though
   i gave it user and password) no auth-string, probably to test which
   auth-scheme is used.

   the server sent a 401 with the WWW-Authenticate: Basic header, and NOW

   wget tried to reuse the connection, which is already closed, and
   should not have been reused, because there was no Content-length
   header, there was no Keep-alive header AND it was http 1.0, but it
   did, and the request failed. even though the server didn't do
   anything wrong.

   * What outcome did you expect instead?

   i expected one connection per request which would have worked. i
   didn't expect to read 'reusing existing connection' if there was
   known to be no keep-alive

#701032#10
Date:
2013-06-10 14:20:14 UTC
From:
To:
Hi,

could you please post the output from Wget -d ?

I configured an Apache to HTTP 1.0 plus Basic Auth, but could not reproduce
your problem. So I guess the type of HTTP header returned by the server
matter.

#701032#15
Date:
2013-08-13 16:01:00 UTC
From:
To:
tags 701032 + moreinfo unreproducible
thanks

Hello Moritz,

Am Mittwoch, den 20.02.2013, 18:56 +0100 schrieb Moritz Molle:

Maybe the question from Tim didn't reached you:

http://bugs.debian.org/701032

Can you send us the output of --debug?
Addition maybe you could test it with version 1.14 in testing or sid?

Thank you.

#701032#22
Date:
2013-12-26 11:41:41 UTC
From:
To:
URL:
  <http://savannah.gnu.org/bugs/?41003>

                 Summary: wget tries to reuse connection despite http/1.0 and
no connection: keep-alive
                 Project: GNU Wget
            Submitted by: nok
            Submitted on: Do 26 Dez 2013 12:41:40 CET
                Category: Protocol Issue
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name:
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Any
                 Release: trunk
        Operating System: GNU/Linux
         Reproducibility: None
           Fixed Release: None
         Planned Release: None
              Regression: None
           Work Required: None
          Patch Included: None

#701032#31
Date:
2013-12-27 04:58:25 UTC
From:
To:
Follow-up Comment #1, bug #41003 (project wget):

This bug cannot be reproduced. I have set up the exact same environment as
described in the bug report. A Python BaseHTTPServer with protocol_version =
HTTP/1.0.

Wget does indeed close the connection after each request and creates a new
connection. This is evidently seen in the debug output:

```
Running Test Test Debian #701032
/home/sauron/Programming/wget/src/wget -d --user=Sauron --password=TheEye
127.0.0.1:35404/File1
['/home/sauron/Programming/wget/src/wget', '-d', '--user=Sauron',
'--password=TheEye', '127.0.0.1:35404/File1']
Setting --user (user) to Sauron
Setting --password (password) to TheEye
DEBUG output created by Wget 1.14.99-fb23 on linux-gnu.

URI encoding = ‘UTF-8’
--2013-12-27 10:15:23--  http://127.0.0.1:35404/File1
Host ‘127.0.0.1’ has not issued a general basic challenge.
Connecting to 127.0.0.1:35404... connected.
Created socket 3.
Releasing 0x0000000001859b80 (new refcount 0).
Deleting unused 0x0000000001859b80.
---request end--- HTTP request sent, awaiting response... 127.0.0.1 - - [27/Dec/2013 10:15:23] "GET /File1 HTTP/1.1" 401 - Unable to Authenticate
---response end--- 401 Authorization Required Registered socket 3 for persistent reuse. ] done. Inserted ‘127.0.0.1’ into basic_authed_hosts Disabling further reuse of socket 3. Closed fd 3 Connecting to 127.0.0.1:35404... connected. Created socket 3. Releasing 0x00000000018599e0 (new refcount 0). Deleting unused 0x00000000018599e0.
---request end--- HTTP request sent, awaiting response... 127.0.0.1 - - [27/Dec/2013 10:15:23] "GET /File1 HTTP/1.1" 200 - 100%[====================================================================================================================>] 24 --.-K/s in 0s 2013-12-27 10:15:23 (2.34 MB/s) - ‘File1’ saved [24/24] ``` Also, addressing a question about no auth string sent in the first request, that is the default behaviour of Wget for identification of the auth protocol. This can be overridden by using the switch --auth-no-challenge so it won't wait for a challenge from the server and will instead send the credentials in the first request itself.
#701032#36
Date:
2013-12-29 19:21:42 UTC
From:
To:
tags 701032 + unreproducible
thanks

Hello Moritz,

as Darshit tested your report is not reproducible:
http://bugs.debian.org/701032

Can you still reproduce the problem?
Can you give us more information to trace the problem down?

Thx.

Regards

	Noel

#701032#43
Date:
2014-01-10 12:20:03 UTC
From:
To:
Follow-up Comment #2, bug #41003 (project wget):

by inspecting the code, I see that wget doesn't check for the version of the
HTTP protocol and it should assume no keep-alive connection by default when
HTTP/1.0 is used.

Darshit, if you specify --debug, do you get the "Registered socket %d for
persistent reuse.\n" message?

I was quickly testing with netcat as:

$ printf "HTTP/1.0 200 OK\r\nContent-Length: 0\r\n\r\n" | nc -l -p 8080

$ LANG=C ./wget -d -O /dev/null http://localhost:8080/ 2>&1  | grep
Registered
Registered socket 4 for persistent reuse.

#701032#48
Date:
2014-01-17 05:43:27 UTC
From:
To:
Follow-up Comment #3, bug #41003 (project wget):

Giuseppe, I have posted the --debug output in my previous comment.

As can be seen, Wget does indeed register the socket for persistent reuse,
however, just 2 lines later it also closes the socket and creates a new one.

This is correct according to the HTTP protocol, a new socket was used for a
new request, however in my opinion this is also a waste of machine cycles.
First registering a socket and then deleting it.

#701032#53
Date:
2014-06-08 14:49:30 UTC
From:
To:
Update of bug #41003 (project wget):

                  Status:                    None => In Progress
             Assigned to:                    None => darnir

#701032#58
Date:
2017-02-26 06:15:14 UTC
From:
To:
Dear Customer,

Your parcel was successfully delivered February 25 to UPS Station, but our courier cound not contact you.

You can download the shipment label attached!

Sincerely yours,
Jim Slater,
UPS Support Manager.

#701032#63
Date:
2017-03-20 11:43:48 UTC
From:
To:
Dear Customer,

We can not deliver your parcel arrived at March 19.

You can download the shipment label attached!

Best regards,
Carl Spence,
UPS Delivery Manager.

#701032#68
Date:
2017-03-24 15:07:18 UTC
From:
To:
Dear Customer,

Please check your package delivery details attached!

FedEx
-----BEGIN PGP PUBLIC KEY BLOCK----- jhEStLr+C5EgE/dFgH6PVGiQvQI/c+HbEXj5uV1wMc1Q59FqxltKbd37fsnnLGeuMKx21qwl6iQu KdP6+s6DfI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1CkHyMsR/VNvINeXwMJZWsLFfgkfetzRb5t7/XN+wcSGaQmsRI+vvZDqf+Xq5BpnBQuKyWNDtzd GAO9IxLuheGpgdkoOVdXTb7aE75rdxnIP8fwueELoAHPHuNcR1d+Tq7QdEwVt0ouh3/5rYmWhqcv KcUySx/DR4r7efRhSSaDrRVOKt1uheUq5+8HYM8u7Q==
-----END PGP PUBLIC KEY BLOCK-----
#701032#73
Date:
2020-07-24 16:21:06 UTC
From:
To:
Hello,
I am Mr. Peter Marcus Ramon, a banker, a France origin but resided here in
Cote d Ivoire for work, I stopped at your profile and will love to know
more about you,I have a business that will profit both of us in your
country that I want us to discuss about. I will be glad to hear from you
soon for more details, take care dear.

Mr. Peter Marcus Ramon

#701032#78
Date:
2023-06-03 15:49:03 UTC
From:
To:
Do you find it frustrating to spend hours searching for the perfect template,assets, resources and services ? Look no further than Envato Elements!

Envato Elements is a one-stop-shop for high-quality templates for everything from WordPress websites to PowerPoint presentations, graphics, and more. With thousands of professionally-designed templates to choose from, Envato Elements makes it easy to find exactly what you need to take your online presence to the next level.

But don't just take my word for it - check out my latest blog post where I go into more detail about the benefits of Envato Elements and how it can help take your online presence to the next level.

https://www.vimscon.com/2023/04/why-envato-elements-is-game-changer-for.html

Don't miss out on this opportunity to supercharge your business. Visit our blog article now and discover the power of Envato Elements.


Best regards,

#701032#83
Date:
2023-06-03 15:51:58 UTC
From:
To:
Do you find it frustrating to spend hours searching for the perfect template,assets, resources and services ? Look no further than Envato Elements!

Envato Elements is a one-stop-shop for high-quality templates for everything from WordPress websites to PowerPoint presentations, graphics, and more. With thousands of professionally-designed templates to choose from, Envato Elements makes it easy to find exactly what you need to take your online presence to the next level.

But don't just take my word for it - check out my latest blog post where I go into more detail about the benefits of Envato Elements and how it can help take your online presence to the next level.

https://www.vimscon.com/2023/04/why-envato-elements-is-game-changer-for.html

Don't miss out on this opportunity to supercharge your business. Visit our blog article now and discover the power of Envato Elements.


Best regards,