08.12.2020 8:28, Tom Crane пишет:
I suspect you use OpenSSL for TLS and wget is missing the fcntl()
call from
src/openssl.c.
That was it. Checking the Slackware distro's build script
http://slackware.osuosl.org/slackware64-current/source/n/wget/wget.SlackBuild
shows it specifies,
Release 1.20.3 doesn't suppose fcntl() call, when ssl=openssl, it uses
run_with_timeout().
And there was/is a bug in src/openssl.c: openssl_peek() - SSL_peek() is
called directly wo run_with_timeout() - reason of "the hang"
In current trunk src this has been fixed:
---------------------------------------------------------------------------------
./configure --with-ssl=openssl
write(2, "\n---request begin---\nGET /groceries/en-GB/products/280200433
HTTP/1.1\r\nUser-Agent: Wget/1.20.3.206-794b7\r\nAccept:
*/*\r\nAccept-Encoding: identity\r\nHost: www.tesco.com\r\nConnection:
Keep-Alive\r\n\r\n---request end---\n", 211
---request begin---
GET /groceries/en-GB/products/280200433 HTTP/1.1
User-Agent: Wget/1.20.3.206-794b7
Accept: */*
Accept-Encoding: identity
Host: www.tesco.com
Connection: Keep-Alive
---request end---
) = 211
_newselect(5, NULL, [4], NULL, {tv_sec=1, tv_usec=0}) = 1 (out [4], left
{tv_sec=0, tv_usec=999994})
write(4, "\...", 194) = 194
ioctl(0, TIOCGPGRP, [20708]) = 0
getpgrp() = 20708
write(2, "HTTP request sent, awaiting response... ", 40HTTP request
sent, awaiting response... ) = 40
fcntl64(4, F_GETFL) = 0x2 (flags O_RDWR)
fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0
clock_gettime64(CLOCK_MONOTONIC, {tv_sec=1225, tv_nsec=8033473}) = 0
read(4, 0x1d70e03, 5) = -1 EAGAIN (Resource
temporarily unavailable)
_newselect(5, [4], NULL, NULL, {tv_sec=1, tv_usec=0}) = 1 (in [4], left
{tv_sec=0, tv_usec=946914})
clock_gettime64(CLOCK_MONOTONIC, {tv_sec=1225, tv_nsec=61924252}) = 0
read(4, "\27\3\3\1\n", 5) = 5
read(4, "f\...", 266) = 266
read(4, "\27\3\3\1\n", 5) = 5
read(4, "\...", 266) = 266
read(4, 0x1d70e03, 5) = -1 EAGAIN (Resource
temporarily unavailable)
_newselect(5, [4], NULL, NULL, {tv_sec=0, tv_usec=946109}) = 0 (Timeout)
fcntl64(4, F_SETFL, O_RDWR) = 0
ioctl(0, TIOCGPGRP, [20708]) = 0
getpgrp() = 20708
write(2, "Read error (Connection timed out) in headers.\n", 46Read error
(Connection timed out) in headers.
) = 46
write(4, "\27\3\3\0\23\307\257=\26\16ha\2204\310*R\302\225'_d\205\360",
24) = 24
close(4) = 0
ioctl(0, TIOCGPGRP, [20708]) = 0
getpgrp() = 20708
write(2, "Closed 4/SSL 0x01d6a310\n", 24Closed 4/SSL 0x01d6a310
) = 24
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=1229, ...}) = 0
ioctl(0, TIOCGPGRP, [20708]) = 0
getpgrp() = 20708
write(2, "Giving up.\n\n", 12Giving up.
) = 12
close(3) = 0
exit_group(4) = ?
+++ exited with 4 +++
---------------------------------------------------------------------------------
./configure --with-ssl=openssl CPPFLAGS="-DOPENSSL_RUN_WITHTIMEOUT"
write(2, "\n---request begin---\nGET /groceries/en-GB/products/280200433
HTTP/1.1\r\nUser-Agent: Wget/1.20.3.206-794b7\r\nAccept:
*/*\r\nAccept-Encoding: identity\r\nHost: www.tesco.com\r\nConnection:
Keep-Alive\r\n\r\n---request end---\n", 211
---request begin---
GET /groceries/en-GB/products/280200433 HTTP/1.1
User-Agent: Wget/1.20.3.206-794b7
Accept: */*
Accept-Encoding: identity
Host: www.tesco.com
Connection: Keep-Alive
---request end---
) = 211
_newselect(5, NULL, [4], NULL, {tv_sec=1, tv_usec=0}) = 1 (out [4], left
{tv_sec=0, tv_usec=999993})
write(4, "\...", 194) = 194
ioctl(0, TIOCGPGRP, [10869]) = 0
getpgrp() = 10869
write(2, "HTTP request sent, awaiting response... ", 40HTTP request
sent, awaiting response... ) = 40
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
rt_sigaction(SIGALRM, {sa_handler=0x454ba0, sa_mask=[ALRM],
sa_flags=SA_RESTART}, {sa_handler=SIG_DFL, sa_mask=[ALRM],
sa_flags=SA_RESTART}, 8) = 0
setitimer(ITIMER_REAL, {it_interval={tv_sec=0, tv_usec=0},
it_value={tv_sec=1, tv_usec=0}}, NULL) = 0
read(4, "\27\3\3\1\n", 5) = 5
read(4, "s\...", 266) = 266
read(4, "\27\3\3\1\n", 5) = 5
read(4, "~\...", 266) = 266
read(4, 0x1e0edf3, 5) = ? ERESTARTSYS (To be restarted
if SA_RESTART is set)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigaction(SIGALRM, {sa_handler=SIG_DFL, sa_mask=[ALRM],
sa_flags=SA_RESTART}, {sa_handler=0x454ba0, sa_mask=[ALRM],
sa_flags=SA_RESTART}, 8) = 0
ioctl(0, TIOCGPGRP, [10869]) = 0
getpgrp() = 10869
write(2, "Read error (Connection timed out) in headers.\n", 46Read error
(Connection timed out) in headers.
) = 46
write(4,
"\27\3\3\0\23\230\240\340'\213\5T\340\357\225\2\264\274\232\rE\211\370|",
24) = 24
close(4) = 0
ioctl(0, TIOCGPGRP, [10869]) = 0
getpgrp() = 10869
write(2, "Closed 4/SSL 0x01e08320\n", 24Closed 4/SSL 0x01e08320
) = 24
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=1229, ...}) = 0
ioctl(0, TIOCGPGRP, [10869]) = 0
getpgrp() = 10869
write(2, "Giving up.\n\n", 12Giving up.
) = 12
close(3) = 0
exit_group(4) = ?
+++ exited with 4 +++