issue in using esp_http_client
Posted: Mon Nov 26, 2018 5:49 am
I have one http client application which communicates to the Cloud. I use http client API's as follows:
1> esp_http_client_init.
2> esp_http_client_set_header to set the headers.
3> then 'esp_http_client_open' to open the connection.
4> esp_http_client_get_content_length
5> esp_http_client_write
6> esp_http_client_fetch_headers
7> esp_http_client_get_status_code
8> esp_http_client_is_chunked_response
9> esp_http_client_get_content_length
10> esp_http_client_get_status_code
11> esp_http_client_read
12> esp_http_client_cleanup
Currently I am opening a connection and closing it for every request.
But while trying to open the connection only at one time for few requests, I faced One issue that I am not able to add header using 'esp_http_client_set_header' after 'esp_http_client_open'.
using 'esp_http_client_set_header' after 'esp_http_client_open' doesn't writes header to the socket means it don't send those headers which are set after the 'esp_http_client_open' and my request goes without those headers and I receive negative response from cloud.
The esp_http_client writes only those headers to socket which are set before esp_http_client_open.
So Is there a way to set headers after opening the connection(esp_http_client_open) as I don't wan't to close my socket on each request?
1> esp_http_client_init.
2> esp_http_client_set_header to set the headers.
3> then 'esp_http_client_open' to open the connection.
4> esp_http_client_get_content_length
5> esp_http_client_write
6> esp_http_client_fetch_headers
7> esp_http_client_get_status_code
8> esp_http_client_is_chunked_response
9> esp_http_client_get_content_length
10> esp_http_client_get_status_code
11> esp_http_client_read
12> esp_http_client_cleanup
Currently I am opening a connection and closing it for every request.
But while trying to open the connection only at one time for few requests, I faced One issue that I am not able to add header using 'esp_http_client_set_header' after 'esp_http_client_open'.
using 'esp_http_client_set_header' after 'esp_http_client_open' doesn't writes header to the socket means it don't send those headers which are set after the 'esp_http_client_open' and my request goes without those headers and I receive negative response from cloud.
The esp_http_client writes only those headers to socket which are set before esp_http_client_open.
So Is there a way to set headers after opening the connection(esp_http_client_open) as I don't wan't to close my socket on each request?