Hi,

in order to support HTTP DELETE requests [1] in the THttpCli component I
have made some small additions (see patch below). It would be great if you
could consider including the patch in the upstream version of ICS.

Note: I first considered adding the new request type by overloading the
component but could not find a good way to achieve that.

Regards,
Tobias

Links:
[1] https://tools.ietf.org/html/rfc2616#section-9.7


(start patch)

Index: OverbyteIcsHttpProt.pas
===================================================================
--- OverbyteIcsHttpProt.pas     (revision 894)
+++ OverbyteIcsHttpProt.pas     (working copy)
@@ -585,7 +585,7 @@
 
     THttpEncoding    = (encUUEncode, encBase64, encMime);
     THttpRequest     = (httpABORT, httpGET, httpPOST, httpPUT,
-                        httpHEAD,  httpCLOSE);
+                        httpHEAD, httpDELETE, httpCLOSE);
     THttpState       = (httpReady,         httpNotConnected, httpConnected,
                         httpDnsLookup,     httpDnsLookupDone,
                         httpWaitingHeader, httpWaitingBody,  httpBodyReceived,
@@ -923,12 +923,14 @@
         procedure   Post;       { Synchronous blocking Post        }
         procedure   Put;        { Synchronous blocking Put         }
         procedure   Head;       { Synchronous blocking Head        }
+        procedure   Delete;     { Synchronous blocking Delete      }
         procedure   Close;      { Synchronous blocking Close       }
         procedure   Abort;      { Synchrounous blocking Abort      }
         procedure   GetASync;   { Asynchronous, non-blocking Get   }
         procedure   PostASync;  { Asynchronous, non-blocking Post  }
         procedure   PutASync;   { Asynchronous, non-blocking Put   }
         procedure   HeadASync;  { Asynchronous, non-blocking Head  }
+        procedure   DeleteASync;{ Asynchronous, non-blocking Delete}
         procedure   CloseAsync; { Asynchronous, non-blocking Close }
         procedure   ThreadAttach; override;
         procedure   ThreadDetach; override;
@@ -2333,6 +2335,10 @@
                     SocketDataSent(FCtrlSocket, 0);
                 {$ENDIF}
                 end;
+            httpDELETE:
+                begin
+                    SendRequest('DELETE', FRequestVer);
+                end;
             httpHEAD:
                 begin
                     SendRequest('HEAD', FRequestVer);
@@ -4548,6 +4554,10 @@
                 SocketDataSent(FCtrlSocket, 0);
 {$ENDIF}
             end;
+        httpDELETE:
+            begin
+                SendRequest('DELETE', FRequestVer);
+            end;
         httpHEAD:
             begin
                 SendRequest('HEAD', FRequestVer);
@@ -4621,6 +4631,15 @@
 
 
 {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
+{ This will start the Delete process and wait until terminated (blocking)     }
+procedure THttpCli.Delete;
+begin
+    FLocationChangeCurCount := 0 ;
+    DoRequestSync(httpDELETE);
+end;
+
+
+{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
 { This will start the Post process and wait until terminated (blocking)     }
 procedure THttpCli.Post;
 begin
@@ -4665,6 +4684,15 @@
 
 
 {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
+{ This will start the delete process and returns immediately (non blocking) }
+procedure THttpCli.DeleteAsync;
+begin
+    FLocationChangeCurCount := 0 ; 
+    DoRequestASync(httpDELETE);
+end;
+
+
+{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
 { This will start the post process and returns immediately (non blocking)   }
 procedure THttpCli.PostAsync;
 begin

(end patch)

--
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