wget: fix for brain-damaged HTTP servers. Closes 9471
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 11 Jan 2017 19:16:45 +0000 (20:16 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 16 Jan 2017 16:33:54 +0000 (17:33 +0100)
commitdac762a702d01c8c2d42135795cc9bf23ff324a2
treebd1093d2d3a39ba87c94062818831f7fb88ee61b
parent889425812b5cda8b3394d73253cbde7355fb1115
wget: fix for brain-damaged HTTP servers. Closes 9471

write(3, "GET / HTTP/1.1\r\nUser-Agent: Wget\r\nConnection: close\r\n\r\n", 74) = 74
shutdown(3, SHUT_WR)    = 0
alarm(900)              = 900
read(3, "", 1024)       = 0
write(2, "wget: error getting response\n", 29) = 29
exit(1)

The peer simply does not return anything. It closes its connection.

Probably it detects wget closing its writing end: shutdown(3, SHUT_WR).

The point it, closing write side of the socket is _valid_ for HTTP.
wget sent the full request, it won't be sending anything more:
it will only receive the response, and that's it.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/wget.c