-
Notifications
You must be signed in to change notification settings - Fork 35
[0.3.0-draft] Make DNS-error-payload just contain a string.
#204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Having `DNS-error-payload` record contain a string field for `rcode` while a `u16` field for `info-code` is surprising. If appplications will be expected to know the IANA values of the `u16` [INFO-CODE value], it would make sense for them to know the `u16` for the [RCODE value] too. But if they won't, then they likely don't have any use for either `u16` value, and just want a simple string. I think wasi-http could plausibly go either way: Provide `u16` values for both `rcode` and `info-code`, or neither, and instead just provide a `string`. In this PR, I propose to just provide a `string`. My guess is that most applications in scope here don't need precise DNS error code information and basically just need a way to report that "it was DNS". And, not all host resolver libraries provide error information that includes RCODE and INFO-CODE, for example [Rust's `ToSocketAddrs` trait] or [POSIX `getaddrinfo`]. Fixed WebAssembly#184. [RCODE value]: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6 [INFO-CODE value]: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#extended-dns-error-codes [Rust's `ToSocketAddrs` trait]: https://doc.rust-lang.org/stable/std/net/trait.ToSocketAddrs.html [POSIX `getaddrinfo`]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/freeaddrinfo.html
DNS-error-payload just contain a string.DNS-error-payload just contain a string.
|
I don't really have much understanding of this aspect of HTTP/DNS but, if the cases are explicitly enumerated by a standard document, could we instead replace the |
|
I agree with Luke, if we can possibly use an enum to describe dns error cases we should prefer that to a string. And, along the same lines as my prior comment, it would be great if that same dns error enum can be used in wasi-sockets (which means wasi-http would take on a dep of wasi-sockets for that enum, which is fine with me). Both of the (closed-source) wasi-http embeddings I am working on have structured information for what sort of dns error occurred, and applications that make use of that error code. Embeddings without structured information can make a best effort to map their particular case to a code, and fall back on the internal error case with a string if that is the best they can do. |
Use dedicated enums instead of `string` and `u16` values for the `DNS-error-payload` `rcode` and `info-code` fields, using the known values semi-automatically extracted from [IANA]. And add an `extra-text` value, which may hold the EXTRA-TEXT field from RFC 8914, or an implementation-specific error message. This is an alternative to #204. [IANA]: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml
|
Either way works for me. I've now filed #206 with enums for rcode and info-code using values from IANA. |
|
Also, I didn't attempt to unify #206 with wasi-sockets yet. I'm not sure I'm ok with wasi-http taking a dependency on wasi-sockets. |
|
It does seem a bit odd to be exposing RCODEs in We could instead enable consumers to do their own resolution, perhaps something like a Coincidentally, this would have saved me a bit of time recently. 🙂 |
|
wasi-sockets is already de-facto a "dependency" of wasi-http despite never appearing in the source text, because it is a dependency of wasi-cli, which is used as part of the worlds. Rather than being part of the request options, I believe that the |
|
I do see |
|
It will not resolve and it is not an artifact of wit-deps. As I described, is a transitive dependency via wasi-cli. |
|
Ok, I suppose it's also a detail of wit-bindgen too. In particular, the |
|
It seems like there's a general problem here with how to deal with inevitable leaks in the HTTP abstraction. In addition to There are also common leaky features that would benefit from standardization like retrieving peer socket addresses or TLS session details (ref #4). |
Having
DNS-error-payloadrecord contain a string field forrcodewhile au16field forinfo-codeis surprising. If appplications will be expected to know the IANA values of theu16INFO-CODE value, it would make sense for them to know theu16for the RCODE value too. But if they won't, then they likely don't have any use for eitheru16value, and just want a simple string.I think wasi-http could plausibly go either way: Provide
u16values for bothrcodeandinfo-code, or neither, and instead just provide astring.In this PR, I propose to just provide a
string. My guess is that most applications in scope here don't need precise DNS error code information and basically just need a way to report that "it was DNS". And, not all host resolver libraries provide error information that includes RCODE and INFO-CODE, for example Rust'sToSocketAddrstrait or POSIXgetaddrinfo.Fixed #184.