Any technical reason for discarding this functionality I submitted some
time ago?
I'm using it with the Google Drive API, add seems to be working fine.
https://developers.google.com/drive/v2/reference/files/patch
Hi,
Bellow I'm sending a OverbyteIcsHttpProt.pas diff file to implement
the HTTP PATCH method ( https://tools.ietf.org/html/rfc5789 )
Some RESTful APIs need this method, so it's handy to have it directly
implemented instead of emulating it with a PUT and later header change
in the OnRequestHeaderEnd event.
-------------------------------------------------------------------------------------------
--- /trunk/Source/OverbyteIcsHttpProt.pas
+++ /trunk/Source/OverbyteIcsHttpProt.pas
@@ -611 +611 @@
- httpHEAD, httpDELETE, httpCLOSE);
+ httpHEAD, httpDELETE, httpCLOSE, httpPATCH);
@@ -931,0 +932 @@
+ procedure Patch; { Synchronous blocking Patch }
@@ -938,0 +940 @@
+ procedure PatchAsync; { Asynchronous, non-blocking Patch }
@@ -2329,0 +2332,18 @@
+ httpPATCH:
+ begin
+ SendRequest('PATCH', FRequestVer);
+ {$IFDEF UseNTLMAuthentication}
+ if not ((FAuthNTLMState = ntlmMsg1) or
+ (FProxyAuthNTLMState = ntlmMsg1)) then begin
+ TriggerSendBegin;
+ FAllowedToSend := TRUE;
+ FDelaySetReady := FALSE; { 09/26/08 ML }
+ SocketDataSent(FCtrlSocket, 0);
+ end;
+ {$ELSE}
+ TriggerSendBegin;
+ FAllowedToSend := TRUE;
+ FDelaySetReady := FALSE; { 09/26/08 ML }
+ SocketDataSent(FCtrlSocket, 0);
+ {$ENDIF}
+ end;
@@ -2423 +2443 @@
- if ((FRequestType = httpPOST) or (FRequestType =
httpPUT)) and
+ if (FRequestType in [httpPOST, httpPUT, httpPATCH]) and
@@ -2442 +2462 @@
- if (FRequestType = httpPOST) or (FRequestType = httpPUT)
then begin
+ if FRequestType in [httpPOST, httpPUT, httpPATCH] then begin
@@ -3009 +3029 @@
- if FRequestType = httpPUT then begin
+ if FRequestType in [httpPUT, httpPATCH] then begin
@@ -3273 +3293 @@
- if ((Rq = httpPOST) or (Rq = httpPUT)) and
+ if (Rq in [httpPOST, httpPUT, httpPATCH]) and
@@ -3277 +3297 @@
- raise EHttpException.Create('HTTP component has nothing to
post or put',
+ raise EHttpException.Create('HTTP component has nothing to
post, put or patch',
@@ -4499,0 +4520,17 @@
+ httpPATCH:
+ begin
+ SendRequest('PATCH', FRequestVer);
+{$IFDEF UseNTLMAuthentication}
+ if not ((FAuthNTLMState = ntlmMsg1) or
(FProxyAuthNTLMState = ntlmMsg1)) then begin
+ TriggerSendBegin;
+ FAllowedToSend := TRUE;
+ FDelaySetReady := FALSE; { 09/26/08 ML }
+ SocketDataSent(FCtrlSocket, 0);
+ end;
+{$ELSE}
+ TriggerSendBegin;
+ FAllowedToSend := TRUE;
+ FDelaySetReady := FALSE; { 09/26/08 ML }
+ SocketDataSent(FCtrlSocket, 0);
+{$ENDIF}
+ end;
@@ -4594,0 +4632,8 @@
+{ This will start the Patch process and wait until terminated
(blocking) }
+procedure THttpCli.Patch;
+begin
+ FLocationChangeCurCount := 0 ; { V1.90 }
+ DoRequestSync(httpPatch);
+end;
+
+{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * *}
@@ -4645,0 +4691,7 @@
+{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * *}
+{ This will start the patch process and returns immediately (non
blocking) }
+procedure THttpCli.PatchAsync;
+begin
+ FLocationChangeCurCount := 0 ; { V1.90 }
+ DoRequestASync(httpPatch);
+end;
--
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