Page 1 of 1

esp_tls_conn_read returns error -0x50 with 0 bytes available to read

Posted: Sat Oct 27, 2018 8:58 pm
by stoikos
when executing the example in https://github.com/espressif/esp-idf/bl ... ple_main.c it works fine. When I modify the example to POST to my own server there is a strange behavior. After successfully POSTing the data and reading the response it:
  1. it reads the complete response
  2. it reports that there are 0 bytes left to read
  3. it hangs there a 2 minutes
  4. It returns with an error -0x50
  5. I have noticed that it doesnt handle the Chunked transfer encoding as well.

Code: Select all

I (3657) example: Connection established...
I (3657) example: 427 bytes written
I (3657) example: Reading HTTP response...
I (3657) example: ==============   esp_tls_conn_read  available bytes 0
I (3697) example: =============== esp_tls_conn_read  returned 0x73 :115
I (3697) example:
115 ===== bytes read

HTTP/1.1 200 OK
Server: Kestrel
X-Powered-By: ASP.NET
Date: Sat, 27 Oct 2018 20:38:35 GMT
Content-Length: 0

I (3707) example: ==============   esp_tls_conn_read  available bytes 0           <============ it waits  (for timeout)?

(================> after 2 min  )
E (130267) esp-tls: read error :-80:
I (130267) example:  =============== esp_tls_conn_read  returned 0xffffffb0 :-80
E (130267) example: esp_tls_conn_read  returned -0x50 UNKNOWN ERROR CODE (0050)

My serves is using TLS 1.2. Any idea?

Re: esp_tls_conn_read returns error -0x50 with 0 bytes available to read

Posted: Sat Oct 27, 2018 9:48 pm
by stoikos
It seems that the problem was my "POST /api HTTP/1.1\r\n" when I changed it to "POST /api HTTP/1.0\r\n" it worked fine.