Skip to content

Implement HTTP protocol#469

Merged
swlynch99 merged 17 commits into
twitter:masterfrom
swlynch99:just-http
Oct 3, 2022
Merged

Implement HTTP protocol#469
swlynch99 merged 17 commits into
twitter:masterfrom
swlynch99:just-http

Conversation

@swlynch99
Copy link
Copy Markdown
Contributor

This PR introduces a rather simple HTTP protocol. It supports 3 commands - GET, PUT (set), and DELETE which is enough for simple cache use-cases. I have included tests for both request parsing and response emission.

In detail, this PR includes:

  • A HTTP parser that wraps httparse
  • A very simple HTTP response builder that does no validation
  • Tests for the above

Due to limitations around what pelikan allows parsers to do (they can't emit responses) the response parser doesn't directly return a request object but instead returns a wrapper around a Result<Request, Response>. The error response should be sent by the client in the place of creating its own response.

This PR is the first part of breaking apart #468 into mergeable chunks.

@swlynch99 swlynch99 requested a review from brayniac October 3, 2022 19:25
Comment thread src/protocol/http/Cargo.toml Outdated
Comment thread src/protocol/http/Cargo.toml
Comment thread src/protocol/http/src/lib.rs
Comment thread src/protocol/http/src/request.rs
Comment thread src/protocol/http/src/request.rs Outdated
Comment thread src/protocol/http/tests/request.rs
Comment thread src/protocol/http/tests/response.rs
Copy link
Copy Markdown
Contributor

@brayniac brayniac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@swlynch99 swlynch99 merged commit e8ee626 into twitter:master Oct 3, 2022
@swlynch99 swlynch99 deleted the just-http branch October 3, 2022 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants