Browse Source

* Recognition of the XHTTPRequestedWith http header for CGI and FCGI

git-svn-id: trunk@14651 -
joost 15 years ago
parent
commit
c9eea4ff5e

+ 4 - 1
packages/fcl-web/src/custcgi.pp

@@ -136,7 +136,9 @@ Const
     { 31: 'SERVER_ADMIN'           } '',
     { 32: 'SCRIPT_FILENAME'        } '',
     { 33: 'REMOTE_PORT'            } '',
-    { 34: 'REQUEST_URI'            } ''
+    { 34: 'REQUEST_URI'            } '',
+    { 35: 'CONTENT'                } '',
+    { 36: 'XHTTPREQUESTEDWITH'     } ''
   );
 
 Procedure TCustomCGIApplication.GetCGIVarList(List : TStrings);
@@ -357,6 +359,7 @@ begin
     30 : Result:=DecodeVar(15); // Property ServerPort
     31 : Result:=DecodeVar(12); // Property RequestMethod
     33 : Result:=DecodeVar(7); // Property QueryString
+    36 : Result:=DecodeVar(36); // Property XRequestedWith
   else
     Result:=Inherited GetFieldValue(Index);
   end;

+ 4 - 2
packages/fcl-web/src/custfcgi.pp

@@ -227,14 +227,16 @@ const HttpToCGI : THttpToCGI =
      12,  // 31 'REQUEST_METHOD'
       0,  // 32
       7,  // 33 'QUERY_STRING'
-     27   // 34 'HTTP_HOST'
+     27,  // 34 'HTTP_HOST'
+      0,  // 35 'CONTENT'
+     36   // 36 'XHTTPREQUESTEDWITH'
     );
 
 var ACgiVarNr : Integer;
 
 begin
   Result := '';
-  if assigned(FCGIParams) and (index < high(HttpToCGI)) and (index > 0) then
+  if assigned(FCGIParams) and (index < high(HttpToCGI)) and (index > 0) and (index<>35) then
     begin
     ACgiVarNr:=HttpToCGI[Index];
     if ACgiVarNr>0 then

+ 4 - 2
packages/fcl-web/src/custweb.pp

@@ -24,7 +24,7 @@ uses
   CustApp,Classes,SysUtils, httpdefs, fphttp;
 
 Const
-  CGIVarCount = 34;
+  CGIVarCount = 36;
 
 Type
   TCGIVarArray = Array[1..CGIVarCount] of String;
@@ -65,7 +65,9 @@ Const
     { 31 } 'SERVER_ADMIN',
     { 32 } 'SCRIPT_FILENAME',
     { 33 } 'REMOTE_PORT',
-    { 34 } 'REQUEST_URI'
+    { 34 } 'REQUEST_URI',
+    { 35 } 'CONTENT',
+    { 36 } 'HTTP_X_REQUESTED_WITH'
     );
 
 Type