2 releases

0.1.1 Apr 3, 2024
0.1.0 Jan 5, 2021

#200 in Network programming

Download history 15603/week @ 2024-07-29 15654/week @ 2024-08-05 17358/week @ 2024-08-12 18416/week @ 2024-08-19 16281/week @ 2024-08-26 17032/week @ 2024-09-02 16536/week @ 2024-09-09 14032/week @ 2024-09-16 16390/week @ 2024-09-23 17499/week @ 2024-09-30 20119/week @ 2024-10-07 18482/week @ 2024-10-14 19512/week @ 2024-10-21 20840/week @ 2024-10-28 19499/week @ 2024-11-04 17782/week @ 2024-11-11

78,238 downloads per month
Used in 187 crates (4 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