After sending the following line to the esp from arduino's serial using AT+CIPSEND:
GET / HTTP/1.0\r\nHost:www.onet.pl\r\n\r\n\r\n\r\n
I've intercepted the packet and that's what it actually looks like:
###[ Raw ]###
load = '\nGET / HTTP/1.0**r**nHost:www.onet.pl**r**n**r**n\r\n**'
It results in responses like this:
+IPD,323:HTTP/1.1 400 Bad Request
Server: nginx-accelerator
Date: Sat, 10 Dec 2016 01:59:46 GMT
Content-Type: text/html
Content-Length: 166
Connection: close
400 Bad Request
400 Bad Request
nginx
There are a lot of people struggling with the same error (400 bad request) and so far I haven't found a solution anywhere... Is there anyone who knows what could be the reason of such wickedness? Or someone who knows a solution?
The server maintains logs of GET, POST, etc. requests. There may be more details there.
Usually, a GET request defines what script to run on the server. If you are trying to replicate the functionality of a browser, it is important to understand that a browser is NOT a dumb client. It will try asking for different scripts to be run, until it gets a response. You need to do the same. Or, more simply, ask for the right script in the first place.
Man, the problem is that what I send through the serial monitor to the arduino which passes it to the esp8266 module somewhere on its path becomes something different.
Single backslash "" becomes double backslash "\".
"GET" becomes "\nGET".
EDIT: I found out that the problem doesn't occur if I use AT+CIPSEND command from the code instead of using serial monitor
EDIT: I found out that the problem doesn't occur if I use AT+CIPSEND command from the code instead of using serial monitor
This suggests that you have the Serial Monitor app configured to add carriage return or line feed or both to everything sent, and you don't strip them off.
But the script is blank, the communication occurs through the arduino IDE serial monitor which sends it to the esp (through arduino's pin 1 and 0). That's where I input the commands and for some reason it causes the bug. If I send the same commands from the code then it works properly.