Discussion:
HttpSendRequestEx (unexpected behaviour)
(too old to reply)
Petar Popara
2006-01-17 15:12:18 UTC
Permalink
I'm doing this:

InternetOpen()
InternetConnect()
HttpOpenRequest()
HttpAddRequestHeaders()

HttpSendRequestEx()
InternetWriteFile()
HttpEndRequest()
InternetReadFile()

HttpSendRequestEx()
InternetWriteFile()
HttpEndRequest()
InternetReadFile()

HttpSendRequestEx()
InternetWriteFile()
HttpEndRequest()
InternetReadFile()

HttpSendRequestEx()
InternetWriteFile()
HttpEndRequest()
InternetReadFile()

Well, the problem is that HTTP server receives "content-length" allways the
same (during each HTTP request), although I'm sending different data! I am
setting content length like this:

INTERNET_BUFFERS BufferIn;
memset(&BufferIn, 0, sizeof( INTERNET_BUFFERS ));
BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS );
BufferIn.dwBufferTotal = static_cast<DWORD>(a_request.GetLength());
HttpSendRequestEx( m_hHttp, &BufferIn, NULL, 0, 0 );

Is this a bug?
Scherbina Vladimir
2006-01-17 15:17:20 UTC
Permalink
Content-length is a header, why are not you using HttpAddRequestHeaders with
"Context-length: value" and then HttpSendRequest(Ex) ?

--
Vladimir
Post by Petar Popara
InternetOpen()
InternetConnect()
HttpOpenRequest()
HttpAddRequestHeaders()
HttpSendRequestEx()
InternetWriteFile()
HttpEndRequest()
InternetReadFile()
HttpSendRequestEx()
InternetWriteFile()
HttpEndRequest()
InternetReadFile()
HttpSendRequestEx()
InternetWriteFile()
HttpEndRequest()
InternetReadFile()
HttpSendRequestEx()
InternetWriteFile()
HttpEndRequest()
InternetReadFile()
Well, the problem is that HTTP server receives "content-length" allways the
same (during each HTTP request), although I'm sending different data! I am
INTERNET_BUFFERS BufferIn;
memset(&BufferIn, 0, sizeof( INTERNET_BUFFERS ));
BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS );
BufferIn.dwBufferTotal = static_cast<DWORD>(a_request.GetLength());
HttpSendRequestEx( m_hHttp, &BufferIn, NULL, 0, 0 );
Is this a bug?
Petar Popara
2006-01-17 15:29:55 UTC
Permalink
Well, I've been using it like it was explained here (including sample code):

http://support.microsoft.com/kb/q177188/

I will also try your suggestion.

Thank you.
Scherbina Vladimir
2006-01-17 15:37:49 UTC
Permalink
I followed the link you gave me and there is no code that works with headers
in that BigPost.cpp.
The only thing I noticed is that UseHttpSendReqEx initializes
INTERNET_BUFFERS BufferIn; and sets it to NULL:

BufferIn.lpcszHeader = NULL;

You may also try to set valid value for lpcszHeader in your code.

--
Vladimir
Post by Petar Popara
http://support.microsoft.com/kb/q177188/
I will also try your suggestion.
Thank you.
Petar Popara
2006-01-17 15:58:19 UTC
Permalink
Post by Scherbina Vladimir
I followed the link you gave me and there is no code that works with headers
in that BigPost.cpp.
This line sets "content-length" implicitly:

BufferIn.dwBufferTotal = dwPostSize;
Post by Scherbina Vladimir
The only thing I noticed is that UseHttpSendReqEx initializes
BufferIn.lpcszHeader = NULL;
You may also try to set valid value for lpcszHeader in your code.
Which value is valid? You mean "Content-length : x\r\n"?
Scherbina Vladimir
2006-01-17 16:06:18 UTC
Permalink
Post by Petar Popara
Post by Scherbina Vladimir
I followed the link you gave me and there is no code that works with headers
in that BigPost.cpp.
BufferIn.dwBufferTotal = dwPostSize;
Post by Scherbina Vladimir
The only thing I noticed is that UseHttpSendReqEx initializes
BufferIn.lpcszHeader = NULL;
You may also try to set valid value for lpcszHeader in your code.
Which value is valid? You mean "Content-length : x\r\n"?
yea

--
Vladimir
Petar Popara
2006-01-17 16:06:16 UTC
Permalink
Post by Scherbina Vladimir
Content-length is a header, why are not you using HttpAddRequestHeaders with
"Context-length: value" and then HttpSendRequest(Ex) ?
Works fine. Thank you. I had to change "Context-length: value" into
"Content-length: value". :)
Scherbina Vladimir
2006-01-17 16:14:42 UTC
Permalink
misprint ;)

--
Vladimir
Post by Petar Popara
Post by Scherbina Vladimir
Content-length is a header, why are not you using HttpAddRequestHeaders with
"Context-length: value" and then HttpSendRequest(Ex) ?
Works fine. Thank you. I had to change "Context-length: value" into
"Content-length: value". :)
Loading...