本文作者:icy

我的http状态 - Delphi 定义单元[http.status]

icy 2022-01-11 1191 抢沙发
我的http状态 - Delphi 定义单元[http.status]摘要: 今天自己用Delphi 再次写一个 自己家几台设备传输数据处理的小服务本领想用管用的开写 忽然又想到了 delphi 好吧来吧用的是 Delphi包的libsagui.so皮 哈...

今天自己用Delphi 再次写一个 自己家几台设备传输数据处理的小服务

本领想用管用的开写 忽然又想到了 delphi 好吧来吧

用的是 Delphi包的libsagui.so皮 哈 想起来以前定义过一个http状态的单元 

留在在这记忆一下咯

unit Zelig.HttpStatus;

(*
    http 返回状态 delphi 定义
    2019.10.3
    icy
*)

interface
   uses
   System.SysUtils,
   System.Classes;
{------------------------------------------------------------------------------}
type THTTP_STATUS = record
private
const
  Status:  array[0..39] of Integer = (
  100,101,
  200,201,202,203,204,205,206,
  300,301,302,303,304,305,306,307,
  400,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,
  500,501,502,503,504,505
  );
  function  GetStatus(Index: Integer): Integer;
public
  //100 up 信息
  property _CONTINUE: Integer index 0 read GetStatus; //继续
  property SWITCHING: Integer index 1 read GetStatus; //交换协议

  //200 up 成功
  property OK: Integer index 2 read GetStatus; //OK
  property CREATED: Integer index 3 read GetStatus; //创建
  property ACCEPTED: Integer index 4 read GetStatus;  //已接受
  property NON_AUTHORITATIVE: Integer index 5 read GetStatus; //非权威信息
  property NO_CONTENT: Integer index 6 read GetStatus; //没有内容
  property RESET_CONTENT: Integer index 7 read GetStatus;  //重置内容
  property PARTIAL_CONTENT: Integer index 8 read GetStatus;  //部分内容

  //300 up  重定向
  property MULTIPLE: Integer index 9 read GetStatus; //多种选择
  property MOVED: Integer index 10 read GetStatus; //永久移动
  property FOUND: Integer index 11 read GetStatus; //找到
  property SEE_OTHER: Integer index 12 read GetStatus; //参见其他
  property NOT_MODIFIED: Integer index 13 read GetStatus;  //未修改
  property USE_PROXY: Integer index 14 read GetStatus;  //使用代理
  property UNUSED: Integer index 15 read GetStatus; //未使用
  property TEMPORARY_REDIRECT: Integer index 16 read GetStatus; //暂时重定向

  // 400 up 客户端错误
  property BAD_BADREQUEST: Integer index 17 read GetStatus; //错误的请求
  property UNAUTHORIZED: Integer index 18 read GetStatus; //未经授权
  property PAYMENT: Integer index 19 read GetStatus;  //付费请求
  property FORBIDDEN: Integer index 20 read GetStatus; //禁止
  property NOT_FOUND: Integer index 21 read GetStatus; //没有找到
  property METHOD_NOT_ALLOWED: Integer index 22 read GetStatus;//方法不允许
  property NOT_ACCEPTABLE: Integer index 23 read GetStatus; //不可接受
  property PROXY_AUTHENTICATION_REQUIRED: Integer index 24 read GetStatus; //需要代理身份验证
  property REQUEST_TIMEOUT: Integer index 25 read GetStatus; //请求超时
  property CONFLICT: Integer index 26 read GetStatus; //指令冲突
  property GONE: Integer index 27 read GetStatus;  //文档永久地离开了指定的位置
  property LENGTH_REQUIRED: Integer index 28 read GetStatus; //需要Content-Length头请求
  property PRECONDITION_FAILED: Integer index 29 read GetStatus; //前提条件失败
  property REQUEST_ENTITY_TOO_LARGE: Integer index 30 read GetStatus; //请求实体太大
  property REQUEST_URI_TOO_LONG: Integer index 31 read GetStatus; //请求URI太长
  property UNSUPPORTED_MEDIA_TYPE: Integer index 32 read GetStatus; //不支持的媒体类型
  property REQUESTED_RANGE_NOT_SATISFIABLE: Integer index 33 read GetStatus; //请求的范围不可满足
  property EXPECTATION_FAILED: Integer index 34 read GetStatus;  //期望失败

  // 500 UP  服务器错误
  property INTERNAL_SERVER_ERROR: Integer index 35 read GetStatus;  //内部服务器错误
  property NOT_IMPLEMENTED: Integer index 36 read GetStatus; //未实现
  property BAD_GATEWAY: Integer index 37 read GetStatus; //错误的网关
  property SERVICE_UNAVAILABLE: Integer index 38 read GetStatus;//服务不可用
  property GATEWAY_TIMEOUT: Integer index 39 read GetStatus; //网关超时
  property HTTP_VERSION_NOT_SUPPORTED: Integer index 40 read GetStatus; //HTTP版本不支持
end;

function HTTP_STATUS:THTTP_STATUS;

implementation

function THTTP_STATUS.GetStatus(Index: Integer): Integer;
begin
  Result:= Status[Index];
end;

function HTTP_STATUS:THTTP_STATUS;
begin
;
end;
end.


觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

分享

发表评论

快捷回复:

评论列表 (暂无评论,1191人围观)参与讨论

还没有评论,来说两句吧...