Skip to content

implement as_str(), Display for Referer#95

Closed
goto-bus-stop wants to merge 3 commits into
hyperium:masterfrom
goto-bus-stop:referer-as-str
Closed

implement as_str(), Display for Referer#95
goto-bus-stop wants to merge 3 commits into
hyperium:masterfrom
goto-bus-stop:referer-as-str

Conversation

@goto-bus-stop

Copy link
Copy Markdown

So you can get the value out 😇 I just copied the implementation from the UserAgent type.

@goto-bus-stop

Copy link
Copy Markdown
Author

ok, tests were failing for good reason, i forgot to run them locally first…

@seanmonstar

Copy link
Copy Markdown
Member

Thanks for the PR! 😀

I haven't really thought about this, but curious to hear what you think: is it right to model the Referer as always a UTF-8 string? I guess it's usually going to be a URI, right? And so far in http, we've assumed that needs to be UTF-8...

@goto-bus-stop

Copy link
Copy Markdown
Author

i think it's OK to model it as always a URI … technically you could make a request that has some arbitrary data in there, but i don't think anyone intentionally wants to receive non-URIs in the referer field. browsers would only send a URI.

@seanmonstar

Copy link
Copy Markdown
Member

Actually, that reminds me. If we expose an as_str(), then we can't ever change this header to actually hold an http::Uri, for example, since that splits the string into 3 pieces. What if we just merge an impl Display for now?

AsamK added a commit to AsamK/headers that referenced this pull request Nov 26, 2022
Based on hyperium#95, but just adds impl Display
seanmonstar pushed a commit that referenced this pull request Jan 3, 2024
Based on #95, but just adds impl Display
@jplatte

jplatte commented Jan 3, 2024

Copy link
Copy Markdown
Contributor

With #122 merged, I think this should be closed.

@goto-bus-stop

Copy link
Copy Markdown
Author

great! 😁

@goto-bus-stop goto-bus-stop deleted the referer-as-str branch January 3, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants