2
\$\begingroup\$

I'm attempting to make a fermentation temperature controller with the ESP8266 sending data to and from my local webserver. I'm testing the esp with the arudino serial monitor and an ftdi board. I have my timeout in Apache setting to 300 and don't know why I'm getting the 408 error code. I can't find where or how to set the request headers that it mentions in the error log. Please help I'm way to many days into this project with no return so far.

Here is the output for esp and the webserver log

ESP8266:

AT+CIPSTART="TCP","192.168.2.14",80

CONNECT

OK
AT+CIPSEND=44


OK
> GET /fermControl/update.php?temp=62 HTTP/1.1 \r\n

busy s...

Recv 44 bytes

SEND OK
AT+CIPCLOSE

CLOSED

OK

Apache Access.log:

192.168.2.176 - - [23/Jun/2015:14:51:38 -0700] "-" 408 0 "-" "-"
192.168.2.176 - - [23/Jun/2015:14:52:04 -0700] "-" 408 0 "-" "-"

Apache Error.log

[Tue Jun 23 14:32:54 2015] [info] [client 192.168.2.176] Request header read timeout
[Tue Jun 23 14:36:43 2015] [info] [client 192.168.2.176] Request header read timeout
[Tue Jun 23 14:38:37 2015] [info] [client 192.168.2.176] Request header read timeout
[Tue Jun 23 14:51:38 2015] [info] [client 192.168.2.176] Request header read timeout
[Tue Jun 23 14:52:04 2015] [info] [client 192.168.2.176] Request header read timeout
\$\endgroup\$
  • \$\begingroup\$ Is there a reason why you're using HTTP 1.1? \$\endgroup\$ – Ignacio Vazquez-Abrams Jun 23 '15 at 22:38
  • \$\begingroup\$ nope, just following tutorials. ived tried without with the same results. \$\endgroup\$ – Cjueden Jun 23 '15 at 22:39
  • \$\begingroup\$ Also, you're not supposed to send a literal "\r\n". And you need two pairs. \$\endgroup\$ – Ignacio Vazquez-Abrams Jun 23 '15 at 22:40
4
\$\begingroup\$

What's happening is you are not sending what you think you are, specifically you are not sending the ending return return carriage and newlines properly.

What you are sending is:

GET /fermControl/update.php?temp=62 HTTP/1.1 \r\n

Besides there being an unnecessary space between the HTTP/1.1 and return carriage/new line combo the way you are entering it is literal which those characters are not.

Your serial terminal should send a return carriage/new line combo when you press enter as that is when the ESP8266 knows it has finished receiving a command which from you log it definitely is.

The message above message is also 49 bytes as is not 44 as you specified which doesn't even include the return carriage/new line combo. Your server is waiting for a full HTTP request which includes two return carriage new line pairs which you never send it never gets thus results in the 408 error. This is also why you see the busys... response from the ESP8266 as you are sending more characters then it is expecting and it is telling you it's busy.

You want to send AT+CIPSEND=48 and you want to send this message:

GET /fermControl/update.php?temp=62 HTTP/1.1

Then hit enter twice. This should send the request as desired.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.