-
Hi, I'm writing an API client using reqwest, and I'm facing the error Here's the snippet of code that is causing the error https://github.com/MrMarble/zte-modem/blob/849ea7fe5724f1c710e0e61d790ae8fbd4c4d8f7/src/lib.rs#L51-L60 and how I'm creating the client https://github.com/MrMarble/zte-modem/blob/849ea7fe5724f1c710e0e61d790ae8fbd4c4d8f7/src/lib.rs#L32-L37 Enabling verbose output, I can see that the server responds successfully but reqwest is returning the error: [2024-11-24T09:20:50Z DEBUG reqwest::connect] starting new connection: http://192.168.0.1/
[2024-11-24T09:20:50Z TRACE reqwest::connect::verbose] 3b849e4b write (vectored): b"POST /goform/goform_set_cmd_process HTTP/1.1\r\ncontent-type: application/x-www-form-urlencoded\r\naccept: application/json, text/javascript, */*; q=0.01\r\nreferer: http://192.168.0.1/index.html\r\nhost: 192.168.0.1\r\ncontent-length: 101\r\n\r\n"b"isTest=false&goformId=LOGIN&password=<REDACTED>"
[2024-11-24T09:20:50Z TRACE reqwest::connect::verbose] 3b849e4b read: b"HTTP/1.0 200 OK\n"
[2024-11-24T09:20:50Z TRACE reqwest::connect::verbose] 3b849e4b read: b"Pragma: no-cache\r\nCache-control: no-cache\r\nContent-Type: text/html\r\nX-Frame-Options: sameorigin\r\nX-XSS-Protection: 1; mode=block\r\nSet-Cookie: stok=<REDACTED>;path=/;HttpOnly=1;Expires=Mon, 1 Jan 2050 00:00:00 GMT\n\r\n{\"result\":\"0\"}"
[2024-11-24T09:20:50Z TRACE reqwest::connect::verbose] 3b849e4b read: b""
Error: error sending request for url (http://192.168.0.1/goform/goform_set_cmd_process)
Caused by:
0: client error (SendRequest)
1: connection closed before message completed
Running the same request through cURL or in a python script works, reqwest is the only one that returns the error. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
For the record, I've moved from reqwest to ureq and everything works, even if the problem is on the server (which probably it is), reqwest does something different while validating the connection, preventing it from working |
Beta Was this translation helpful? Give feedback.
For the record, I've moved from reqwest to ureq and everything works, even if the problem is on the server (which probably it is), reqwest does something different while validating the connection, preventing it from working