4 releases

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

#183 in Network programming

Download history 16424/week @ 2024-08-22 16814/week @ 2024-08-29 16867/week @ 2024-09-05 14893/week @ 2024-09-12 14871/week @ 2024-09-19 17895/week @ 2024-09-26 18823/week @ 2024-10-03 18898/week @ 2024-10-10 20130/week @ 2024-10-17 20054/week @ 2024-10-24 18667/week @ 2024-10-31 18676/week @ 2024-11-07 19930/week @ 2024-11-14 20701/week @ 2024-11-21 17360/week @ 2024-11-28 21107/week @ 2024-12-05

83,136 downloads per month
Used in 189 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