I'm trying to use Basic Auth with my restful service; see
for my starting point, although I'm doing a post.
This works fine from the command line (centos or Win7, as long as curl is installed).
And I successfully used this with libcurl in my Windows test client ("
us...@servery.com" --> "user%
40servery.com"). Tcpdump on the server shows the u/p fields moved to an "Authorization:" header (Basic).
When I try this from WinINet functions, the u/p stuff in the URL is stripped but no "Authorization:" header is added. Setting the u/p in InternetConnect() seems to be ignored. As a result, I get back a 303 redirecting to the login page. (I'm using shake-the-box Rocket server for prototyping, though I plan to move to nginx later.)
This MS page suggests that WinINet is expecting a 401, although it isn't clear that applies to Basic Auth or just challenge-response authentication.
Some StackOverflow hits suggest that I need to prepare the Basic Auth header myself and use the lpszHeaders parameter of HttpSendRequest(). Is that my only choice, or am I missing something?
Thanks.
Dave
/dps