I need to send a request using the http client lib, I have to send a parameter that is an ID number in the Header of the HTTP message. I’m using the library http_client , DC 10.72 , RCM6760.
I have not found any client-side function in http client that mounts the header to send a GET request .
One more thing, I tried to use HTTP_CUSTOM_HEADERS but I guess it works only if i’m in the server side. This is a basic thing there must be a way to modify the header so I can send information there in the GET request…
Looking at the http_client.lib library you would need to modify the httpc_request() function to do this as it constructs the request based on the passed in parameters. You could modify it to add an additional parameter for the custom data and have it insert it at the position you desire.
You could do it with a wrapper function to allow any existing code call the httpc_request() function as normal - it then calls for example httpc_request_new() with null for the new parameter to indicate don’t insert custom data and your code calls httpc_request_new() directly.
I added that functionality last December, and it will be included in the upcoming Dynamic C 10.72A release. You might be able to pull the updated http_client.lib from GitHub – the change appears in this commit:
It adds a httpc_set_extra_headers() API – you need to pass it a string with one or more headers ending in CRLF.