mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 23:19:24 +02:00
* Some changes suggested by Edgar Fernando
This commit is contained in:
parent
644ffa8e7a
commit
652f54fe31
@ -318,7 +318,6 @@ begin
|
||||
Result:=D+Copy(AFileName,Length(localBaseURL)+1,MaxInt)
|
||||
else
|
||||
Result:=D+AFileName;
|
||||
DoDirSeparators(Result);
|
||||
Result:=ExpandFileName(Result);
|
||||
end;
|
||||
end;
|
||||
|
@ -510,6 +510,7 @@ type
|
||||
constructor Create; override;
|
||||
destructor destroy; override;
|
||||
Function GetNextPathInfo : String;
|
||||
Function ToString: ansistring; override;
|
||||
Property RequestID : String Read FRequestID;
|
||||
Property RouteParams[AParam : String] : String Read GetRP Write SetRP;
|
||||
Property ReturnedPathInfo : String Read FReturnedPathInfo Write FReturnedPathInfo;
|
||||
@ -565,6 +566,7 @@ type
|
||||
Procedure SendHeaders;
|
||||
Procedure SendResponse; // Delphi compatibility
|
||||
Procedure SendRedirect(const TargetURL:String);
|
||||
Function ToString: ansistring; override;
|
||||
// Set Code and CodeText. Send content if aSend=True
|
||||
Procedure SetStatus(aStatus : Cardinal; aSend : Boolean = False);
|
||||
Property Request : TRequest Read FRequest;
|
||||
@ -1297,12 +1299,12 @@ end;
|
||||
|
||||
function THTTPHeader.GetContentLength: Integer;
|
||||
begin
|
||||
Result:=StrToIntDef(GetFieldValue(9),0);
|
||||
Result:=StrToIntDef(GetHeader(hhContentLength),0);
|
||||
end;
|
||||
|
||||
procedure THTTPHeader.SetContentLength(Value: Integer);
|
||||
begin
|
||||
SetFieldValue(9,IntToStr(Value));
|
||||
SetHeader(hhContentLength,IntToStr(Value));
|
||||
end;
|
||||
|
||||
|
||||
@ -1351,7 +1353,7 @@ end;
|
||||
|
||||
function THTTPHeader.GetServerPort: Word;
|
||||
begin
|
||||
Result:=StrToIntDef(GetFieldValue(30),0);
|
||||
Result:=StrToIntDef(GetHTTPVariable(hvServerPort),0);
|
||||
end;
|
||||
|
||||
procedure THTTPHeader.SetHTTPVariable(AIndex: Integer; AValue: String);
|
||||
@ -1373,7 +1375,7 @@ end;
|
||||
procedure THTTPHeader.SetServerPort(AValue: Word);
|
||||
|
||||
begin
|
||||
SetFieldValue(30,IntToStr(AValue));
|
||||
SetHTTPVariable(hvServerPort,IntToStr(AValue));
|
||||
end;
|
||||
|
||||
function THTTPHeader.GetSetFieldValue(Index: Integer): String;
|
||||
@ -2156,6 +2158,11 @@ begin
|
||||
{$ifdef CGIDEBUG}SendDebug(Format('Pathinfo: "%s" "%s" : %s',[P,FReturnedPathInfo,Result]));{$ENDIF}
|
||||
end;
|
||||
|
||||
function TRequest.ToString: ansistring;
|
||||
begin
|
||||
Result:='['+RequestID+'] : '+URL;
|
||||
end;
|
||||
|
||||
procedure TRequest.ParseFirstHeaderLine(const line: String);
|
||||
var
|
||||
i: Integer;
|
||||
@ -2875,6 +2882,15 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TResponse.ToString: ansistring;
|
||||
begin
|
||||
if assigned(Request) then
|
||||
Result:=Request.ToString
|
||||
else
|
||||
Result:='Unknown request';
|
||||
Result:=Result+': '+IntToStr(Code)+' '+CodeText;
|
||||
end;
|
||||
|
||||
procedure TResponse.SetStatus(aStatus: Cardinal; aSend: Boolean = False);
|
||||
begin
|
||||
Code:=aStatus;
|
||||
|
Loading…
Reference in New Issue
Block a user