# Object - TWebRequest Web 请求 ## `TWebRequest` 声明:class TWebRequest 内置对象 ### `create()` 声明:function 创建 TWebRequest 实例 可见性:public ### `extractContentFields(strings)` 声明:function 将post的内容展开到列表里 可见性:public | 参数 | 类型 | 说明 | | --- | --- | --- | | `strings` | TStringList | TStrings类型,用来存贮展开的内容,假定发送的内容是以&分割的 | 返回:any ### `extractCookieFields(strings)` 声明:function 将Cookie的内容展开到列表里 可见性:public | 参数 | 类型 | 说明 | | --- | --- | --- | | `strings` | TStringList | TStrings类型,用来存贮展开的内容,假定Cookie的内容是以;分割的 | 返回:any ### `extractQueryFields(strings)` 声明:function 将Query的内容展开到列表里 可见性:public | 参数 | 类型 | 说明 | | --- | --- | --- | | `strings` | TStringList | TStrings类型,用来存贮展开的内容,假定Query的内容是以&分割的 | 返回:any ### `getFieldByName(name)` 声明:function 取Header的值 可见性:public | 参数 | 类型 | 说明 | | --- | --- | --- | | `name` | string | 要取的内容的名字 | 返回:string ### `readClient(buffer, count)` 声明:function 读取客户端发送的数据 可见性:public | 参数 | 类型 | 说明 | | --- | --- | --- | | `buffer` | string/binary | 字符串或者二进制流,用来存贮读出的内容 | | `count` | integer | 整数类型,读取的长度,不可超过Buffer的长度 | 返回:integer ### `readString(count)` 声明:function 读取客户端发送的数据 可见性:public | 参数 | 类型 | 说明 | | --- | --- | --- | | `count` | integer | 整数类型,读取的长度 | 返回:string ### `translateURI(uri)` 声明:function 将一个URI转换成服务器上可用的路径格式 可见性:public | 参数 | 类型 | 说明 | | --- | --- | --- | | `uri` | string | 要转换的串 | 返回:string ### `writeClient(buffer, count)` 声明:function 向客户端发送的数据 可见性:public | 参数 | 类型 | 说明 | | --- | --- | --- | | `buffer` | string/binary | 字符串或者二进制流,要发送的内容 | | `count` | integer | 整数类型,写入的长度,不可超过Buffer的长度 | 返回:integer ### `writeHeaders(status_code, reson_string, headers)` 声明:function 向客户端发送头部 可见性:public | 参数 | 类型 | 说明 | | --- | --- | --- | | `status_code` | integer | 整数类型,状态码,如200为正确。 ReasonString:字符串类型,理由串,例如返回了一个错误,需要有个显示的理由 | | `reson_string` | any | reson_string | | `headers` | string | 字符串类型,头部信息串 | 返回:boolean ### `writeString(s)` 声明:function 向客户端发送的数据 可见性:public | 参数 | 类型 | 说明 | | --- | --- | --- | | `s` | string/binary | 字符串,要发送的内容 | 返回:boolean ### `Accept` 声明:property 客户端接收的内容,为空表示什么都接受。例如audio/*表示接收音频数据 可见性:public 类型:string 访问:read ### `Authorization` 声明:property 头部的认证信息 可见性:public 类型:string 访问:read ### `CacheControl` 声明:property 头部的Cache-Control信息,表明缓存策略,可为no-cache, no-store, max-ages=seconds, max-stale=seconds, min-refresh=seconds 可见性:public 类型:string 访问:read ### `Connection` 声明:property 头部的Connection信息,如果为close则会当完成请求时关闭链接 可见性:public 类型:string 访问:read ### `Content` 声明:property POST的非解析内容,解析内容可在ContentFields中得到。如果内容特别大,Content不会包括所有的内容,剩余的内容需要用ReadClient来读取 可见性:public 类型:string 访问:read ### `ContentEncoding` 声明:property 传输编码,例如GZIP 可见性:public 类型:string 访问:read ### `ContentFields` 声明:property 解析后的Post的Content内容,将Post的内容用Name=Value的方式分割存贮 可见性:public 类型:TStringList 访问:read ### `ContentLength` 声明:property 发送的数据的长度 可见性:public 类型:integer 访问:read ### `ContentType` 声明:property 发送的数据的类型 可见性:public 类型:string 访问:read ### `ContentVersion` 声明:property 发送的数据的版本 可见性:public 类型:string 访问:read ### `Cookie` 声明:property 发送的数据中的Cookie串 可见性:public 类型:string 访问:read ### `CookieFields` 声明:property 发送的数据中的Cookie串解析后按照Name=Value的模式存贮 可见性:public 类型:TStringList 访问:read ### `Date` 声明:property 浏览器客户端时的本地时间 可见性:public 类型:datetime 访问:read ### `DerivedFrom` 声明:property 内容的原始请求URL,仅当发送的内容不是原始WEB客户端发起时有意义 可见性:public 类型:string 访问:read ### `Expires` 声明:property 决定一个请求是否过期 可见性:public 类型:datetime 访问:read ### `From` 声明:property 客户端的email地址 可见性:public 类型:string 访问:read ### `Host` 声明:property 请求的URL中的主机名 可见性:public 类型:string 访问:read ### `IfModifiedSince` 声明:property 服务器可决定返回一个没有更新的错误(客户端可用原来的存贮的版本) 可见性:public 类型:datetime 访问:read ### `InternalPathInfo` 声明:property URL的路径部分 可见性:public 类型:string 访问:read ### `InternalScriptName` 声明:property URL的脚本部分 可见性:public 类型:string 访问:read ### `Method` 声明:property 只读类型,客户端请求的方法。方法种类有如下: OPTION:返回请求者和相应者之间可以使用的通信选项,主要用来检测服务器处理能力; GET:获得以URL标示的文件内容或者程序执行结果。服务器根据文件名后缀判断服务内容,比如该URL是静态文本还是一个程序; HEAD:除了不返回响应的信息本体以外,得到的是跟GET一样的信息。一般用来测试链接的有效性、可达性和近期修改; POST:把消息本体中的消息发送到一个URL或者其他类似的服务器端定义行为。通常用来提交一个HTML表单或者一些数据操作活动; PUT:把消息本体中的消息发送到一个URL,跟POST类似,但不常用; DELETE:删除URL指定的资源; TRACE:调用一个远程应用层请求消息回路。发出这个消息的用户终端除了收到原来的消息内容以外,还得到消息在Internet上的传送路径 可见性:public 类型:string 访问:read/write ### `MethodType` 声明:property 客户端请求的方法。0:未指定,1:GET, 2:PUT,3:POST,4:HEAD 可见性:public 类型:integer 访问:read ### `PathInfo` 声明:property 客户端请求的URL的路径信息 可见性:public 类型:string 访问:read ### `PathTranslated` 声明:property 请求的脚本在服务器上对应的真实路径 可见性:public 类型:string 访问:read ### `ProtocolVersion` 声明:property 请求的HTTP协议版本,如1.0或者1.1 可见性:public 类型:string 访问:read ### `Query` 声明:property 请求的查询参数部分 可见性:public 类型:string 访问:read ### `QueryFields` 声明:property 请求的查询参数部分以Name=Value模式的TStrings存贮 可见性:public 类型:TStringList 访问:read ### `Referer` 声明:property 请求的来源地址(发起请求的源地址) 可见性:public 类型:string 访问:read ### `RemoteAddr` 声明:property 客户端的IP地址 可见性:public 类型:string 访问:read ### `RemoteHost` 声明:property 客户端的主机名称 可见性:public 类型:string 访问:read ### `ScriptName` 声明:property 请求路径和脚本名的部分,不包括主机和参数部分 可见性:public 类型:string 访问:read ### `ServerPort` 声明:property 与服务器连接到的端口 可见性:public 类型:integer 访问:read ### `Title` 声明:property 客户端请求的Title域 可见性:public 类型:string 访问:read ### `Url` 声明:property 客户端请求的完整路径 可见性:public 类型:string 访问:read ### `UserAgent` 声明:property 客户端的标识,例如浏览器名和版本号等 可见性:public 类型:string 访问:read