ivmarkov/rust-esp32-std-demo

HTTP headers seem wrong

Closed this issue · 3 comments

I'm running the demo on a c3 chip with no modifications.
Connecting to the controller over http seems to fail when using curl and Postman, however it does work from Firefox.

E.g.:

curl -v http://10.11.12.233       
*   Trying 10.11.12.233:80...
* Connected to 10.11.12.233 (10.11.12.233) port 80 (#0)
> GET / HTTP/1.1
> Host: 10.11.12.233
> User-Agent: curl/7.79.1
> Accept: */*
> 
* Unsupported HTTP version in response
* Closing connection 0

Postman fails with similar error:

GET http://10.11.12.233/
Error: Parse Error: Invalid response status
Request Headers
User-Agent: PostmanRuntime/7.29.2
Accept: */*
Host: 10.11.12.233
Accept-Encoding: gzip, deflate, br
Connection: keep-alive

If I connect with telnet I see something like this:

$>telnet 10.11.12.233 80
Trying 10.11.12.233...
Connected to 10.11.12.233.
Escape character is '^]'.
GET / HTTP/1.1

HTTP/1.1 T???????M
Content-Type: text/html
Transfer-Encoding: chunked

10
Hello from Rust!
0


As you can see it does return a body, but the return header seems weird. See my previous issue here

Branch: main; Commit code: 354e0b3

Same issue with ESP32C3. It does work from Chrome ( version: 104.* ).
Because of the weird response header even the Chrome can't get the correct status code, such as 500 or 403. Every response status code is 200.
For example, when the server prints "Boo, something happened!", the Chrome still gets code 200, it should be 500 instead.

There is way to walk around, go back to "old" HTTP server creating method ↓
#[cfg(feature = "experimental")]
fn httpd(mutex: Arc<(Mutex<Option>, Condvar)>) -> Resultidf::Server {
PS: remember to delete the word "not" after cfg in { #[cfg(not(feature = "experimental"))] }

This should be working now with the latest esp-idf-svc release. Can somebody confirm so that I can close this issue? Do cargo update before rebuilding though.

upgrading esp-idf-svc to 0.42.3 works! Headers seem good, curl works as well.
Thanks! This issue can be closed.