Discussion:
WinHttpQueryHeaders credential problem with Post
(too old to reply)
J-F C
2006-07-04 15:04:46 UTC
Permalink
Hi,

I have a problem with WinHttpQueryHeaders.

After sending a Post Request without the required credential, I should
have the status code HTTP_STATUS_DENIED, but I'm getting
HTTP_STATUS_NO_CONTENT instead.

The weird thing is that it works fine for a Get Request, I'm getting
the expected HTTP_STATUS_DENIED.

I checked the response packets of both Get and Post request with Netmon
and it looks the same.

The problem is that I can't send back the Post Request with proper
credential, so I've patched this issue by sending a fake Get Request to
set the proper credential on my channel before sending the Post
Request, but this is causing unnecessary delay.

Any help would be greatly appreciated.

Thanks.

J-F C
J-F C
2006-07-04 16:46:33 UTC
Permalink
I made a mistake, I'm just not receiving the response in my callback,
the NO_CONTENT status was from another Request.

Any idea why I'm not receiving the Post response in my callback?

Thanks

J-F C
J-F C
2006-07-04 20:07:06 UTC
Permalink
Ok now I have more information,

I'm sending a Post Request to a Host, if I don't have the credential
information, the Host reply a 401 Unauthorized response with the
Authentification Scheme.

Then I can resend the Post Request with the good credential
information, and then send multiple Request in continuous mode.

The problem is when the credential info are good, I'm listening for a
server response with WinHttpReceiveResponse, but I never receive a
response and it block the other Request to be sent in continuous mode.

J-F C
Scherbina Vladimir
2006-07-04 20:15:36 UTC
Permalink
Are you sure you're posting required headers with post? With GET everything
is clear: params are in the URL but with POST you need to send data as
headers.
--
Vladimir
Post by J-F C
Ok now I have more information,
I'm sending a Post Request to a Host, if I don't have the credential
information, the Host reply a 401 Unauthorized response with the
Authentification Scheme.
Then I can resend the Post Request with the good credential
information, and then send multiple Request in continuous mode.
The problem is when the credential info are good, I'm listening for a
server response with WinHttpReceiveResponse, but I never receive a
response and it block the other Request to be sent in continuous mode.
J-F C
J-F C
2006-07-04 21:46:30 UTC
Permalink
Yes, the header is fine.

If the credential are good everything is fine, but if the credential
are bad I can't handle the host's 401 response because I'm trying to
send the data with WinHttpWriteData and I didn't make a
WinHttpReceiveResponse.

It doesn't seem possible to write data while trying to receive a
response.

A possible solution is to send a fake Get Request on the channel to set
the credential and then send the Post Request, but it's causing a delay
and here efficiency is important.

J-F C

Loading...