curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder Daniel himself.

curl.exe runs fine, but same request hangs up in libcurl.dll (8.7.1-7 in Windows 10)

From: \[Quipsy\] Markus Karg via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 2 May 2024 08:25:13 +0000

Dear all, I am kindly requesting your very appreciated help with a strange problem in curl 8.7.1-7!

CURL.EXE: Using curl.exe I am able to PUT a short 2-byte string (actually just []) to a HTTPS/2 server successfully:

* [HTTP/2] [1] OPENED stream for https://…:8080/api/labels/keys/…
* [HTTP/2] [1] [:method: PUT]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: …:8080]
* [HTTP/2] [1] [:path: /api/labels/keys/…]
* [HTTP/2] [1] [user-agent: curl/8.7.1]
* [HTTP/2] [1] [accept: */*]
* [HTTP/2] [1] [accept-encoding: deflate, gzip, br, zstd]
* [HTTP/2] [1] [authorization: Bearer …]
* [HTTP/2] [1] [content-type: application/json]
* [HTTP/2] [1] [content-length: 2]
> PUT /api/labels/keys/… HTTP/2
> Host: …:8080
> User-Agent: curl/8.7.1
> Accept: */*
> Authorization: Bearer …
> Content-Type: application/json
> Content-Length: 2
>
* upload completely sent off: 2 bytes
< HTTP/2 204

(Note that curl.exe created the content-length header on its own!)

LIBCURL.DLL: Sending the exact same PUT using libcurl.dll (using the read function printed below), the process runs into a configured 5s timeout (removing the timeout option actually hangs endless):

[HTTP/2] [1] OPENED stream for https://…:8080/api/labels/keys/…
[HTTP/2] [1] [:method: PUT]
[HTTP/2] [1] [:scheme: https]
[HTTP/2] [1] [:authority: …:8080]
[HTTP/2] [1] [:path: /api/labels/keys/…]
[HTTP/2] [1] [accept: */*]
[HTTP/2] [1] [accept-encoding: deflate, gzip, br, zstd]
[HTTP/2] [1] [authorization: Bearer …]
[HTTP/2] [1] [content-type: application/json]
Operation timed out after 5005 milliseconds with 0 out of 0 bytes received

(Note that lubcurl.dll didn’t create a content-length header on its own!)

static size_t onSendRequestChunk(char* ptr, size_t size, size_t nitems, std::string* userdata) {
  size_t bytesToSend = min(userdata->size(), size * nitems);
  memcpy(ptr, userdata->data(), bytesToSend);
  return bytesToSend;
}

SERVER: Actually in BOTH cases (curl.exe AND libcurl.dll) the server’s log tells me that the server HAS RECEIVED the data (I can see the string [] in the log!), processed it successfully, and answered with 204!

I wonder what I am doing wrong?

Any help ist highly appreciated!

If needed, I can send the complete source code, just tell me! 😊

-Markus

-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2024-05-02