Browse Source

* Implemented a HEAD class method

git-svn-id: trunk@23503 -
michael 12 years ago
parent
commit
fc68ce2ec5
1 changed files with 13 additions and 0 deletions
  1. 13 0
      packages/fcl-web/src/base/fphttpclient.pp

+ 13 - 0
packages/fcl-web/src/base/fphttpclient.pp

@@ -127,6 +127,8 @@ Type
     Procedure FileFormPost(const AURL, AFieldName, AFileName: string; const Response: TStream);
     Procedure FileFormPost(const AURL, AFieldName, AFileName: string; const Response: TStream);
     // Simple form of Posting a file
     // Simple form of Posting a file
     Class Procedure SimpleFileFormPost(const AURL, AFieldName, AFileName: string; const Response: TStream);
     Class Procedure SimpleFileFormPost(const AURL, AFieldName, AFileName: string; const Response: TStream);
+    // Get HEAD
+    Class Procedure HEAD(AURL : String; Headers: TStrings);
   Protected
   Protected
     // Before request properties.
     // Before request properties.
     // Additional headers for request. Host; and Authentication are automatically added.
     // Additional headers for request. Host; and Authentication are automatically added.
@@ -1159,6 +1161,17 @@ begin
     end;
     end;
 end;
 end;
 
 
+class procedure TFPCustomHTTPClient.HEAD(AURL : String; Headers: TStrings);
+begin
+  With Self.Create(nil) do
+    try
+      HTTPMethod('HEAD', AURL, Nil, [200]);
+      Headers.Assign(ResponseHeaders);
+    Finally
+      Free;
+    end;
+end;
+
 
 
 end.
 end.