const preface
XuAPI
pub const preface = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"用途
公开常量 `preface`。 值为 `"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"`
参数
无
API
#net/http2标准库包 `#net/http2`。
const prefacepub const preface = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"公开常量 `preface`。 值为 `"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"`
无
struct Framepub struct Frame {
pub typ int
pub flags int
pub stream_id int
pub payload string
}公开结构体 `Frame`。
typ intflags intstream_id intpayload stringstruct Decodedpub struct Decoded {
pub f Frame
pub need int
}公开结构体 `Decoded`。
f Frameneed intstruct Responsepub struct Response {
pub status int
pub body string
pub ok bool
pub err string
}公开结构体 `Response`。
status intbody stringok boolerr stringencode_framepub fn encode_frame(typ int, flags int, sid int, payload string) string编码。
typ intflags intsid intpayload stringstring — 结果字符串
decode_framepub fn decode_frame(buf string) Decoded解码。
buf stringDecoded — 该类型的值
encode_get_headerspub fn encode_get_headers(authority string, path string) string编码。
authority stringpath stringstring — 结果字符串
encode_post_headerspub fn encode_post_headers(authority string, path string, content_type string, authorization string) string编码。
authority stringpath stringcontent_type stringauthorization stringstring — 结果字符串
parse_statuspub fn parse_status(blk string) int解析为 status。
blk stringint — 该类型的值
struct TcpClientpub struct TcpClient {
}公开结构体 `TcpClient`。
无
dial_tcppub fn dial_tcp(addr string) TcpClient拨 TCP。失败时 throw。
addr stringTcpClient — 该类型的值
(&mut TcpClient) getpub fn (t &mut TcpClient) get(authority string, path string) Response在 `&mut TcpClient` 上调用 `get`。
t &mut TcpClientauthority stringpath stringResponse — 该类型的值
(&mut TcpClient) closepub fn (t &mut TcpClient) close()`&mut TcpClient` 上的方法:关闭资源。
t &mut TcpClientstruct TlsClientpub struct TlsClient {
}公开结构体 `TlsClient`。
无
dial_tlspub fn dial_tls(addr string, server_name string) TlsClient拨号TLS。失败时 throw。
addr stringserver_name stringTlsClient — 该类型的值
(&mut TlsClient) getpub fn (t &mut TlsClient) get(authority string, path string) Response在 `&mut TlsClient` 上调用 `get`。
t &mut TlsClientauthority stringpath stringResponse — 该类型的值
(&mut TlsClient) postpub fn (t &mut TlsClient) post(authority string, path string, content_type string, authorization string, body string) Response在 `&mut TlsClient` 上调用 `post`。
t &mut TlsClientauthority stringpath stringcontent_type stringauthorization stringbody stringResponse — 该类型的值
(&mut TlsClient) closepub fn (t &mut TlsClient) close()`&mut TlsClient` 上的方法:关闭资源。
t &mut TlsClient