2 releases

0.1.1 Apr 3, 2024
0.1.0 Jan 5, 2021

#217 in Network programming

Download history 11636/week @ 2024-03-14 11155/week @ 2024-03-21 11450/week @ 2024-03-28 9207/week @ 2024-04-04 9516/week @ 2024-04-11 10697/week @ 2024-04-18 11085/week @ 2024-04-25 11450/week @ 2024-05-02 14022/week @ 2024-05-09 12108/week @ 2024-05-16 11799/week @ 2024-05-23 12045/week @ 2024-05-30 12649/week @ 2024-06-06 14902/week @ 2024-06-13 16239/week @ 2024-06-20 12434/week @ 2024-06-27

58,729 downloads per month
Used in 165 crates (3 directly)

MIT/Apache

15KB
374 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)
    }
}

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