15 releases

0.1.1129 Nov 15, 2024
0.1.1128 Nov 15, 2024
0.1.1127 Oct 21, 2024

#1513 in Network programming

Download history 517/week @ 2024-10-05 111/week @ 2024-10-12 282/week @ 2024-10-19 43/week @ 2024-10-26 21/week @ 2024-11-02 168/week @ 2024-11-09 137/week @ 2024-11-16 51/week @ 2024-11-23 24/week @ 2024-11-30

383 downloads per month
Used in 7 crates (6 directly)

MIT license

7KB
91 lines

HTTP-SCRAPE

License Crates.io

A brief description of your crate, explaining what it does and its main features.

Table of Contents

Features

  • HTTP/2 & HTTP/3 Support: Extending the parser for modern HTTP protocols.
  • Asynchronous Parsing | Syncronous Parsing: Non-blocking parsing for better performance.
  • Header Parsing: Extract individual headers for enhanced request handling

Installation

To include this crate in your project, add the following line to your Cargo.toml:

[dependencies]
http-scrape = "0.1.1127"
use http_parser::Response;

fn main() {
    let response = Response::new("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\nHello World");

    // Parse the HTTP method
    let method = response.method();
    println!("Method: {}", method); // Output: GET | POST | DELETE | PUT | OPTIONS

    // Extract the path
    let path = response.path();
    println!("Path: {}", path); // Output: The requested URL path

    // Get cookies (if any)
    let cookie = response.cookie();
    println!("Cookie: {:?}", cookie); // Output: Cookies if available

    // Retrieve content from the HTTP body
    let content = response.content();
    println!("Content: {}", content); // Output: HTTP body content
}

No runtime deps