Fragments from Request #2726
-
I'm working on an project with rocket. And I need in a request the fragment part of the request. http://example.com/test#this_is_what_I_need. I looked into Guards and the PathBuf but did not find anything that worked for me. Any idea how I that the fragment from an path? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This seems like a misunderstanding, because the Fragment part of the URI is intended for client-side processing, so Rocket cannot access it, as it is never actually sent to the server. The purpose of the Fragment is to be used on the client-side to identify a part of a resource AFTER the client received it from the web server. See Wikipedia: Or a bit more official, but also a lot less clear explanation from RFC 3986: So if you need to access the fragment, you'll have to do it on client-side, e.g. from Javascript |
Beta Was this translation helpful? Give feedback.
This seems like a misunderstanding, because the Fragment part of the URI is intended for client-side processing, so Rocket cannot access it, as it is never actually sent to the server. The purpose of the Fragment is to be used on the client-side to identify a part of a resource AFTER the client received it from the web server.
See Wikipedia:
"The fragment identifier functions differently to the rest of the URI: its processing is exclusively client-sided with no participation from the web server." ... "The agent sends the URI to the server, but does not send the fragment. Instead, the agent waits for the server to send the resource, and then the agent processes the resource according to th…