Chat freely about anything...

User avatar
By martinayotte
#31455 I've reply there too.

Let say that dealing with AT command is really frustrating, because you have to deal with an additional layer to communicate between your external MCU and the ESP. Maybe you should try using ArduinoESP instead, there are plenty of example of code, and a simple WebServer is there too since it is what you seems to look for. You won't need to deal with those length calculation since the basic helper functions will handle it themselves.
User avatar
By smorg
#31475 @rant:
Well but its not really sending the respond, please refer to my question from today, which are struggling for days and nights now.

one question at a time! You asked why parts of your input are now sent.
Are you satisfied with my answer?

@ martinayotte:
BTW, with the following python command, we can clearly see that the request shown/discussed above has a length of 17 characters, not 20 netiher than 19, but 17 :
Code: Select all
python -c "print len(\"HTTP/1.1 200 OK\r\n\")"
17


That's because python of course interprets "\r\n" as only two characters. I presumed the OP uses a terminal emulator to send commands to the ESP, which doe not usually convert such sequences. So python sends the correct two bytes (CR/LF), whereas a terminal just sends "\r\n" as the four original characters.
User avatar
By martinayotte
#31523
smorg wrote:whereas a terminal just sends "\r\n" as the four original characters.

The biggest problem is that AT firmware form Espressif, at least last time I've used it, is not handling escape sequence, so we can't send such sequence in a terminal, it won't be translated to CR+LF and will stay as "\r\n" and be send directly like that.

There is not ony CRLF issue here, the problem is the HTTP response here is incomplete, it requires also "Connection: close", "Content-Type" as well as "Content-Length", many browser will still try to read the response over and over if length is unknown which lead people to think that response is not coming, but in fact, it is the browser that doesn't display it yet because it is searching for the end.

This should help : http://www.tcpipguide.com/free/t_HTTPRe ... Format.htm