Skip to content

stdlib/http_clientView source ↗

http_client

14 items · generated by scribe fromstdlib/http_client.fd· synced 2026-11-15

stdlib/http_client14 items

Contents

HttpResponse

A parsed HTTP response. status 0 = transport failure. header_names/header_vals are parallel vecs (original case).

pub struct HttpResponse {

Fields:

NameType
statusi64
reasonstr
header_namesVec<str>
header_valsVec<str>
bodystr

Defined at line 24


http_resp_header

Header value (case-insensitive name); "" when absent.

pub fn http_resp_header(r: HttpResponse, name: str) -> str {

Parameters:

  • r: HttpResponse
  • name: str

Returns: str

Defined at line 39


http_request

Issue an HTTP request. host may be a hostname (resolved via dns_lookup) or dotted IP. extra_headers may be "" or complete “K: v\r\nK2: v2\r\n” strings. body may be "". Returns HttpResponse with status 0 on transport failure.

pub fn http_request(method: str, host: str, port: i64, path: str, extra_headers: str, body: str) -> HttpResponse {

Parameters:

  • method: str
  • host: str
  • port: i64
  • path: str
  • extra_headers: str
  • body: str

Returns: HttpResponse

Defined at line 181


http_get

GET request; returns HttpResponse.

pub fn http_get(host: str, port: i64, path: str) -> HttpResponse {

Parameters:

  • host: str
  • port: i64
  • path: str

Returns: HttpResponse

Defined at line 221


http_post

POST with body; content_type may be "" to omit the header.

pub fn http_post(host: str, port: i64, path: str, content_type: str, body: str) -> HttpResponse {

Parameters:

  • host: str
  • port: i64
  • path: str
  • content_type: str
  • body: str

Returns: HttpResponse

Defined at line 226


http_head

HEAD request (headers only).

pub fn http_head(host: str, port: i64, path: str) -> HttpResponse {

Parameters:

  • host: str
  • port: i64
  • path: str

Returns: HttpResponse

Defined at line 235


http_get_url

GET a full http:// URL (https:// returns status 0 — no TLS).

pub fn http_get_url(u: str) -> HttpResponse {

Parameters:

  • u: str

Returns: HttpResponse

Defined at line 242


http_put_url

PUT a full http:// URL with a raw (possibly binary) body.

pub fn http_put_url(u: str, body: str) -> HttpResponse {

Parameters:

  • u: str
  • body: str

Returns: HttpResponse

Defined at line 263


http_post_url

POST a full http:// URL.

pub fn http_post_url(u: str, content_type: str, body: str) -> HttpResponse {

Parameters:

  • u: str
  • content_type: str
  • body: str

Returns: HttpResponse

Defined at line 284


http_body_type

Guess the body’s type from Content-Type or the path extension.

pub fn http_body_type(r: HttpResponse, path: str) -> str {

Parameters:

  • r: HttpResponse
  • path: str

Returns: str

Defined at line 306


Generated by scribe, the Fides documentation generator