user7135972
user7135972

Reputation:

Esp8266 How to parse HTTP Response

I send http get request to web server with my ESP8266. And my server returns;

HTTP/1.1 200 OK Date: Sat, 22 Jul 2017 11:16:10 GMT Server: Apache/2.4.10 (Raspbian) Content-Length: 16 Connection: close Content-Type: text/html; charset=UTF-8

Important Part

As you can understand i need "Important Part" to for assign a variable. I don't want to use external library. I think if we say whole message is equal x, and HTTP response part is y, if we do x - y we find the "Important Part" right?

How can we do it, how can i read until charset=UTF-8 to get payload ?

Upvotes: 0

Views: 1499

Answers (1)

Pyjong
Pyjong

Reputation: 3197

You are looking for 2 CRLFs in row (HTTP spec). Start reading from the beginning of your receive buffer, once you encounter 0xD 0xA 0xD 0xA, you are at your Important Part.

Upvotes: 1

Related Questions