Skip to content

Using the library to parse HTTP requests/responses from raw network packet data (not from live HTTP connections). #2194

@nitanmarcel

Description

@nitanmarcel

Hi! I'm building a network packet analyzer and want to use httplib's internal parsing functions to parse HTTP messages from raw packet data. While the library is usually done to work as an http client/server, it does have some powerful internals, but the issue is that those are undocumented and I usually get confused when trying to read the code.

I would be grateful if you could help me with guidance to the correct internal methods I can use.

My usecase is:

I receive HTTP data as fragments/chunks from network packets
I need to accumulate these chunks and parse complete HTTP requests/responses
I want to detect when a message is complete (especially chunked responses)

// I have raw HTTP data in a buffer
std::string httpData = "HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n...";

// I want to parse it like httplib::Client::Get() does internally
// And know when the response is complete

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions