跳转至

http.frm.connect

Connect 协议客户端(P8-A;unary 调用,protobuf 帧)

协议(Connect RPC unary,应用 proto 形): POST // content-type: application/proto connect-protocol-version: 1 成功 = HTTP 200,体 = 响应 protobuf;非 200 = 传输/应用错(v1:状态码即 错误面;200 + JSON connect-error 帧解析列志向)。帧编解码 = 调用方经 std/pb(本模块纯传输)。 形态纪律:仅依赖 http.client(单级,发射已证——x_client_e2e 40702d5); HttpResp 直返(client_request 透传,消费方经 rr_* getter 读)。 use 面(P1b):http.client 显式请求。

pub struct

struct HttpNet

Field Type

struct KeepMap

Field Type
var slots List[I32]
var keys List[Str]
var vals List[I64]

struct KeepCell

Field Type
var v I64

struct HttpKeep

Field Type
var cache Box[KeepMap]
var bru Box[KeepCell]

struct HttpSock

Field Type
var fd I64

struct HttpLoc

Field Type
ok I64
host Str
port I64
path Str

struct HttpResp

Field Type
var rc I64
var err I64
var status I64
var ver I64
var keep I64
var nredir I64
var reuses I64
var head_end I64
var body_off I64
var body_len I64
var fd I64

struct Box64

Field Type
var v I64

impl

impl Drop for HttpSock
    fn drop(var self)

pub fn

Signature Returns Description
connect_path(service: Str, method: Str) Str 请求路径:/<service>/<method>
connect_headers() Str 协议头(两行,自含 CRLF)
connect_unary(net: HttpNet, host: Str, port: I64, service: Str, method: Str, var req: [U8], rlen: I64, var resp: [U8], rcap: I64, var scr: [U8], timeout_ms: I64, kp: HttpKeep) HttpResp unary 调用:返回 HttpResp(透传 client_request;消费方 rr_status/rr_body_*
读取,体 = 响应 protobuf 原文)。kp = client keep-alive 多槽缓存态(HttpKeep)
(透传,复用与重连语义随 http.client)。
connect_classify(r: HttpResp) I64 状态分类:0 = 传输 IO 错;1 = HTTP 200(应用成功,proto 体);2 = 非 200
(HTTP 状态即错误面;JSON connect-error 帧解析列志向)
connect_code_str(code: I64) Str connect/gRPC 状态码表(数字 → 规范名;HTTP 状态映射用)
connect_code_from_http(status: I64) I64 HTTP 状态 → connect 码(grpc 映射子集;未表项 = 2 unknown)
http_net() HttpNet —
http_keep_new() HttpKeep —
http_keep_drain(kp: HttpKeep) `` —
client_hash_host(host: Str) I64 —
loc_ok(l: HttpLoc) I64 —
loc_host(l: HttpLoc) Str —
loc_port(l: HttpLoc) I64 —
loc_path(l: HttpLoc) Str —
client_loc_resolve(loc: Str, base_host: Str, base_port: I64) HttpLoc —
rr_rc(r: HttpResp) I64 —
rr_status(r: HttpResp) I64 —
client_request(io: HttpNet, method: Str, host: Str, port: I64, path: Str, extra: Str, var body: [U8], blen: I64, var buf: [U8], cap: I64, var scr: [U8], timeout_ms: I64, kp: HttpKeep) HttpResp —
http_limits_default() HttpLimits —
http_err_line() I64 —
http_err_line_long() I64 —
http_err_version() I64 —
http_err_token() I64 —
http_err_target() I64 —
http_err_hdr() I64 —
http_err_fold() I64 —
http_err_hdr_long() I64 —
http_err_hdr_many() I64 —
http_err_head_long() I64 —
http_err_smuggle() I64 —
http_err_cl() I64 —
http_err_te() I64 —
http_err_bodycap() I64 —
http_parse_head(buf: &[U8], n: I64, lim: HttpLimits) HttpHead —
http_header_at(buf: &[U8], h: HttpHead, idx: I64) HttpSlice —
http_header_find(buf: &[U8], h: HttpHead, name: Str) I64 —
http_header_value(buf: &[U8], h: HttpHead, name: Str) HttpSlice —
http_keep_alive(buf: &[U8], h: HttpHead) I64 —
http_rc(h: HttpHead) I64 —
http_err_of(h: HttpHead) I64 —
http_is_resp(h: HttpHead) I64 —
http_ver(h: HttpHead) I64 —
http_status_of(h: HttpHead) I64 —
http_head_end(h: HttpHead) I64 —
http_nheaders(h: HttpHead) I64 —
http_body_kind(h: HttpHead) I64 —
http_clen(h: HttpHead) I64 —
http_method_len(h: HttpHead) I64 —
http_target_len(h: HttpHead) I64 —
sl_rc(s: HttpSlice) I64 —
sl_vs(s: HttpSlice) I64 —
sl_vl(s: HttpSlice) I64 —
msg_hex(v: I64) Str —
msg_request_line(method: Str, target: Str, ver: I64) Str —
msg_status_line(ver: I64, status: I64, reason: Str) Str —
msg_header(name: Str, value: Str) Str —
msg_head_end() Str —
msg_cl_header(n: I64) Str —
msg_request_head(method: Str, target: Str, host: Str, ver: I64, body_len: I64) Str —
msg_response_head(ver: I64, status: I64, reason: Str, body_len: I64) Str —
msg_chunk_header(size: I64) Str —
msg_last_chunk() Str —
msg_last_chunk_trailer(name: Str, value: Str) Str —
msg_continue() Str —
msg_expect_header() Str —
msg_should_expect(body_len: I64, threshold: I64) I64 —
msg_body_remaining(head_end: I64, clen: I64, fed: I64) I64 —
chunk_st_new() ChunkSt —
cr_rc(r: ChunkRet) I64 —
cr_err(r: ChunkRet) I64 —
cr_consumed(r: ChunkRet) I64 —
cr_produced(r: ChunkRet) I64 —
cr_phase(r: ChunkRet) I64 —
cr_remain(r: ChunkRet) I64 —
chunk_step(src: &[U8], n: I64, pos: I64, st: ChunkSt, dst: &[U8], dfill: I64, dcap: I64) ChunkRet —