Ignore:
Timestamp:
Oct 2, 2012, 2:52:20 PM (12 years ago)
Author:
chronos
Message:
  • Upraveno: V balíčku CoolWeb některé seznamy změněny z typu TStringList na TListString.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CoolWeb/WebServer/UHTTPServer.pas

    r96 r100  
    1313  EEmptyHTTPHandler = class(Exception);
    1414
    15   TQueryParameterList = class(TStringList)
     15  TQueryParameterList = class(TDictionaryStringString)
    1616    procedure Parse(Text: string);
    1717    function Syntetize: string;
     
    2020  { TCookieList }
    2121
    22   TCookieList = class(TStringList)
     22  TCookieList = class(TDictionaryStringString)
    2323    procedure Parse(Text: string);
    2424    function Syntetize: string;
     
    148148    WriteString('<h5>Request HTTP headers</h5>');
    149149    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/>');
    151158    end;
    152159
    153160    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/>');
    156164    end;
    157165
    158166    //WriteString('Session id: ' + SessionId);
    159167    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/>');
    162171    end;
    163172
    164173    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/>');
    167177    end;
    168178
     
    173183    WriteString('<h5>Response HTTP headers</h5>');
    174184    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/>');
    177188    end;
    178189
    179190    WriteString('<h5>Response HTTP cookies</h5>');
    180191    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/>');
    182194    end;
    183195  end;
     
    352364      Pair.Explode(Parts[I], '=', StrToStr);
    353365      if Pair.Count >= 2 then
    354         Values[Pair[0]] := Pair[1];
     366        Add(Pair[0], Pair[1]);
    355367    end;
    356368
     
    367379  Result := '';
    368380  for I := 0 to Count - 1 do
    369     Result := Result + '&amp;' + Names[I] + '=' + ValueFromIndex[I];
     381    Result := Result + '&amp;' + Keys[I] + '=' + Items[I].Value;
    370382  Result := Copy(Result, 6, Length(Result));
    371383end;
     
    387399      Pair.Explode(Parts[I], '=', StrToStr);
    388400      if Pair.Count >= 2 then
    389         Values[Trim(Pair[0])] := Trim(Pair[1]);
     401        Add(Trim(Pair[0]), Trim(Pair[1]));
    390402    end;
    391403  finally
     
    401413  Result := '';
    402414  for I := 0 to Count - 1 do
    403     Result := Result + '; ' + Names[I] + '=' + ValueFromIndex[I];
     415    Result := Result + '; ' + Keys[I] + '=' + Items[I].Value;
    404416  Result := Copy(Result, 2, Length(Result));
    405417end;
     
    447459destructor THTTPHandlerData.Destroy;
    448460begin
    449   Request.Free;
    450   Response.Free;
    451   Session.Free;
    452   inherited Destroy;
     461  FreeAndNil(Request);
     462  FreeAndNil(Response);
     463  FreeAndNil(Session);
     464  inherited;
    453465end;
    454466
Note: See TracChangeset for help on using the changeset viewer.