Browse Source

* Fixed crash when getting remotehost. Bug #19397

git-svn-id: trunk@17656 -
michael 14 years ago
parent
commit
39c271d0f4
1 changed files with 4 additions and 6 deletions
  1. 4 6
      packages/fcl-web/src/base/fpapache.pp

+ 4 - 6
packages/fcl-web/src/base/fpapache.pp

@@ -463,11 +463,9 @@ begin
   If (Index in [1..NoHTTPFields]) then
   If (Index in [1..NoHTTPFields]) then
     begin
     begin
     FN:=HTTPFieldNames[Index];
     FN:=HTTPFieldNames[Index];
-    P:=apr_table_get(FRequest^.headers_in,pchar(FN));
-    If (P<>Nil) then
-      Result:=StrPas(P);
+    Result:=MaybeP(apr_table_get(FRequest^.headers_in,pchar(FN)));
     end;
     end;
-  if (Result='') then
+  if (Result='') and Assigned(FRequest) then
     case Index of
     case Index of
       0  : Result:=MaybeP(FRequest^.protocol); // ProtocolVersion
       0  : Result:=MaybeP(FRequest^.protocol); // ProtocolVersion
       7  : Result:=MaybeP(FRequest^.content_encoding); //ContentEncoding
       7  : Result:=MaybeP(FRequest^.content_encoding); //ContentEncoding
@@ -480,8 +478,8 @@ begin
            If (FRequest^.Connection<>Nil) then
            If (FRequest^.Connection<>Nil) then
              begin
              begin
              Result:=MaybeP(ap_get_remote_host(FRequest^.Connection,
              Result:=MaybeP(ap_get_remote_host(FRequest^.Connection,
-                                   FRequest^.Per_Dir_Config,
-                                   REMOTE_HOST,Nil));
+                            nil,
+                            REMOTE_NAME,@i));
              end;                   
              end;                   
       29 : begin // ScriptName
       29 : begin // ScriptName
            Result:=MaybeP(FRequest^.unparsed_uri);
            Result:=MaybeP(FRequest^.unparsed_uri);