Skip to content
CryoCryo home
Stdlibnet::http

headers

import std::net::http::headers; · source

Headers

type struct Headers {
    inner: HashMap<String, String>;

    static new() -> Headers;
    length(&this) -> u64;
    is_empty(&this) -> boolean;
    insert(mut &this, name: Str, value: Str) -> void;
    get(&this, name: Str) -> Option<String>;
    contains(&this, name: Str) -> boolean;
    remove(mut &this, name: Str) -> boolean;
    parse_line(mut &this, line: Str) -> boolean;
    content_length(&this) -> Result<Option<u64>, IoError>;
    encode_into(&this, out: Array<u8>*) -> Result<(), IoError>;
}

A case-insensitive map: names are lower-cased on the way in, so get finds a header however the peer spelled it. get returns an owned copy. encode_into(out) serializes every header as name: value\r\n; parse_line consumes one name: value line, returning false if it is malformed.

content_length() returns Result<Option<u64>, IoError> — absent is Ok(None), malformed is an error.

Trait implementations

implement trait Drop for struct Headers