Skip to content

-T/--file-upload . does not read from STDIN on 8.14 #17513

Closed
@denandz

Description

@denandz

I did this

curl --file-upload . --trace - https://pipeto.me/asdf should read from stdin in a non-blocking way, writing data to the server as it's read from STDIN. This does not happen on 8.14. Versions 8.8 to 8.13 work; however, the reading from STDIN is delayed. Version 8.7.1 functions as expected. The following was performed on a Fedora linux machine after compiling each release with ./configure --with-openssl --without-libpsl ; make -j$(nproc). In each case, I started the command and typed asdf<ENTER> as fast as I could.

Version 8.14 - this does not read from STDIN at all and wont send data to the server:

doi@koplje:~/tmp/curls/curl-8.14.0/src$ ./curl --trace - -T . -N https://pipeto.me/asdf
== Info: Host pipeto.me:443 was resolved.
== Info: IPv6: (none)
== Info: IPv4: 146.190.74.113
== Info:   Trying 146.190.74.113:443...
== Info: ALPN: curl offers http/1.1
=> Send SSL data, 5 bytes (0x5)
0000: 16 03 01 02 00                                  .....
== Info: TLSv1.3 (OUT), TLS handshake, Client hello (1):
=> Send SSL data, 512 bytes (0x200)
...yoink...
=> Send header, 127 bytes (0x7f)
0000: 50 55 54 20 2f 61 73 64 66 20 48 54 54 50 2f 31 PUT /asdf HTTP/1
0010: 2e 31 0d 0a 48 6f 73 74 3a 20 70 69 70 65 74 6f .1..Host: pipeto
0020: 2e 6d 65 0d 0a 55 73 65 72 2d 41 67 65 6e 74 3a .me..User-Agent:
0030: 20 63 75 72 6c 2f 38 2e 31 34 2e 30 0d 0a 41 63  curl/8.14.0..Ac
0040: 63 65 70 74 3a 20 2a 2f 2a 0d 0a 54 72 61 6e 73 cept: */*..Trans
0050: 66 65 72 2d 45 6e 63 6f 64 69 6e 67 3a 20 63 68 fer-Encoding: ch
0060: 75 6e 6b 65 64 0d 0a 45 78 70 65 63 74 3a 20 31 unked..Expect: 1
0070: 30 30 2d 63 6f 6e 74 69 6e 75 65 0d 0a 0d 0a    00-continue....
<= Recv SSL data, 5 bytes (0x5)
0000: 17 03 03 00 4a                                  ....J
<= Recv SSL data, 1 bytes (0x1)
0000: 16                                              .
== Info: TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
<= Recv SSL data, 57 bytes (0x39)
0000: 04 00 00 35 00 01 51 80 72 96 16 24 08 00 00 00 ...5..Q.r..$....
0010: 00 00 00 00 00 00 20 ea a6 79 7d 29 2f fe 49 7a ...... ..y})/.Iz
0020: d8 7e f0 19 01 6a 72 76 d7 c0 29 fd 09 e4 dd 81 .~...jrv..).....
0030: a2 1c 56 c1 20 dc 76 00 00                      ..V. .v..
<= Recv SSL data, 5 bytes (0x5)
0000: 17 03 03 00 4a                                  ....J
<= Recv SSL data, 1 bytes (0x1)
0000: 16                                              .
== Info: TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
<= Recv SSL data, 57 bytes (0x39)
0000: 04 00 00 35 00 01 51 80 92 a3 66 6b 08 00 00 00 ...5..Q...fk....
0010: 00 00 00 00 01 00 20 e8 01 76 78 f5 8e d7 a6 b8 ...... ..vx.....
0020: c3 30 00 7d 49 d4 96 db 68 6a 2c c1 5e 9c f0 86 .0.}I...hj,.^...
0030: 57 41 55 6f 4c d1 ca 00 00                      WAUoL....
<= Recv SSL data, 5 bytes (0x5)
0000: 17 03 03 00 2a                                  ....*
<= Recv SSL data, 1 bytes (0x1)
0000: 17                                              .
<= Recv header, 23 bytes (0x17)
0000: 48 54 54 50 2f 31 2e 31 20 31 30 30 20 43 6f 6e HTTP/1.1 100 Con
0010: 74 69 6e 75 65 0d 0a                            tinue..
<= Recv header, 2 bytes (0x2)
0000: 0d 0a                                           ..
asdf
asd
fasdf
asd
fasdf
asdf
asdf
asdf
asdf
asdf
asdf
asdf
asdf
^C

Curl 8.13 below, note the delay and multiple entries before data being sent. Have confirmed this behavior down to version 8.8, too.

doi@koplje:~/tmp/curls/curl-8.13.0/src$ ./curl --trace - -T . -N https://pipeto.me/asdf
== Info: Host pipeto.me:443 was resolved.
== Info: IPv6: (none)
== Info: IPv4: 146.190.74.113
...yoink...
<= Recv header, 23 bytes (0x17)
0000: 48 54 54 50 2f 31 2e 31 20 31 30 30 20 43 6f 6e HTTP/1.1 100 Con
0010: 74 69 6e 75 65 0d 0a                            tinue..
<= Recv header, 2 bytes (0x2)
0000: 0d 0a                                           ..
asd
asdf
asdf
asdf
asdf
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1a                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 9 bytes (0x9)
0000: 34 0d 0a 61 73 64 0a 0d 0a                      4..asd...
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
asdf
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
asdf
asdf=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...

asdf
asdf
asdf
asd
fasd=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1a                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 9 bytes (0x9)
0000: 34 0d 0a 61 73 64 0a 0d 0a                      4..asd...

And 8.7.1 - working as expected. Data is read on STDIN immediately and sent to the server:

doi@koplje:~/tmp/curls/curl-8.7.1/src$ ./curl --trace - -T . -N https://pipeto.me/asdf
== Info: Host pipeto.me:443 was resolved.
== Info: IPv6: (none)
== Info: IPv4: 146.190.74.113
...yoink...
<= Recv header, 23 bytes (0x17)
0000: 48 54 54 50 2f 31 2e 31 20 31 30 30 20 43 6f 6e HTTP/1.1 100 Con
0010: 74 69 6e 75 65 0d 0a                            tinue..
<= Recv header, 2 bytes (0x2)
0000: 0d 0a                                           ..
asdf
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
asdf
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
asdf
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
asdf
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
asdf
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
asdf
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
asdf
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
asdf
=> Send SSL data, 5 bytes (0x5)
0000: 17 03 03 00 1b                                  .....
=> Send SSL data, 1 bytes (0x1)
0000: 17                                              .
=> Send data, 10 bytes (0xa)
0000: 35 0d 0a 61 73 64 66 0a 0d 0a                   5..asdf...
^C

I expected the following

Expected all versions to behave like 8.7.1, reading data from STDIN promptly and sending this to the server.

curl/libcurl version

Not working at all - 8.14:

$ ./curl -V
curl 8.14.0 (aarch64-unknown-linux-gnu) libcurl/8.14.0 OpenSSL/3.2.4 zlib/1.3.1.zlib-ng brotli/1.1.0 zstd/1.5.7
Release-Date: 2025-05-28
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli HSTS HTTPS-proxy IPv6 Largefile libz NTLM SSL threadsafe TLS-SRP UnixSockets zstd

Working, but slow - 8.8 to 8.13

curl 8.13.0 (aarch64-unknown-linux-gnu) libcurl/8.13.0 OpenSSL/3.2.4 zlib/1.3.1.zlib-ng brotli/1.1.0 zstd/1.5.7
Release-Date: 2025-04-02
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli HSTS HTTPS-proxy IPv6 Largefile libz NTLM SSL threadsafe TLS-SRP UnixSockets zstd

working as expected - 8.7.1 and below:

curl 8.7.1 (aarch64-unknown-linux-gnu) libcurl/8.7.1 OpenSSL/3.2.4 zlib/1.3.1.zlib-ng brotli/1.1.0 zstd/1.5.7
Release-Date: 2024-03-27
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTPS-proxy IPv6 Largefile libz NTLM SSL threadsafe TLS-SRP UnixSockets zstd

operating system

Fedora Linux 40

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions