ESP8266: HTTP GET results in 400 Bad Request


hi,

i trying obrain data pastebin.com/raw/1nmekaux. using esp8266 connected arduino via softwareserial bound rate of 9600.

every time try make request 400 bad request.

this doing:

code: [select]

at+cipmux=0


ok
at+cipmode=0


ok
at+cwjap="wifi","wifi"

wifi disconnect
wifi connected
wifi got ip

ok
at+cipstart="tcp","pastebin.com",80

connect

ok
at+cipsend=204


ok
>

busy s...

recv 204 bytes

send ok

+ipd,334:http/1.1 400 bad request
date: fri, 23 dec 2016 08:30:31 gmt
content-type: text/html
content-length: 177
connection: close
server: -nginx
cf-ray: -

<html>
<head><title>400 bad request</title></head>
<body bgcolor="white">
<center><h1>400 bad request</h1></center>
<hr><center>cloudflare-nginx</center>
</body>
</html>
closed


code: [select]

get /raw/1nmekaux http/1.1\r\n
host: pastebin.com\r\n
connection: close\r\n
accept-charset: iso-8859-1,utf-8;q=0.7,*;q=0.7\r\n
cache-control: no-cache\r\n
accept-language: de,en;q=0.7,en-us;q=0.3\r\n
\r\n

hi,

i trying obrain data pastebin.com/raw/1nmekaux. using esp8266 connected arduino via softwareserial bound rate of 9600.

at+cipstart="tcp","pastebin.com",80

connect

ok
at+cipsend=204


ok
>

busy s...

recv 204 bytes

send ok

+ipd,334:http/1.1 400 bad request
date: fri, 23 dec 2016 08:30:31 gmt
content-type: text/html
content-length: 177
connection: close
server: -nginx
cf-ray: -

<html>
<head><title>400 bad request</title></head>
<body bgcolor="white">
<center><h1>400 bad request</h1></center>
<hr><center>cloudflare-nginx</center>
</body>
</html>
closed
[/code]

code: [select]

get /raw/1nmekaux http/1.1\r\n
host: pastebin.com\r\n
connection: close\r\n
accept-charset: iso-8859-1,utf-8;q=0.7,*;q=0.7\r\n
cache-control: no-cache\r\n
accept-language: de,en;q=0.7,en-us;q=0.3\r\n
\r\n

a question, when send request packet esp8266, exact c statements?

this expect:
code: [select]

serial.print("get /raw/1nmekaux http/1.1\r\n"); //28
serial.print("host: pastebin.com\r\n"); //20
serial.print("connection: close\r\n"); //19
serial.print("accept-charset: iso-8859-1,utf-8;q=0.7,*;q=0.7\r\n"); //48
serial.print("cache-control: no-cache\r\n"); //25
serial.print("accept-language: de,en;q=0.7,en-us;q=0.3\r\n"); //42
serial.print("\r\n"); //2


i count 184 characters, not 204?

chuck?


Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > ESP8266: HTTP GET results in 400 Bad Request


arduino

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor