I'm testing via http://httpbin.org/get, and using both:
Code: Select all
$ curl http://httpbin.org/get
and Postman to send:
Code: Select all
GET /get HTTP/1.1
Host: httpbin.org
User-Agent: esp-idf/1.0 esp32
Code: Select all
{
"args": {},
"headers": {
"Accept": "*/*",
"Connection": "close",
"Host": "httpbin.org",
"User-Agent": "curl/7.51.0"
},
"origin": "73.0.241.158",
"url": "http://httpbin.org/get"
}
Code: Select all
/* Constants that aren't configurable in menuconfig */
#define WEB_SERVER "httpbin.org"
#define WEB_PORT 80
#define WEB_URL "/get"
Code: Select all
printf("%s", REQUEST);
I get the following (abbreviated) output:
Code: Select all
(2210) example: Connected to AP
I (2380) example: DNS lookup succeeded. IP=184.72.248.171
I (2380) example: ... allocated socket
I (2430) example: ... connected
GET /get HTTP/1.1
Host: httpbin.org
User-Agent: esp-idf/1.0 esp32
I (2430) example: ... socket send success
I (11180) wifi: pm start, type:0
Code: Select all
/* Read HTTP response */
do {
bzero(recv_buf, sizeof(recv_buf));
r = read(s, recv_buf, sizeof(recv_buf)-1);
for(int i = 0; i < r; i++) {
putchar(recv_buf[i]);
}
} while(r > 0);