This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to add header parameters in HTTP GET and POST Request

Other Parts Discussed in Thread: EK-TM4C1294XL

Hi,

We have to send some parameters as part of the header in HTTP request which is being send to Server. I have seen enet_weather and enet_io examples and checked most of tcp methods but did not find any struct which accepts HTTP header.

We have to send Authorization, Context-type, Accept-Encoding etc in Request Header which is being sent to Server. Also have to add parameters when someone opens web page (as in enet_io) also want to restrict access based on parameters. 

Can anyone guide me to solve this? 

I am using EK-TM4C1294XL board with CCS  Version: 6.1.0.00104 and TivaWare_C_Series-2.1.1.71 on Windows 8.

Thanks,
Bhavesh

  • Hello Bhavesh

    Did you check lwIP for details on adding parameters?

    Regards
    Amit
  • Hi Amit,

    In LwIP there is a single parameter LWIP_HTTPD_DYNAMIC_HEADERS which is used for headers when Web Page is opened from Hub.
    While sending data to server as we are directly using tcp/ip methods, there is no explicit header flag, and it should be copied in pcRequest directly followed by \r\n. Following is the generated string as below:

    "GET api.openweathermap.org/.../weather HTTP/1.1\r\n Authorization: basic\r\n Accept-Encoding: gzip, deflate, sdch \r\n\r\n"

    This can be used for any REST APIs. This is working fine.
    When Hub acting as a server LWIP_HTTPD_DYNAMIC_HEADERS will be used to carry out header part. Still working on this part and will update if everything works out.

    Thanks,
    Bhavesh