#http-request #target #request #http #http-header #header

uhttp_request_target

Parser for classifying HTTP request target

2 unstable releases

Uses old Rust 2015

0.6.0 Feb 26, 2017
0.5.0 Jan 29, 2017

#93 in #http-header

37 downloads per month
Used in uhttp_json_api

MIT license

6KB
61 lines

uhttp_request_target -- HTTP request target parser

Documentation

This crate provides a parser for classifying an HTTP request line target into one of the 4 types defined for requests. This can then be used to direct how to further process the target.

Examples

use uhttp_request_target::RequestTarget;

assert_eq!("/r/rust".parse(), Ok(RequestTarget::AbsPath));
assert_eq!("https://example.com".parse(), Ok(RequestTarget::AbsURI));
assert_eq!("example.com".parse(), Ok(RequestTarget::Authority));
assert_eq!("*".parse(), Ok(RequestTarget::ServerOptions));

Usage

This crate can be used through cargo by adding it as a dependency in Cargo.toml:

[dependencies]
uhttp_request_target = "0.6.0"

and importing it in the crate root:

extern crate uhttp_request_target;

lib.rs:

This crate provides a parser for classifying an HTTP request line target into one of the 4 types defined for requests. This can then be used to direct how to further process the target.

Examples

use uhttp_request_target::RequestTarget;

assert_eq!("/r/rust".parse(), Ok(RequestTarget::AbsPath));
assert_eq!("https://example.com".parse(), Ok(RequestTarget::AbsUri));
assert_eq!("example.com".parse(), Ok(RequestTarget::Authority));
assert_eq!("*".parse(), Ok(RequestTarget::ServerOptions));

No runtime deps