Changeset 33 for trunk/WebServer/UHTTPServerCGI.pas
- Timestamp:
- Sep 13, 2010, 11:20:24 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 2 2 UConfig.pas 3 3 bin 4 lib
-
- Property svn:ignore
-
trunk/WebServer/UHTTPServerCGI.pas
r32 r33 18 18 constructor Create; 19 19 destructor Destroy; override; 20 procedure S ysInfo;20 procedure ServerInfo(HandlerData: THTTPHandlerData); override; 21 21 end; 22 22 … … 50 50 51 51 // Process cookies 52 if Request.Headers.IndexOfName('Cookie') <> -1 then53 Request.Cookies.Parse( Request.Headers.Values['Cookie']);52 if EnvVars.IndexOfName('HTTP_COOKIE') <> -1 then 53 Request.Cookies.Parse(EnvVars.Values['HTTP_COOKIE']); 54 54 55 55 // Parse query string … … 64 64 Length(EnvVars.Values['REQUEST_URI']))); 65 65 66 // Load session variables 67 if Assigned(SessionStorage) then 68 SessionStorage.Load(HandlerData); 69 66 70 Response.Stream.Clear; 67 71 Response.Headers.Values['Content-type'] := 'text/html'; 68 72 73 // Execute content handler 69 74 if Assigned(OnRequest) then OnRequest(HandlerData) 70 75 else raise EEmptyHTTPHandler.Create(SEmptyHTTPHandler); 71 76 77 // Store session variables 78 if Assigned(SessionStorage) then 79 SessionStorage.Save(HandlerData); 80 72 81 with Response do begin 82 // Generate cookies 83 for I := 0 to Cookies.Count - 1 do 84 Headers.Add('Set-Cookie' + Headers.NameValueSeparator + Cookies.Names[I] + '=' + Cookies.ValueFromIndex[I]); 85 // + ';path=/;expires=' + RFC822DateTime(Now); 86 73 87 // Generate headers 74 88 for I := 0 to Headers.Count - 1 do begin 75 89 WriteLn(Headers.Names[I] + ': ' + Headers.ValueFromIndex[I]); 76 90 end; 77 78 // Generate cookies79 for I := 0 to Cookies.Count - 1 do80 Headers.Add('Set-Cookie' + Headers.NameValueSeparator + Cookies.Names[I] + '=' + Cookies.ValueFromIndex[I]);81 // + ';path=/;expires=' + RFC822DateTime(Now);82 91 83 92 WriteLn; // Empty line header separator … … 92 101 end; 93 102 94 procedure THTTPServerCGI.S ysInfo;103 procedure THTTPServerCGI.ServerInfo(HandlerData: THTTPHandlerData); 95 104 var 96 105 I: Integer; 97 106 begin 98 (* Output.Add('<h4>Environment variables:</h4>'); 99 Output.Add('<table border="1">'); 100 for I := 0 to EnvVars.Count - 1 do begin 101 Output.Add('<tr><td>' + EnvVars.Names[I] + '</td><td>' + 102 EnvVars.ValueFromIndex[I] + '</td></tr>'); 107 inherited; 108 with HandlerData, Response.Stream do begin 109 WriteString('<h5>Environment variables:</h5>'); 110 WriteString('<table border="1">'); 111 for I := 0 to EnvVars.Count - 1 do begin 112 WriteString('<tr><td>' + EnvVars.Names[I] + '</td><td>' + 113 EnvVars.ValueFromIndex[I] + '</td></tr>'); 114 end; 115 WriteString('</table>'); 103 116 end; 104 Output.Add('</table>');*)105 117 end; 106 118
Note:
See TracChangeset
for help on using the changeset viewer.