Do you think the code here is correct?:

procedure THttpCli.DoRequestSync(Rq : THttpRequest);
var
    DummyHandle     : array [0..0] of
                      {$IFDEF CLR}Borland.Vcl.Windows.THandle;
                      {$ELSE}THandle;{$ENDIF}
begin
    DoRequestAsync(Rq);

{$IFDEF DELPHI1}
    { Delphi 1 has no support for multi-threading }
    while FState <> httpReady do
        Application.ProcessMessages;
{$ELSE}
    if FMultiThreaded then begin
        while FState <> httpReady do begin
            FCtrlSocket.ProcessMessages;
            Sleep(0);
        end;
    end
    else begin
        while FState <> httpReady do begin
            { Do not use 100% CPU }
            DummyHandle[0] := INVALID_HANDLE_VALUE;
            MsgWaitForMultipleObjects(0, DummyHandle, FALSE, 1000,
                                      QS_ALLINPUT + QS_ALLEVENTS +
                                      QS_KEY + QS_MOUSE);
{$IFNDEF NOFORMS}
            Application.ProcessMessages;
            if Application.Terminated then begin
                Abort;
                break;
            end;
{$ELSE}
            FCtrlSocket.ProcessMessages;
{$ENDIF}
        end;
    end;
{$ENDIF}

{* Jul 12, 2004
   WARNING: The component now doesn't consider 401 status
            as a fatal error (no exception is triggered). This required a
            change in the application code if it was using the exception
that
            is no more triggered for status 401 and 407.
*}
    {* if FStatusCode > 401 then    Dec 14, 2004 *}
    if (FStatusCode >= 400) and (FStatusCode <> 401) and (FStatusCode <>
407) then
        raise EHttpException.Create(FReasonPhrase, FStatusCode);
end;

Please do notice that state turns to httpready with setready and
onrequestdone is two messages later! So I do not think this method is any
good. We must wait for the end of onrequestdone--IN THEORY. But it is my
experience that sometimes that is called multiple times!

The main problem is this unit uses too many postmessages and it is almost
impossible to know that when the component is really not busy.

Regards,

SZ

On 5/11/09, Sanford Whiteman <sa...@cypressintegrated.com> wrote:
>
> > Just downloaded and built ICSv7 HTTP simple C++ demo. Please test this
> > extensively and let me know. It seems to work but not sure...
>
> > http://www.fastream.com/alpha/OverbyteIcsHttpTst.zip
>
> It appears to allow multiple HEADs in a row, yes.
>
> Note  that  the User-Agent: Mozilla/3.0 (compatible) is blocked by the
> server  no matter what, as it is a robot UA. So it is actually a great
> test to trigger a 404 every time!
>
>
>



-- 
Gorkem Ates
Fastream Technologies
Software IQ: Innovation & Quality
www.fastream.com | Email: supp...@fastream.com | Tel: +90-312-223-2830 |
MSN: g_a...@hotmail.com
Join IQWF Server Yahoo group at http://groups.yahoo.com/group/IQWFServer
Join IQ Reverse Proxy Yahoo group at
http://groups.yahoo.com/group/IQReverseProxy
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to