Hi everyone!

Is there any simple way to handle other than the GET, POST and HEADER request methods,... as OPTIONS,...? The way it is now, the THttpConnection.ProcessRequest procedure always respond with a Answer501, not giving any chance to handle other methods.
I think a TriggerOnUnknownMethod event would be very useful.

procedure THttpConnection.ProcessRequest;
var handled:boolean;
...
if FMethod = 'GET' then
        ProcessGet
    else if FMethod = 'POST' then
        ProcessPost
    else if FMethod = 'HEAD' then
        ProcessHead
    else begin
        TriggerOnUnknownMethod(handled);
        if not handled then
       begin
          if FKeepAlive = FALSE then {Bjornar}
               PrepareGraceFullShutDown;
          Answer501;   { 07/03/2005 was Answer404 }
       end;
    end;
    TriggerBeforeAnswer;  { V7.19 }
end;

By the way, the TriggerBeforeAnswer is used in what scenarios? From the code above, it seems the answer has been delivered already.

Another thing that would be useful, if added to the code base of the THttpConnection, is the possibility to send additional headers from the THttpConnection.SendDocument, to define cache control, etc..

procedure THttpConnection.SendDocument(SendType : THttpSendType; const aHeader:string='');
...
    if FLastModified <> 0 then
Header := Header + 'Last-Modified: ' + RFC1123_Date(FLastModified) + ' GMT' + #13#10;
    if ContEncoderHdr <> '' then
        Header := Header + ContEncoderHdr;  { V7.20 }
    if aHeader > '' then
        Header := Header + aHeader
    Header := Header + GetKeepAliveHdrLines + #13#10;
...

Regards,
Rui
--
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