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: (95) error while uploading file to nginx with http3 #11389

Closed
Karthikdasari0423 opened this issue Jun 27, 2023 · 14 comments
Closed

curl: (95) error while uploading file to nginx with http3 #11389

Karthikdasari0423 opened this issue Jun 27, 2023 · 14 comments
Assignees
Labels
HTTP/3 h3 or quic related

Comments

@Karthikdasari0423
Copy link
Contributor

I did this

curl --http3 -k -v https://127.0.0.1:8443/upload/BPS.pdf -T /upload/BPS.pdf

I expected the following

I expected to upload file completely

curl/libcurl version

curl -V
curl 8.2.0-DEV (x86_64-pc-linux-gnu) libcurl/8.2.0-DEV OpenSSL/3.0.9 zlib/1.2.11 brotli/1.0.9 nghttp2/1.55.0-DEV ngtcp2/0.16.0 nghttp3/0.13.0-DEV
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTP3 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL threadsafe TLS-SRP UnixSockets

operating system

Linux ubuntu 5.15.0-60-generic #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

I tried to upload file to nginx using below command

curl --http3 -k -v https://127.0.0.1:8443/upload/BPS.pdf -T /upload/BPS.pdf

but unable to upload file using http3 but able to upload file using http2

With http2

curl --http2 -k -v https://127.0.0.1:8443/upload/BPS.pdf -T /upload/BPS.pdf

  • processing: https://127.0.0.1:8443/upload/BPS.pdf
  • Trying 127.0.0.1:8443...
  • Connected to 127.0.0.1 (127.0.0.1) port 8443
  • ALPN: offers h2,http/1.1
  • TLSv1.3 (OUT), TLS handshake, Client hello (1):
  • TLSv1.3 (IN), TLS handshake, Server hello (2):
  • TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
  • TLSv1.3 (IN), TLS handshake, Certificate (11):
  • TLSv1.3 (IN), TLS handshake, CERT verify (15):
  • TLSv1.3 (IN), TLS handshake, Finished (20):
  • TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
  • TLSv1.3 (OUT), TLS handshake, Finished (20):
  • SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
  • ALPN: server accepted h2
  • Server certificate:
  • subject: CN=ubuntu
  • start date: Feb 10 15:24:51 2023 GMT
  • expire date: Feb 7 15:24:51 2033 GMT
  • issuer: CN=ubuntu
  • SSL certificate verify result: self-signed certificate (18), continuing anyway.
  • using HTTP/2
  • h2 [:method: PUT]
  • h2 [:scheme: https]
  • h2 [:authority: 127.0.0.1:8443]
  • h2 [:path: /upload/BPS.pdf]
  • h2 [user-agent: curl/8.2.0-DEV]
  • h2 [accept: /]
  • h2 [content-length: 30182355]
  • Using Stream ID: 1

PUT /upload/BPS.pdf HTTP/2
Host: 127.0.0.1:8443
User-Agent: curl/8.2.0-DEV
Accept: /
Content-Length: 30182355

  • TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
  • TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
  • old SSL session ID is stale, removing
  • We are completely uploaded and fine
    < HTTP/2 201
    < server: nginx/1.25.1
    < date: Tue, 27 Jun 2023 06:54:37 GMT
    < content-length: 0
    < location: https://127.0.0.1:8443/upload/BPS.pdf
    <
  • Connection #0 to host 127.0.0.1 left intact
With http3

curl --http3-only -k -v https://127.0.0.1:8443/upload/BPS.pdf -T /upload/BPS.pdf

  • processing: https://127.0.0.1:8443/upload/BPS.pdf
  • Trying 127.0.0.1:8443...
  • Skipped certificate verification
  • Connected to 127.0.0.1 (127.0.0.1) port 8443
  • using HTTP/3
  • Using HTTP/3 Stream ID: 0

PUT /upload/BPS.pdf HTTP/3
Host: 127.0.0.1:8443
User-Agent: curl/8.2.0-DEV
Accept: /
Content-Length: 30182355

  • We are completely uploaded and fine
  • ngtcp2_conn_handle_expiry returned error: ERR_IDLE_CLOSE
  • Connection #0 to host 127.0.0.1 left intact
    curl: (55) ngtcp2_conn_handle_expiry returned error: ERR_IDLE_CLOSE
@icing
Copy link
Contributor

icing commented Jun 27, 2023

Does the HTTP/3 transfer time out?

@icing icing self-assigned this Jun 27, 2023
@Karthikdasari0423
Copy link
Contributor Author

not sure,but file is not getting uploaded and below is the output i am getting

curl --http3-only -k -v https://127.0.0.1:8443/upload/BPS.pdf -T /upload/BPS.pdf

  • processing: https://127.0.0.1:8443/upload/BPS.pdf
  • Trying 127.0.0.1:8443...
  • Skipped certificate verification
  • Connected to 127.0.0.1 (127.0.0.1) port 8443
  • using HTTP/3
  • Using HTTP/3 Stream ID: 0

PUT /upload/BPS.pdf HTTP/3
Host: 127.0.0.1:8443
User-Agent: curl/8.2.0-DEV
Accept: /
Content-Length: 30182355

  • We are completely uploaded and fine
  • HTTP/3 stream 0 was not closed cleanly: (err 257)
  • Connection #0 to host 127.0.0.1 left intact
    curl: (95) HTTP/3 stream 0 was not closed cleanly: (err 257)

please let me know if you need any further info

@icing
Copy link
Contributor

icing commented Jun 27, 2023

My question is if there is a pause of some seconds between uploaded and fine and the error was not closed cleanly. Could your run curl with --trace-time and show the output? Thanks.

@Karthikdasari0423
Copy link
Contributor Author

sure,here is the output
curl --http3-only -k -v --trace-time https://127.0.0.1:8443/upload/Free_Test_Data_1MB_PDF.pdf -T /upload/Free_Test_Data_1MB_PDF.pdf
07:45:16.255789 * processing: https://127.0.0.1:8443/upload/Free_Test_Data_1MB_PDF.pdf
07:45:16.255915 * Trying 127.0.0.1:8443...
07:45:16.264696 * Skipped certificate verification
07:45:16.264770 * Connected to 127.0.0.1 (127.0.0.1) port 8443
07:45:16.264830 * using HTTP/3
07:45:16.264928 * Using HTTP/3 Stream ID: 0
07:45:16.265013 > PUT /upload/Free_Test_Data_1MB_PDF.pdf HTTP/3
07:45:16.265013 > Host: 127.0.0.1:8443
07:45:16.265013 > User-Agent: curl/8.2.0-DEV
07:45:16.265013 > Accept: /
07:45:16.265013 > Content-Length: 1052352
07:45:16.265013 >
07:45:16.275216 * We are completely uploaded and fine
07:46:16.305188 * ngtcp2_conn_handle_expiry returned error: ERR_IDLE_CLOSE
07:46:16.305461 * Connection #0 to host 127.0.0.1 left intact
curl: (55) ngtcp2_conn_handle_expiry returned error: ERR_IDLE_CLOSE

icing added a commit to icing/curl that referenced this issue Jun 27, 2023
- refs curl#11389 where IDLE timeouts on  upload are reported
- reword ngtcp2 expiry handling to apply to both send+recv
  calls into the filter
- EAGAIN uploads similar to the recent changes in HTTP/2, e.g.
  report success only when send data was ACKed.
- HOLD sending of EAGAINed uploads to avoid cpu busy loops
- rename internal function for consistency with HTTP/2
  implementation
@icing
Copy link
Contributor

icing commented Jun 27, 2023

Could you build and test the code in #11390? Thanks!

@Karthikdasari0423
Copy link
Contributor Author

sure
will test and will update you

@Karthikdasari0423
Copy link
Contributor Author

make
Making all in lib
make[1]: Entering directory '/src/curl/lib'
make all-am
make[2]: Entering directory '/src/curl/lib'
CC vquic/libcurl_la-curl_ngtcp2.lo
vquic/curl_ngtcp2.c: In function ‘cb_h3_stream_close’:
vquic/curl_ngtcp2.c:1105:7: error: ‘snihost’ undeclared (first use in this function); did you mean ‘SN_host’?
1105 | if(!snihost)
| ^~~~~~~
| SN_host
vquic/curl_ngtcp2.c:1105:7: note: each undeclared identifier is reported only once for each function it appears in
vquic/curl_ngtcp2.c: In function ‘qng_verify_peer’:
vquic/curl_ngtcp2.c:1858:7: error: case label not within a switch statement
1858 | case NGTCP2_ERR_STREAM_SHUT_WR:
| ^~~~
vquic/curl_ngtcp2.c: In function ‘read_pkt_to_send’:
vquic/curl_ngtcp2.c:2039:14: error: ‘gsolen’ undeclared (first use in this function)
2039 | (gsolen > path_max_payload_size && (size_t)nread != gsolen)) {
| ^~~~~~
vquic/curl_ngtcp2.c:2039:23: error: ‘path_max_payload_size’ undeclared (first use in this function)
2039 | (gsolen > path_max_payload_size && (size_t)nread != gsolen)) {
| ^~~~~~~~~~~~~~~~~~~~~
vquic/curl_ngtcp2.c:2039:56: error: ‘nread’ undeclared (first use in this function); did you mean ‘pread’?
2039 | (gsolen > path_max_payload_size && (size_t)nread != gsolen)) {
| ^~~~~
| pread
vquic/curl_ngtcp2.c:2039:72: error: expected ‘;’ before ‘)’ token
2039 | (gsolen > path_max_payload_size && (size_t)nread != gsolen)) {
| ^
| ;
vquic/curl_ngtcp2.c:2039:72: error: expected statement before ‘)’ token
vquic/curl_ngtcp2.c:2081:17: error: invalid storage class for function ‘cf_progress_egress’
2081 | static CURLcode cf_progress_egress(struct Curl_cfilter *cf,
| ^~~~~~~~~~~~~~~~~~
vquic/curl_ngtcp2.c: In function ‘cf_progress_egress’:
vquic/curl_ngtcp2.c:2157:5: error: expected expression before ‘goto’
2157 | goto out;
| ^~~~
vquic/curl_ngtcp2.c:2172:5: error: expected expression before ‘}’ token
2172 | }
| ^
vquic/curl_ngtcp2.c:2147:7: error: label ‘out’ used but not defined
2147 | goto out;
| ^~~~
vquic/curl_ngtcp2.c: In function ‘read_pkt_to_send’:
vquic/curl_ngtcp2.c:2191:1: error: duplicate label ‘out’
2191 | out:
| ^~~
vquic/curl_ngtcp2.c:2077:1: note: previous definition of ‘out’ with type ‘void’
2077 | out:
| ^~~
vquic/curl_ngtcp2.c: At top level:
vquic/curl_ngtcp2.c:279:17: warning: ‘cf_progress_egress’ used but never defined
279 | static CURLcode cf_progress_egress(struct Curl_cfilter *cf,
| ^~~~~~~~~~~~~~~~~~
make[2]: *** [Makefile:3271: vquic/libcurl_la-curl_ngtcp2.lo] Error 1
make[2]: Leaving directory '/src/curl/lib'
make[1]: *** [Makefile:1508: all] Error 2
make[1]: Leaving directory '/src/curl/lib'
make: *** [Makefile:1267: all-recursive] Error 1

@icing
Copy link
Contributor

icing commented Jun 28, 2023

The PR works in our CI infrastructure. This does not seem to be the version you are trying to build.

@Karthikdasari0423
Copy link
Contributor Author

Karthikdasari0423 commented Jun 28, 2023

Can you please commit this PR,so that i can build and test
or can you please share me the curl_ngtcp2.c file with your changes

@icing
Copy link
Contributor

icing commented Jun 28, 2023

@Karthikdasari0423
Copy link
Contributor Author

okay,let me build

@Karthikdasari0423
Copy link
Contributor Author

upload is working fine with your fix

curl --http3-only -k -v --trace-time https://127.0.0.1:8443/upload/BPS.pdf -T /upload/BPS.pdf
09:16:45.890218 * processing: https://127.0.0.1:8443/upload/BPS.pdf
09:16:45.890401 * Trying 127.0.0.1:8443...
09:16:45.897615 * Skipped certificate verification
09:16:45.897668 * Connected to 127.0.0.1 (127.0.0.1) port 8443
09:16:45.897707 * using HTTP/3
09:16:45.897796 * Using HTTP/3 Stream ID: 0
09:16:45.897889 > PUT /upload/BPS.pdf HTTP/3
09:16:45.897889 > Host: 127.0.0.1:8443
09:16:45.897889 > User-Agent: curl/8.2.0-DEV
09:16:45.897889 > Accept: /
09:16:45.897889 > Content-Length: 30182355
09:16:45.897889 >
09:16:57.610016 < HTTP/3 201
09:16:57.610072 < server: nginx/1.25.1
09:16:57.610119 < date: Wed, 28 Jun 2023 09:16:57 GMT
09:16:57.610155 < content-length: 0
09:16:57.610188 < location: https://127.0.0.1:8443/upload/BPS.pdf
09:16:57.610232 <
09:16:57.610305 * We are completely uploaded and fine
09:16:57.610355 * Connection #0 to host 127.0.0.1 left intact

Thank you @icing

@icing
Copy link
Contributor

icing commented Jun 28, 2023

Thank you for testing and confirming!

@Karthikdasari0423
Copy link
Contributor Author

np,you are welcome
Thank you too @icing

@bagder bagder added the HTTP/3 h3 or quic related label Jun 30, 2023
icing added a commit to icing/curl that referenced this issue Jul 9, 2023
- refs curl#11389 where IDLE timeouts on  upload are reported
- reword ngtcp2 expiry handling to apply to both send+recv
  calls into the filter
- EAGAIN uploads similar to the recent changes in HTTP/2, e.g.
  report success only when send data was ACKed.
- HOLD sending of EAGAINed uploads to avoid cpu busy loops
- rename internal function for consistency with HTTP/2
  implementation
@bagder bagder closed this as completed in 15b1313 Jul 9, 2023
bch pushed a commit to bch/curl that referenced this issue Jul 19, 2023
- refs curl#11389 where IDLE timeouts on upload are reported
- reword ngtcp2 expiry handling to apply to both send+recv
  calls into the filter
- EAGAIN uploads similar to the recent changes in HTTP/2, e.g.
  report success only when send data was ACKed.
- HOLD sending of EAGAINed uploads to avoid cpu busy loops
- rename internal function for consistency with HTTP/2
  implementation

Fixes curl#11389
Closes curl#11390
ptitSeb pushed a commit to wasix-org/curl that referenced this issue Sep 25, 2023
- refs curl#11389 where IDLE timeouts on upload are reported
- reword ngtcp2 expiry handling to apply to both send+recv
  calls into the filter
- EAGAIN uploads similar to the recent changes in HTTP/2, e.g.
  report success only when send data was ACKed.
- HOLD sending of EAGAINed uploads to avoid cpu busy loops
- rename internal function for consistency with HTTP/2
  implementation

Fixes curl#11389
Closes curl#11390
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HTTP/3 h3 or quic related
Development

No branches or pull requests

3 participants