#header-parser #no-std #header

no-std rfc7239

Parser for rfc7239 formatted Forwarded headers

4 releases

0.1.3 Dec 12, 2024
0.1.2 Nov 28, 2024
0.1.1 Apr 3, 2024
0.1.0 Jan 5, 2021

#355 in HTTP server

Download history 17430/week @ 2024-12-05 12512/week @ 2024-12-12 9638/week @ 2024-12-19 6811/week @ 2024-12-26 6906/week @ 2025-01-02 16131/week @ 2025-01-09 16690/week @ 2025-01-16 16075/week @ 2025-01-23 15245/week @ 2025-01-30 20124/week @ 2025-02-06 17424/week @ 2025-02-13 21826/week @ 2025-02-20 20667/week @ 2025-02-27 20397/week @ 2025-03-06 20307/week @ 2025-03-13 20955/week @ 2025-03-20

85,780 downloads per month
Used in 205 crates (5 directly)

MIT/Apache

16KB
388 lines

rfc7239

Parser for rfc7239 formatted Forwarded headers.

Usage

use rfc7239::parse;

// get the header value from your favorite http server library
let header_value = "for=192.0.2.60;proto=http;by=203.0.113.43,for=192.168.10.10";

for node_result in parse(header_value) {
    let node = node_result?;
    if let Some(forwarded_for) = node.forwarded_for {
        println!("Forwarded by {}", forwarded_for)
    }
}

no_std

This crate can be used in a no_std environment by disabling the default std feature.

The only impact disabling this feature has is using core::error::Error and core::net::IpAddr instead of the std variants and increasing the msrv to 1.81.


lib.rs:

Parser for rfc7239 formatted Forwarded headers.

Usage

use rfc7239::parse;

// get the header value from your favorite http server library
let header_value = "for=192.0.2.60;proto=http;by=203.0.113.43,for=192.168.10.10";

for node_result in parse(header_value) {
    let node = node_result?;
    if let Some(forwarded_for) = node.forwarded_for {
        println!("Forwarded by {}", forwarded_for)
    }
}

Dependencies

~31KB