Ignore:
Timestamp:
Sep 9, 2022, 9:41:42 PM (2 years ago)
Author:
chronos
Message:
  • Fixed: Better handle invalid not found pages including correct HTTP code.
Location:
trunk/Modules/ZdechovNET
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/ZdechovNET/UAboutPage.pas

    r138 r139  
    3636begin
    3737  with TWebSession(HandlerData) do begin
     38    if Request.Path.Count > 1 then begin
     39      PageNotFound;
     40      Exit;
     41    end;
     42
    3843    ModuleUser.LoadUserInfo;
    3944    with HtmlDocument.Body, SubItems.AddString do begin
  • trunk/Modules/ZdechovNET/UContactPage.pas

    r138 r139  
    1212  TContactPage = class(TWebPage)
    1313    procedure DataModuleProduce(HandlerData: THTTPHandlerData);
    14   private
    15     { private declarations }
    1614  public
    1715    ModuleUser: TModuleUser;
     
    3230begin
    3331  with TWebSession(HandlerData), HtmlDocument.Body, SubItems.AddString do begin
     32    if Request.Path.Count > 1 then begin
     33      PageNotFound;
     34      Exit;
     35    end;
     36
    3437    ModuleUser.LoadUserInfo;
    3538    Text := '<strong>Kontaktní informace</strong><br/>' +
  • trunk/Modules/ZdechovNET/UDocumentsPage.pas

    r138 r139  
    1212  TDocumentsPage = class(TWebPage)
    1313    procedure DataModuleProduce(HandlerData: THTTPHandlerData);
    14   private
    15     { private declarations }
    1614  public
    1715    ModuleUser: TModuleUser;
  • trunk/Modules/ZdechovNET/UHistoryPage.pas

    r138 r139  
    1313  THistoryPage = class(TWebPage)
    1414    procedure DataModuleProduce(HandlerData: THTTPHandlerData);
    15   private
    16     { private declarations }
    1715  public
    1816    ModuleUser: TModuleUser;
     
    3836begin
    3937  with TWebSession(HandlerData) do begin
     38    if Request.Path.Count > 1 then begin
     39      PageNotFound;
     40      Exit;
     41    end;
     42
    4043    ModuleUser.LoadUserInfo;
    4144    with HtmlDocument.Body, SubItems.AddString do begin
  • trunk/Modules/ZdechovNET/UHostingPage.pas

    r138 r139  
    1313  THostingPage = class(TWebPage)
    1414    procedure DataModuleProduce(HandlerData: THTTPHandlerData);
    15   private
    16     { private declarations }
    1715  public
    1816    ModuleUser: TModuleUser;
     
    3836begin
    3937  with TWebSession(HandlerData) do begin
     38    if Request.Path.Count > 1 then begin
     39      PageNotFound;
     40      Exit;
     41    end;
     42
    4043    ModuleUser.LoadUserInfo;
    4144    with HtmlDocument.Body, SubItems.AddString do begin
  • trunk/Modules/ZdechovNET/UIPTVPage.pas

    r138 r139  
    8888begin
    8989  with TWebSession(HandlerData) do begin
     90    if Request.Path.Count > 1 then begin
     91      PageNotFound;
     92      Exit;
     93    end;
     94
    9095    ModuleUser.LoadUserInfo;
    9196    with HtmlDocument.Body, SubItems.AddString do begin
  • trunk/Modules/ZdechovNET/UInternetPage.pas

    r138 r139  
    1212  TInternetPage = class(TWebPage)
    1313    procedure DataModuleProduce(HandlerData: THTTPHandlerData);
    14   private
    15     { private declarations }
    1614  public
    1715    ModuleUser: TModuleUser;
     
    3432begin
    3533  with TWebSession(HandlerData) do begin
     34    if Request.Path.Count > 1 then begin
     35      PageNotFound;
     36      Exit;
     37    end;
     38
    3639    ModuleUser.LoadUserInfo;
    3740    with HtmlDocument.Body, SubItems.AddString do begin
  • trunk/Modules/ZdechovNET/ULinksPage.pas

    r138 r139  
    1212  TLinksPage = class(TWebPage)
    1313    procedure DataModuleProduce(HandlerData: THTTPHandlerData);
    14   private
    15     { private declarations }
    1614  public
    1715    ModuleUser: TModuleUser;
     
    3432begin
    3533  with TWebSession(HandlerData), HtmlDocument.Body, SubItems.AddString do begin
     34    if Request.Path.Count > 1 then begin
     35      PageNotFound;
     36      Exit;
     37    end;
     38
    3639    ModuleUser.LoadUserInfo;
    3740    Text := '<strong>Odkazy související s obcí:</strong><br/>' +
  • trunk/Modules/ZdechovNET/UNetworkPage.pas

    r138 r139  
    1212  TNetworkPage = class(TWebPage)
    1313    procedure DataModuleProduce(HandlerData: THTTPHandlerData);
    14   private
    15     { private declarations }
    1614  public
    1715    ModuleUser: TModuleUser;
     
    3634begin
    3735  with TWebSession(HandlerData) do begin
     36    if Request.Path.Count > 1 then begin
     37      PageNotFound;
     38      Exit;
     39    end;
     40
    3841    ModuleUser.LoadUserInfo;
    3942    with HtmlDocument.Body, SubItems.AddString do begin
  • trunk/Modules/ZdechovNET/UPlansPage.pas

    r138 r139  
    1313  TPlansPage = class(TWebPage)
    1414    procedure DataModuleProduce(HandlerData: THTTPHandlerData);
    15   private
    16     { private declarations }
    1715  public
    1816    ModuleUser: TModuleUser;
     
    3836begin
    3937  with TWebSession(HandlerData) do begin
     38    if Request.Path.Count > 1 then begin
     39      PageNotFound;
     40      Exit;
     41    end;
     42
    4043    ModuleUser.LoadUserInfo;
    4144    with HtmlDocument.Body, SubItems.AddString do begin
  • trunk/Modules/ZdechovNET/UProjectsPage.pas

    r138 r139  
    1313  TProjectsPage = class(TWebPage)
    1414    procedure DataModuleProduce(HandlerData: THTTPHandlerData);
    15   private
    16     { private declarations }
    1715  public
    1816    ModuleUser: TModuleUser;
     
    3836begin
    3937  with TWebSession(HandlerData) do begin
     38    if Request.Path.Count > 1 then begin
     39      PageNotFound;
     40      Exit;
     41    end;
     42
    4043    ModuleUser.LoadUserInfo;
    4144    with HtmlDocument.Body, SubItems.AddString do begin
  • trunk/Modules/ZdechovNET/URobotsPage.pas

    r138 r139  
    3636begin
    3737  with TWebSession(HandlerData) do begin
     38    if Request.Path.Count > 1 then begin
     39      PageNotFound;
     40      Exit;
     41    end;
     42
    3843    ModuleUser.LoadUserInfo;
    3944    with HtmlDocument.Body, SubItems.AddString do begin
  • trunk/Modules/ZdechovNET/UVoIPPage.pas

    r138 r139  
    1212  TVoIPPage = class(TWebPage)
    1313    procedure DataModuleProduce(HandlerData: THTTPHandlerData);
    14   private
    15     { private declarations }
    1614  public
    1715    ModuleUser: TModuleUser;
     
    3432begin
    3533  with TWebSession(HandlerData) do begin
     34    if Request.Path.Count > 1 then begin
     35      PageNotFound;
     36      Exit;
     37    end;
     38
    3639    ModuleUser.LoadUserInfo;
    3740    with HtmlDocument.Body, SubItems.AddString do begin
  • trunk/Modules/ZdechovNET/UWebCamPage.pas

    r138 r139  
    5353      CameraId := -1;
    5454      NotFound := False;
    55       if Request.Path.Count >= 2 then begin
     55      if Request.Path.Count = 2 then begin
    5656        SubPageName := Request.Path[1];
    5757        if TryStrToInt(SubPageName, Value) then
    5858          CameraId := Value else
    5959          NotFound := True;
    60       end;
    61       if not NotFound then begin
    62     //for I := 0 to HandlerData.Request.Query.Count - 1 do
    63       //Text := Text + HandlerData.Request.Query[I] + ' ';
    64 
    65       //HandlerData.Request.Query.Values['W'] := 'dsd';
    66       //HandlerData.Request.Query.Values['H'] := 'dsd';
     60      end else
     61      if Request.Path.Count > 2 then NotFound := True;
     62      if NotFound then begin
     63        PageNotFound;
     64        Exit;
     65      end;
     66
    6767      if HandlerData.Request.Query.TryGetValue('W', WidthValue) then
    6868        ImageWidth := StrToInt(WidthValue)
     
    9191
    9292      Text := Text + '<br/><strong>Kamery v okolí:</strong><br />' +
    93         '<a href="http://www.mestovsetin.cz/vismo/dokumenty2.asp?id_org=18676&amp;id=480245">Vsetínské kamery</a><br />' +
     93        '<a href="https://www.mestovsetin.cz/webove%2Dkamery/d-480245">Vsetínské kamery</a><br />' +
    9494        '<a href="https://www.huslenky.cz/webkamery%2Dhuslenky/ds-1119/archiv=0&amp;p1=1020">Kamery v Huslenkách</a><br/>' +
    95         '<a href="http://kamery.hovnet.cz/">Kamery v Hovnetu</a><br/>' +
     95        '<a href="https://kamery.hovnet.cz/">Kamery v Hovnetu</a><br/>' +
    9696        '</td><td style="width: 80%" valign="top">';
    9797
     
    101101        Text := Text + GetSingle(HandlerData, CameraId);
    102102      end;
    103 
    104103      Text := Text + '</td></tr></table>';
    105       end else Text := 'Stránka nenalezena.';
    106104    end;
    107105    GeneratePage(Self);
Note: See TracChangeset for help on using the changeset viewer.