-
Notifications
You must be signed in to change notification settings - Fork 108
Use RFC-compliant HeaderValue type. #287
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9e1c348
0542a78
3e9b789
9bf47e6
17b8b75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,15 @@ edition = "2018" | |
build = "build.rs" | ||
|
||
[dependencies] | ||
bytes = { version = "1", optional = true } | ||
hashbrown = "0.15" | ||
http = { version = "1", optional = true } | ||
log = "0.4" | ||
|
||
[features] | ||
default = [] | ||
header-value = ["dep:bytes", "dep:http"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feature could be renamed to Alternatively, we could drop this as a feature and instead add those functions as variants with Thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No objection to keeping it as a feature, though, assuming we find a solution to the HTTP/2 pseudo-headers problem. If you keep it a feature, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Since the original version without suffix is fundamentally broken for the HTTP use case, I think we should drop it sooner rather than later, so I'll stick to the version from the existing revision of this PR and leave it without suffix behind a feature flag.
Pseudo-header issue is orthogonal to this, since it only affects HTTP header names, and not values (this PR).
My original thinking was that we need to have a flag for both: values only (this PR) and for both, so that we could add support for Having said that, I suspect that adding support for the latter is going to require splitting pseudo-headers and regular HTTP headers into separate maps, so it might be a much bigger change that'd be done as part of a bigger rewrite and not something simply hidden behind a feature flag. Using Using So |
||
|
||
[profile.release] | ||
lto = true | ||
opt-level = 3 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,13 @@ | |
[license-badge]: https://img.shields.io/github/license/proxy-wasm/proxy-wasm-rust-sdk | ||
[license-link]: https://github.com/proxy-wasm/proxy-wasm-rust-sdk/blob/main/LICENSE | ||
|
||
## Crate features | ||
|
||
This crate supports the following optional features: | ||
|
||
- `header-value` - uses RFC-compliant `HeaderValue` instead of UTF-8 `String` for HTTP header and trailer values. | ||
This will become the default in future releases. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that this PR doesn't introduce any changes or restrictions on header names in the SDK, since all valid HTTP field names are also valid UTF-8 strings, and proxies are very strict about this, so we never panic deserializing header names. Having said that, I'm tempted to use Unfortunately, because we're passing HTTP/2 pseudo-headers (
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's unfortunate that If there isn't any good external precedent, maybe (1), in the form of an enum type that can either be an http::HeaderName or a pseudo-header? Or would There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Pseudo-headers are a wire-format detail, and they are not intermixed with HTTP headers in any library or language that I'm aware of (other than Envoy), so that's not an issue that other people run into.
My other concern was that even if we "patch" I think we should separate them, at the very least at the SDK level, otherwise we're just propagating this Envoy-ism and making it hard-to-impossible to interoperate with the generic HTTP libraries available in various languages. I'm sure this isn't helpful in Go SDK either. |
||
|
||
## Examples | ||
|
||
- [Hello World](./examples/hello_world/) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
############################################################################### | ||
# @generated | ||
# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To | ||
# regenerate this file, run the following: | ||
# | ||
# bazel run @//bazel/cargo:crates_vendor | ||
############################################################################### | ||
|
||
load("@rules_rust//cargo:defs.bzl", "cargo_toml_env_vars") | ||
load("@rules_rust//rust:defs.bzl", "rust_library") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
cargo_toml_env_vars( | ||
name = "cargo_toml_env_vars", | ||
src = "Cargo.toml", | ||
) | ||
|
||
rust_library( | ||
name = "bytes", | ||
srcs = glob( | ||
include = ["**/*.rs"], | ||
allow_empty = True, | ||
), | ||
compile_data = glob( | ||
include = ["**"], | ||
allow_empty = True, | ||
exclude = [ | ||
"**/* *", | ||
".tmp_git_root/**/*", | ||
"BUILD", | ||
"BUILD.bazel", | ||
"WORKSPACE", | ||
"WORKSPACE.bazel", | ||
], | ||
), | ||
crate_features = [ | ||
"default", | ||
"std", | ||
], | ||
crate_root = "src/lib.rs", | ||
edition = "2018", | ||
rustc_env_files = [ | ||
":cargo_toml_env_vars", | ||
], | ||
rustc_flags = [ | ||
"--cap-lints=allow", | ||
], | ||
tags = [ | ||
"cargo-bazel", | ||
"crate-name=bytes", | ||
"manual", | ||
"noclippy", | ||
"norustfmt", | ||
], | ||
target_compatible_with = select({ | ||
"@rules_rust//rust/platform:aarch64-apple-darwin": [], | ||
"@rules_rust//rust/platform:aarch64-apple-ios": [], | ||
"@rules_rust//rust/platform:aarch64-apple-ios-sim": [], | ||
"@rules_rust//rust/platform:aarch64-linux-android": [], | ||
"@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], | ||
"@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], | ||
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], | ||
"@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], | ||
"@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], | ||
"@rules_rust//rust/platform:aarch64-unknown-uefi": [], | ||
"@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], | ||
"@rules_rust//rust/platform:armv7-linux-androideabi": [], | ||
"@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], | ||
"@rules_rust//rust/platform:i686-apple-darwin": [], | ||
"@rules_rust//rust/platform:i686-linux-android": [], | ||
"@rules_rust//rust/platform:i686-pc-windows-msvc": [], | ||
"@rules_rust//rust/platform:i686-unknown-freebsd": [], | ||
"@rules_rust//rust/platform:i686-unknown-linux-gnu": [], | ||
"@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], | ||
"@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], | ||
"@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], | ||
"@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], | ||
"@rules_rust//rust/platform:thumbv7em-none-eabi": [], | ||
"@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], | ||
"@rules_rust//rust/platform:wasm32-unknown-unknown": [], | ||
"@rules_rust//rust/platform:wasm32-wasip1": [], | ||
"@rules_rust//rust/platform:x86_64-apple-darwin": [], | ||
"@rules_rust//rust/platform:x86_64-apple-ios": [], | ||
"@rules_rust//rust/platform:x86_64-linux-android": [], | ||
"@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], | ||
"@rules_rust//rust/platform:x86_64-unknown-freebsd": [], | ||
"@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], | ||
"@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], | ||
"@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], | ||
"@rules_rust//rust/platform:x86_64-unknown-none": [], | ||
"@rules_rust//rust/platform:x86_64-unknown-uefi": [], | ||
"//conditions:default": ["@platforms//:incompatible"], | ||
}), | ||
version = "1.10.1", | ||
) |
Uh oh!
There was an error while loading. Please reload this page.