router icon indicating copy to clipboard operation
router copied to clipboard

add host getter/setters to http_compat and expose in rhai

Open garypen opened this issue 3 years ago • 2 comments

#1258 prompted some interesting debate about the correct way for router plugins (and the router itself) to get/set "host" details. Largely, this is because of the different ways in which this information is conveyed over different revisions (and implementations) of the HTTP protocol.

The router engineering team resolved to merge the PR that resolves #1258 as is and then file this followup issue to note that we'd really like to have convenience getter/setter for host manipulation that can be used by plugins and exposed to rhai.

Here's what we'd like (roughly, in pseudo-rust)

\\\ Try to find host details by:
\\\  - Examining HOST header
\\\  - Examining request host attribute
\\\  - If not found return None
Request::get_host(&self) -> Option<&str>;

\\\ Try to update host details by:
\\\  - Updating HOST header (if present)
\\\  - Updating request host attribute
Request::set_host(&mut self, host: &str);

garypen avatar Jun 16 '22 08:06 garypen

Can this be added backward-compatibly after 1.0?

Do we want to have it for 1.0 anyway?

SimonSapin avatar Aug 11 '22 13:08 SimonSapin

It imo is even less important given the fact we d like to separate the http and the gql parts of the lifecycle even further.

o0Ignition0o avatar Aug 11 '22 14:08 o0Ignition0o

This could be done post 1.0, so removing the 1.0 label. If you feel strongly that it should be 1.0, add it back with a comment.

garypen avatar Aug 18 '22 13:08 garypen