martinthomson / ohttp

Rust library for encapsulating HTTP messages in a cryptographic wrapper
Apache License 2.0
24 stars 18 forks source link

Usability nits #67

Open tgeoghegan opened 4 months ago

tgeoghegan commented 4 months ago

I want to note a grab bag of minor usability nits to see whether the maintainer(s) care about them and/or agree with my suggestions. These would involve changing or adding to public API so there are meaningful maintainability considerations here.

martinthomson commented 3 months ago

In general, I'm trying to avoid pulling in a whole lot of dependencies, which the http-related changes would. An adapter (or From/Into implementations) would be OK with a feature gate.

As for ohttp vs. bhttp, the two are completely independent from a code perspective. The convenience functions you are talking about adding might end that, so we can maybe wrap one error in the other for those functions.

I don't have a ton of spare time for doing this work, but I'd be happy to help out with reviews and whatnot.

DanGould commented 3 months ago

What if this was http::StatusCode instead? Or perhaps there's a good reason that bhttp/ohttp avoid depending on crate http.

While avoiding a dependency on http is noble and admirable, I can't think of any environment where bhttp/ohttp would be used without a dependency on http somewhere in the tree.

martinthomson commented 3 months ago

Our use of this crate in Firefox is an example of exactly that, as it happens. Pulling in http would mean a much bigger binary. I'm OK with these conveniences being present, but they would need to be optional, I think.