Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
aca53ac
First stage of streaming implementation
martinthomson Oct 23, 2024
a9d76f7
Adding vector reading capabilities
martinthomson Oct 23, 2024
30b7ef5
Add 16-bit arch as well, I guess
martinthomson Oct 23, 2024
c432a05
Checkpoint
martinthomson Oct 24, 2024
7d78bc7
Checkpoint, fuck lifetimes
martinthomson Oct 28, 2024
6f4ec9a
Working enough for now
martinthomson Oct 28, 2024
aac02a9
Update to use dep: syntax for dependencies
martinthomson Oct 29, 2024
00cfe4f
Merge main
martinthomson Oct 29, 2024
ef83a26
Merge branch 'main' into stream
martinthomson Oct 29, 2024
e19de29
Better formatting
martinthomson Oct 29, 2024
c91933c
Refactor stream helper functions
martinthomson Nov 2, 2024
880d958
Move to use OnceLock
martinthomson Nov 2, 2024
69402f4
Checkpoint for request streaming
martinthomson Nov 11, 2024
7222a26
Add missing file
martinthomson Dec 13, 2024
9bea311
Checkpoint
martinthomson Dec 19, 2024
f1c5dae
Checkpoint
martinthomson Dec 19, 2024
9cf1972
Working
martinthomson Dec 19, 2024
20d238f
Working better
martinthomson Dec 19, 2024
a6b5972
Fix stream close errors
martinthomson Feb 6, 2025
bdd84db
Fix some pretty serious stream close errors
martinthomson Feb 10, 2025
92ca87d
Clean up some return values
martinthomson Feb 13, 2025
bf40210
Fix parentheses
martinthomson Mar 15, 2025
26183df
Merge in pre-commit improvements
martinthomson Feb 27, 2025
6d49354
Move to rust 1.82 more fully
martinthomson Apr 24, 2025
7e43eac
Changes for test vectors in spec
martinthomson May 5, 2025
bda5498
Fix some lints
martinthomson Aug 8, 2025
e28bdbd
Rawness
martinthomson Aug 8, 2025
16e5ced
Merge main
martinthomson Aug 8, 2025
35feee7
Fix dead code warning
martinthomson Aug 8, 2025
9ac9892
Update docs
martinthomson Aug 11, 2025
adaa65c
Update targets for NSS tests
martinthomson Aug 11, 2025
634b1bc
Expand linting
martinthomson Aug 11, 2025
57b2b13
Merge branch 'main' into stream
martinthomson Aug 11, 2025
8628e6c
Suppress dead_code warning
martinthomson Aug 11, 2025
60fb511
Buffer cleartext properly if output is too small
martinthomson Sep 8, 2025
fa9c40a
Add more documentation
martinthomson Sep 22, 2025
a03f657
Bump version number
martinthomson Sep 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ members = [
"ohttp-client",
"ohttp-client-cli",
"ohttp-server",
"sync-async",
]

[workspace.package]
Expand All @@ -17,7 +18,7 @@ description = "Oblivious HTTP"
keywords = ["ohttp", "http", "bhttp", "ietf"]
categories = ["network-programming", "web-programming", "security"]
readme = "README.md"
version = "0.6.1"
version = "0.7.0"
edition = "2021"
license = "MIT OR Apache-2.0"
rust-version = "1.82.0"
29 changes: 12 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,11 @@ descriptive.

The `bhttp` crate has the following features:

- `read-bhttp` enables parsing of binary HTTP messages. This is enabled by
default.
- `http` enables parsing and generation of binary HTTP messages.
This is disabled by default.

- `write-bhttp` enables writing of binary HTTP messages. This is enabled by
default.

- `read-http` enables a simple HTTP/1.1 message parser. This parser is fairly
basic and is not recommended for production use. Getting an HTTP/1.1 parser
right is a massive enterprise; this one only does the basics. This is
disabled by default.

- `write-http` enables writing of HTTP/1.1 messages. This is disabled by
default.
- `stream` enables stream processing (presently just reading)
of binary HTTP messages. This is disabled by default until it stabilizes.

The `ohttp` crate has the following features:

Expand All @@ -47,6 +39,10 @@ The `ohttp` crate has the following features:
[NSS](https://firefox-source-docs.mozilla.org/security/nss/index.html). This is
disabled by default and cannot be enabled at the same time as `rust-hpke`.

- `stream` enables stream processing (presently just reading)
of [chunked Oblivious HTTP messages](https://datatracker.ietf.org/doc/html/draft-ietf-ohai-chunked-ohttp).
This is disabled by default until it stabilizes.


## Utilities

Expand Down Expand Up @@ -128,16 +124,15 @@ export NSS_DIR=$workspace/nss
export LD_LIBRARY_PATH=$workspace/dist/Debug/lib
```

You might need to tweak this. On a Mac, use `DYLD_LIBRARY_PATH` instead of
`LD_LIBRARY_PATH`. And if you are building with `--release`, the path includes
"Release" rather than "Debug".
On a Mac, use `DYLD_LIBRARY_PATH` instead of `LD_LIBRARY_PATH`.
If you are building with `--release`, the path includes "Release" rather than "Debug".

Then you should be able to build and run tests:

```sh
cd $workspace
cargo build
cargo test
cargo build -F nss,client,server,http --no-default-features
cargo test -F nss,client,server,http --no-default-features
```


Expand Down
2 changes: 1 addition & 1 deletion bhttp-convert/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ structopt = "0.3"

[dependencies.bhttp]
path= "../bhttp"
features = ["bhttp", "http"]
features = ["http"]
3 changes: 2 additions & 1 deletion bhttp-convert/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#![deny(warnings, clippy::pedantic)]

use bhttp::{Message, Mode};
use std::{
fs::File,
io::{self, Read},
path::PathBuf,
};

use bhttp::{Message, Mode};
use structopt::StructOpt;

#[derive(Debug, StructOpt)]
Expand Down
15 changes: 8 additions & 7 deletions bhttp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ categories.workspace = true
readme.workspace = true

[features]
default = ["bhttp"]
bhttp = ["read-bhttp", "write-bhttp"]
http = ["read-http", "write-http"]
read-bhttp = []
write-bhttp = []
read-http = ["url"]
write-http = []
default = []
http = ["dep:url"]
stream = ["dep:futures", "dep:pin-project"]

[dependencies]
futures = {version = "0.3", optional = true}
pin-project = {version = "1.1", optional = true}
thiserror = "1"
url = {version = "2", optional = true}

[dev-dependencies]
hex = "0.4"

[dev-dependencies.sync-async]
path= "../sync-async"
18 changes: 8 additions & 10 deletions bhttp/src/err.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use thiserror::Error;

#[derive(Error, Debug)]
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("a request used the CONNECT method")]
ConnectUnsupported,
Expand All @@ -16,8 +14,14 @@ pub enum Error {
InvalidMode,
#[error("the status code of a response needs to be in 100..=599")]
InvalidStatus,
#[cfg(feature = "stream")]
#[error("a method was called when the message was in the wrong state")]
InvalidState,
#[error("IO error {0}")]
Io(#[from] std::io::Error),
#[cfg(feature = "stream")]
#[error("the size of a vector exceeded the limit that was set")]
LimitExceeded,
#[error("a field or line was missing a necessary character 0x{0:x}")]
Missing(u8),
#[error("a URL was missing a key component")]
Expand All @@ -31,14 +35,8 @@ pub enum Error {
#[error("a message included the Upgrade field")]
UpgradeUnsupported,
#[error("a URL could not be parsed into components: {0}")]
#[cfg(feature = "read-http")]
#[cfg(feature = "http")]
UrlParse(#[from] url::ParseError),
}

#[cfg(any(
feature = "read-http",
feature = "write-http",
feature = "read-bhttp",
feature = "write-bhttp"
))]
pub type Res<T> = Result<T, Error>;
Loading