Closed Ogeon closed 9 years ago
I think this is all for this PR, unless I happen to have missed something. This is such a big change so it's completely possible.
@homu r+
:pushpin: Commit 4eea3eb has been approved by Ogeon
:hourglass: Testing commit 4eea3eb with merge 258a0c7...
@homu retry
:hourglass: Testing commit 4eea3eb with merge 44e3bf6...
This makes the server avoid destroying any non-UTF-8 data from the requests. This is done by packaging the data as either a
Vec<u8>
or aString
in aMaybeUtf8
type and only ruin the non-UTF-8 data if the user asks for it.The
Parameters
type has been further specialized and extended to make things more convenient, through an extra layer of conversion back and forth between types. It has also been moved into thecontext
module, which has been divided into sub modules to keep things organized.The only place where losslessness has been sacrificed for convenience is in the
get
inParameters
. It will perform a conversion if the parameter value is non-UTF-8 data, but there is also aget_raw
for when the original data is desired. I hope it won't become too much of a footgun, but I suspect that most people want strings instead of bytes.All this was triggered by the first commit, where * request are finally handled. They will be redirected to the fallback handler and the
path
field inContext
has been replaced by auri
field with a newUri
type, that can represent * URIs as well as lossless paths. This shouldn't be too inconvenient.A side effect of the desire to preserve the data is that the
Router
trait and friends had to be changed. It's really some hairy business and I managed to bork the compiler into forgetting thatString
implements traits a couple of times :confounded:This pull request is quite monolithic and definitely breaking.