Changeset 100 for trunk/Packages/CoolWeb/WebServer/UHTTPServer.pas
- Timestamp:
- Oct 2, 2012, 2:52:20 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CoolWeb/WebServer/UHTTPServer.pas
r96 r100 13 13 EEmptyHTTPHandler = class(Exception); 14 14 15 TQueryParameterList = class(T StringList)15 TQueryParameterList = class(TDictionaryStringString) 16 16 procedure Parse(Text: string); 17 17 function Syntetize: string; … … 20 20 { TCookieList } 21 21 22 TCookieList = class(T StringList)22 TCookieList = class(TDictionaryStringString) 23 23 procedure Parse(Text: string); 24 24 function Syntetize: string; … … 148 148 WriteString('<h5>Request HTTP headers</h5>'); 149 149 for I := 0 to Request.Headers.Count - 1 do begin; 150 WriteString(Request.Headers.Items[I].Value + '<br/>'); 150 with Request.Headers.Items[I] do 151 WriteString(Key + ': ' + Value + '<br/>'); 152 end; 153 154 WriteString('<h5>Request HTTP GET</h5>'); 155 for I := 0 to Request.Query.Count - 1 do begin 156 with Request.Query.Items[I] do 157 WriteString(Key + ': ' + Value + '<br/>'); 151 158 end; 152 159 153 160 WriteString('<h5>Request HTTP cookies</h5>'); 154 for I := 0 to Request.Cookies.Count - 1 do begin; 155 WriteString(Request.Cookies.Strings[I] + '<br/>'); 161 for I := 0 to Request.Cookies.Count - 1 do begin 162 with Request.Cookies.Items[I] do 163 WriteString(Key + ': ' + Value + '<br/>'); 156 164 end; 157 165 158 166 //WriteString('Session id: ' + SessionId); 159 167 WriteString('<h5>Session variables</h5>'); 160 for I := 0 to Session.Count - 1 do begin; 161 WriteString(Session.Strings[I] + '<br/>'); 168 for I := 0 to Session.Count - 1 do begin 169 with Session do 170 WriteString(Names[I] + ': ' + ValueFromIndex[I] + '<br/>'); 162 171 end; 163 172 164 173 WriteString('<h5>Request HTTP POST</h5>'); 165 for I := 0 to Request.Post.Count - 1 do begin; 166 WriteString(Request.Post.Strings[I] + '<br/>'); 174 for I := 0 to Request.Post.Count - 1 do begin 175 with Request.Post.Items[I] do 176 WriteString(Key + ': ' + Value + '<br/>'); 167 177 end; 168 178 … … 173 183 WriteString('<h5>Response HTTP headers</h5>'); 174 184 with Response.Content do 175 for I := 0 to Response.Headers.Count - 1 do begin; 176 WriteString(Response.Headers.Items[I].Value + '<br/>'); 185 for I := 0 to Response.Headers.Count - 1 do begin 186 with Response.Headers.Items[I] do 187 WriteString(Key + ': ' + Value + '<br/>'); 177 188 end; 178 189 179 190 WriteString('<h5>Response HTTP cookies</h5>'); 180 191 for I := 0 to Response.Cookies.Count - 1 do begin; 181 WriteString(Response.Cookies.Strings[I] + '<br/>'); 192 with Response.Cookies.Items[I] do 193 WriteString(Key + ': ' + Value + '<br/>'); 182 194 end; 183 195 end; … … 352 364 Pair.Explode(Parts[I], '=', StrToStr); 353 365 if Pair.Count >= 2 then 354 Values[Pair[0]] := Pair[1];366 Add(Pair[0], Pair[1]); 355 367 end; 356 368 … … 367 379 Result := ''; 368 380 for I := 0 to Count - 1 do 369 Result := Result + '&' + Names[I] + '=' + ValueFromIndex[I];381 Result := Result + '&' + Keys[I] + '=' + Items[I].Value; 370 382 Result := Copy(Result, 6, Length(Result)); 371 383 end; … … 387 399 Pair.Explode(Parts[I], '=', StrToStr); 388 400 if Pair.Count >= 2 then 389 Values[Trim(Pair[0])] := Trim(Pair[1]);401 Add(Trim(Pair[0]), Trim(Pair[1])); 390 402 end; 391 403 finally … … 401 413 Result := ''; 402 414 for I := 0 to Count - 1 do 403 Result := Result + '; ' + Names[I] + '=' + ValueFromIndex[I];415 Result := Result + '; ' + Keys[I] + '=' + Items[I].Value; 404 416 Result := Copy(Result, 2, Length(Result)); 405 417 end; … … 447 459 destructor THTTPHandlerData.Destroy; 448 460 begin 449 Request.Free;450 Response.Free;451 Session.Free;452 inherited Destroy;461 FreeAndNil(Request); 462 FreeAndNil(Response); 463 FreeAndNil(Session); 464 inherited; 453 465 end; 454 466
Note:
See TracChangeset
for help on using the changeset viewer.