Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl POP3 STAT shows 2 minute delay #14677

Closed
ralfjunker opened this issue Aug 25, 2024 · 8 comments
Closed

curl POP3 STAT shows 2 minute delay #14677

ralfjunker opened this issue Aug 25, 2024 · 8 comments
Labels

Comments

@ralfjunker
Copy link

I did this

curl --request STAT --ssl-reqd -v --insecure -u user:password pop3s://pop.gmx.net

I expected the following

I expect curl to finish immediately, but see a 2 minute delay instead.

This follows up on #14201 (comment), but the actual cause might be unrelated.

Here is the Windows error log.

curl/libcurl version

Windows:

curl 8.9.1 (x86_64-w64-mingw32) libcurl/8.9.1 LibreSSL/3.9.2 zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 WinIDN libpsl/0.21.5 libssh2/1.11.0 nghttp2/1.62.1 ngtcp2/1.6.0 nghttp3/1.4.0
Release-Date: 2024-07-31
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL SSPI threadsafe UnixSockets zstd

Debian Bookworm:

curl 7.88.1 (x86_64-pc-linux-gnu) libcurl/7.88.1 OpenSSL/3.0.13 zlib/1.2.13 brotli/1.0.9 zstd/1.5.4 libidn2/2.3.3 libpsl/0.21.2 (+libidn2/2.3.3) libssh2/1.10.0 nghttp2/1.52.0 librtmp/2.3 OpenLDAP/2.5.13
Release-Date: 2023-02-20, security patched: 7.88.1-10+deb12u6
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

operating system

Windows 11, Debian Bookworm.

@bagder bagder added the POP3 label Aug 25, 2024
@bagder
Copy link
Member

bagder commented Aug 26, 2024

Did this use to work for you in an older version?

@ralfjunker
Copy link
Author

No.

On Windows, the oldest version I tested is curl 8.4.0, and the delay is present there as well as all later versions.

On Debian Bookworm I just tested curl 7.88.1, which also has the delay.

I did not test other versions.

@icing
Copy link
Contributor

icing commented Aug 27, 2024

Looking at the POP3 log, curl just seems to wait for the server to send more lines, whereas 'STAT' only sends a single line back. The 2 minute delay is a timeout at the server that then sends curl a TLS close notify.

RFC 1939 differentiates between multi-line commands, ending with \n.\n and commands that give only a single line. @bagder: I cannot see how pop3.c handles these.

icing added a commit to icing/curl that referenced this issue Aug 28, 2024
Some POP3 commands are multi-line, e.g. have responses terminated
by a last line with '.', but some are not. Define the known command
properties and fix response handling.

Refs #curl#14677, where the 'STAT' command is hanging as it waits for
a multi-line response that never comes.

Add test case for STAT.
@icing
Copy link
Contributor

icing commented Aug 28, 2024

I made #14707 as a fix for this.

@bagder
Copy link
Member

bagder commented Aug 28, 2024

Just a note on this based on the explanation above: --request was always an option that replaces a command string with another string, without otherwise changing how it behaves.

Thus: --request STAT for POP3 is not a curl bug. It is actually just "wrong use" of curl.

But of course: we might still want to consider supporting this use case so that users actually can send STAT this way.

@ralfjunker
Copy link
Author

Thus: --request STAT for POP3 is not a curl bug. It is actually just "wrong use" of curl.

Could you suggest a "correct" use of curl to obtain the result of POP3 STAT?

@bagder
Copy link
Member

bagder commented Aug 29, 2024

Could you suggest a "correct" use of curl to obtain the result of POP3 STAT?

I don't believe curl has one.

@bagder
Copy link
Member

bagder commented Aug 29, 2024

But with #14707 it should be possible.

icing added a commit to icing/curl that referenced this issue Aug 30, 2024
Some POP3 commands are multi-line, e.g. have responses terminated
by a last line with '.', but some are not. Define the known command
properties and fix response handling.

Refs #curl#14677, where the 'STAT' command is hanging as it waits for
a multi-line response that never comes.

Add test case for STAT.
@bagder bagder closed this as completed in 4cd10ee Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants