Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HttpSendRequest blocks until timeout

862 views
Skip to first unread message

Scot T Brennecke

unread,
Jul 28, 2002, 8:58:49 AM7/28/02
to
We have an application that is currently using the MFC CHttpxxx classes,
but we'll change that to directly use the WinInet API if necessary.
(WinInet.DLL version 5.50.4915.500 on my machine)

Sometimes a call to HttpSendRequest will hang the process for several
minutes (unless we get frustrated and kill it). We are performing these
SendRequest calls frequently, but with relatively small posts and small
replies (a few KB at most). Our app is not making these calls from more
than one thread.

Is the only possible problem that there are somehow more than 2
simultaneous connections? I can't yet see how we'd have more than one
connection at a time (let alone more than two). But that's the only
idea I've been able to come up with so far. Is there any other possible
scenario that could cause it to hang?

The vast majority of calls to HttpSendRequest succeed with no problem.
However, there are a few repeatable sequences in our application that
will cause it to hang.

I eagerly welcome any ideas or solutions.

Carl Daniel

unread,
Aug 4, 2002, 7:45:55 PM8/4/02
to
"Scot T Brennecke" <ScotBsp...@MVPs.org> wrote in message
news:MPG.17ada681c...@msnews.microsoft.com...

> We have an application that is currently using the MFC CHttpxxx classes,
> but we'll change that to directly use the WinInet API if necessary.
> (WinInet.DLL version 5.50.4915.500 on my machine)
>
> Sometimes a call to HttpSendRequest will hang the process for several
> minutes (unless we get frustrated and kill it). We are performing these
> SendRequest calls frequently, but with relatively small posts and small
> replies (a few KB at most). Our app is not making these calls from more
> than one thread.

Could you be running afoul of this (incredible) text from the description of
HttpSendRequest in MSDN:

------
The function also lets the client specify optional data to send to the HTTP
server immediately following the request headers. This feature is generally
used for "write" operations such as PUT and POST. When using optional data,
be aware of the following caveat: the size of the optional data buffer,
specified with the dwOptionalLength parameter, must be either less than 32
bytes or greater than approximately 150 bytes. Otherwise, the
HttpSendRequest function fails.
-----

IIRC, when the function "fails", it doesn't always do so immediately. Or
maybe I'm mis-remembering.... caveat reader.

-cd

Scot T Brennecke

unread,
Aug 4, 2002, 11:05:01 PM8/4/02
to
In article <OBLU0DBPCHA.2604@tkmsftngp11>, Carl Daniel says...

> Could you be running afoul of this (incredible) text from the description of
> HttpSendRequest in MSDN:

Thanks for the follow-up, Carl. I neglected to post back here when I
found my solution.

Although I don't fully understand why we were hanging on to extra
connections, it was indeed the problem of too many connections causing
the block. By calling InternetSetOption to increase the
INTERNET_OPTION_MAX_CONNS_PER_SERVER up to 4 (instead of 2), it is no
longer hanging the application.

Alexander Valderrama

unread,
Oct 11, 2002, 4:54:19 PM10/11/02
to

Hi, this is an error that this function has.

You have to send the function by a thread, and then use the
waitforSingleObject funtion, this function will wait the HttpSendRequest to
end for a time you specify.

"Carl Daniel" <cpda...@pacbell.net> wrote in message
news:OBLU0DBPCHA.2604@tkmsftngp11...

0 new messages