|
@@ -20,7 +20,7 @@ unit fphttpserver;
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
- Classes, SysUtils, sockets, sslbase, sslsockets, ssockets, resolve, httpdefs;
|
|
|
+ Classes, SysUtils, sockets, sslbase, sslsockets, ssockets, resolve, httpprotocol, httpdefs;
|
|
|
|
|
|
Const
|
|
|
ReadBufLen = 4096;
|
|
@@ -236,7 +236,7 @@ Type
|
|
|
|
|
|
EHTTPServer = Class(EHTTP);
|
|
|
|
|
|
- Function GetStatusCode (ACode: Integer) : String;
|
|
|
+ Function GetStatusCode (ACode: Integer) : String; deprecated 'Use GetHTTPStatusText from unit httpprotocol';
|
|
|
|
|
|
implementation
|
|
|
|
|
@@ -250,62 +250,7 @@ resourcestring
|
|
|
Function GetStatusCode (ACode: Integer) : String;
|
|
|
|
|
|
begin
|
|
|
- Case ACode of
|
|
|
- 100 : Result:='Continue';
|
|
|
- 101 : Result:='Switching Protocols';
|
|
|
- 200 : Result:='OK';
|
|
|
- 201 : Result:='Created';
|
|
|
- 202 : Result:='Accepted';
|
|
|
- 203 : Result:='Non-Authoritative Information';
|
|
|
- 204 : Result:='No Content';
|
|
|
- 205 : Result:='Reset Content';
|
|
|
- 206 : Result:='Partial Content';
|
|
|
- 300 : Result:='Multiple Choices';
|
|
|
- 301 : Result:='Moved Permanently';
|
|
|
- 302 : Result:='Found';
|
|
|
- 303 : Result:='See Other';
|
|
|
- 304 : Result:='Not Modified';
|
|
|
- 305 : Result:='Use Proxy';
|
|
|
- 307 : Result:='Temporary Redirect';
|
|
|
- 400 : Result:='Bad Request';
|
|
|
- 401 : Result:='Unauthorized';
|
|
|
- 402 : Result:='Payment Required';
|
|
|
- 403 : Result:='Forbidden';
|
|
|
- 404 : Result:='Not Found';
|
|
|
- 405 : Result:='Method Not Allowed';
|
|
|
- 406 : Result:='Not Acceptable';
|
|
|
- 407 : Result:='Proxy Authentication Required';
|
|
|
- 408 : Result:='Request Time-out';
|
|
|
- 409 : Result:='Conflict';
|
|
|
- 410 : Result:='Gone';
|
|
|
- 411 : Result:='Length Required';
|
|
|
- 412 : Result:='Precondition Failed';
|
|
|
- 413 : Result:='Request Entity Too Large';
|
|
|
- 414 : Result:='Request-URI Too Large';
|
|
|
- 415 : Result:='Unsupported Media Type';
|
|
|
- 416 : Result:='Requested range not satisfiable';
|
|
|
- 417 : Result:='Expectation Failed';
|
|
|
- 418 : Result:='I''m a teapot';
|
|
|
- 421 : Result:='Misdirected Request';
|
|
|
- 422 : Result:='Unprocessable Entity';
|
|
|
- 423 : Result:='Locked';
|
|
|
- 424 : Result:='Failed Dependency';
|
|
|
- 425 : Result:='Too Early';
|
|
|
- 426 : Result:='Upgrade Required';
|
|
|
- 428 : Result:='Precondition Required';
|
|
|
- 429 : Result:='Too Many Requests';
|
|
|
- 431 : Result:='Request Header Fields Too Large';
|
|
|
- 451 : Result:='Unavailable For Legal Reasons';
|
|
|
-
|
|
|
- 500 : Result:='Internal Server Error';
|
|
|
- 501 : Result:='Not Implemented';
|
|
|
- 502 : Result:='Bad Gateway';
|
|
|
- 503 : Result:='Service Unavailable';
|
|
|
- 504 : Result:='Gateway Time-out';
|
|
|
- 505 : Result:='HTTP Version not supported';
|
|
|
- else
|
|
|
- Result:='Unknown status';
|
|
|
- end;
|
|
|
+ Result := GetHTTPStatusText(ACode);
|
|
|
end;
|
|
|
|
|
|
Function GetHostNameByAddress(const AnAddress: String): String;
|
|
@@ -353,7 +298,7 @@ Var
|
|
|
S : String;
|
|
|
I : Integer;
|
|
|
begin
|
|
|
- S:=Format('HTTP/1.1 %3d %s'#13#10,[Code,GetStatusCode(Code)]);
|
|
|
+ S:=Format('HTTP/1.1 %3d %s'#13#10,[Code,GetHTTPStatusText(Code)]);
|
|
|
For I:=0 to Headers.Count-1 do
|
|
|
S:=S+Headers[i]+#13#10;
|
|
|
// Last line in headers is empty.
|