Skip to content

Commit d3f4479

Browse files
Merge pull request #13 from HashLoad/fix-bypass-root-route-in-lazarus
(fix) bypass root route in lazarus
2 parents 8d27b53 + 85dc014 commit d3f4479

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Horse.BasicAuthentication.pas

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@ procedure Middleware(Req: THorseRequest; Res: THorseResponse; Next: {$IF DEFINED
7878
LBase64String: string;
7979
LBasicAuthenticationDecode: TStringList;
8080
LIsAuthenticated: Boolean;
81+
LPathInfo: string;
8182
begin
82-
if MatchText(Req.RawWebRequest.PathInfo, Config.SkipRoutes) then
83+
LPathInfo := Req.RawWebRequest.PathInfo;
84+
if LPathInfo = EmptyStr then
85+
LPathInfo := '/';
86+
if MatchText(LPathInfo, Config.SkipRoutes) then
8387
begin
8488
Next();
8589
Exit;
@@ -186,4 +190,4 @@ function THorseBasicAuthenticationConfig.SkipRoutes: TArray<string>;
186190
Result := FSkipRoutes;
187191
end;
188192

189-
end.
193+
end.

0 commit comments

Comments
 (0)