ESP32 web server response fails

johnim
Posts: 1
Joined: Mon Nov 18, 2019 6:15 pm

ESP32 web server response fails

Postby johnim » Tue Nov 19, 2019 12:32 pm

Hi there,

I'm developing an application which communicates with a device using ESP32 through its web server.
I'm experiencing an issue, when receiving response from the server (GET request): ClientException "Invalid response reason phrase" in http GET.
Tried C# application (Android and Windows), a flutter application (both iOS and Android), and Postman as well and I get the same error every time. However, some older versions of firefox and chrome browsers display the response text.
Searched for it on the web, and found that this may be caused by the response's header not holding the appropriate structure, eg. the header lines' endings aren't closed with 0d 0a, and/or the separator between them and the body isn't 0d 0a 0d 0a. I then used wireshark to sniff around, but found that the endings of the header are ok.

The hardware developer I'm working with, told me, that he's using ESP-WROOM-32 AT Bin v1.0, because with v1.1.2 he couldn't get ip after providing ssid+pass (demo app). He sent me its code, which would send back an "OK [number]" text.

sprintf((s8 *)(server_response_str),"OK %u",ok_cnt);
ok_cnt++;
sprintf((s8 *)(esp_str),"AT+CIPSEND=%u,%u\r\n",esp_connect_number, strlen((s8 *)(server_response_str))); esp_send();
wait(100);
strcpy((s8 *)(esp_str), (s8 *)(server_response_str)); esp_send();
wait(100);
sprintf((s8 *)(esp_str),"AT+CIPCLOSE=%u\r\n",esp_connect_number); esp_send();
wait(100);

Is there anything wrong with the code?
Any suggestion what should we try to get is working?

Who is online

Users browsing this forum: Majestic-12 [Bot] and 233 guests