Retrieve HTTP headers


#1

Hello!

I have an application on a server that requires authentication. Authentication is solved with the simple Cookie that’s returned in http header of the server response. I just can’t get to the point to reading http headers retured.

Help, please.


#2

Hiya,

Have a look at the WIP_COPT_HTTP_HEADER option to the wip_getOpts() function as a starting point.

If you are doing authentication, WIP also provides some HTTP Authentication Helper functions (e.g. wip_HTTPAuthScheme()). Check out the WIP Open AT IP Connectivity Development Guide (Section 9.18 in Version 5.10) for some details.

Please let us know how you get on…

ciao, Dave


#3

Thank you, it worked like a charm. :smiley:

I had the 2.00 version of WIP_Open_AT_IP_Connectivity_Development_Guide, and it doesn’t contain wip_getOpts.
I actually had to go through a little trouble to find v5.10, but it works. Thank you, thank you, thank you.

Anita


#4

Yes it does - it’s on page 77!


#5

Hiya,

Glad that it worked for you.

Did you use WIP_getOpts() or the wip_HTTPAuthScheme() stuff?

ciao, Dave


#6

I used both, on different applications.

The authScheme gave me no headache, as opposed to cookies :slight_smile:

I used it like this before creating DATA channel:

auth_header=wip_HTTPAuthBasic("anita", "anita");
	http_ClientTestCtx.DataChannel = wip_getFileOpts(

						http_ClientTestCtx.CnxChannel,  // session channel
						url,                   // requested URL

						http_ClientTestDataHandler,     // data handler
						&http_ClientTestCtx,            // context

						// request headers
						WIP_COPT_HTTP_HEADER, "Authorization", auth_header,
						WIP_COPT_HTTP_HEADER, "Content-Type", "*/*",
						WIP_COPT_HTTP_HEADER, "Accept",          "text/plain",
						WIP_COPT_HTTP_HEADER, "Accept-Language", "fr, en",
						WIP_COPT_END);

#7

Hiya,

Glad to hear that you got it all going - and thanks for the example for the rest of us :smiley:

ciao, Dave