You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
At present, HeaderConvertible::from_stream returns Option<Self> and no track is kept of the bytes that have been read, with the result that bad header values are lost to the world. This is probably not an ideal state of things, although being able to read the header value iteratively without an extra allocation is good for performance. All up, I'm afraid it's probably best to read the entire header value up front. from_stream can continue to return Option<Self>, but something, somewhere, (the HeaderValueByteIterator, perhaps?) should retain the bytes that have been read so that the bad value can be obtained.
The resulting value that goes in the HeaderCollection (currently Option<T>) needs to be something like this:
This probably suggests a total redesign of HeaderValueByteIterator.
An interesting reference from RFC 2616, §14.21 (about the Expires header), which demonstrates how invalid values must be treated as distinct from missing values:
HTTP/1.1 clients and caches MUST treat other invalid date formats,
especially including the value "0", as in the past (i.e., "already
expired").
(This does not mandate retaining the invalid value, but I think it's probably going to be best.)
I think we should expect people to normally treat an invalid value and a missing value the same, only using the valid value, but there are clearly certain cases where we need to at least identify that there was an invalid value.
The text was updated successfully, but these errors were encountered:
At present,
HeaderConvertible::from_stream
returnsOption<Self>
and no track is kept of the bytes that have been read, with the result that bad header values are lost to the world. This is probably not an ideal state of things, although being able to read the header value iteratively without an extra allocation is good for performance. All up, I'm afraid it's probably best to read the entire header value up front.from_stream
can continue to returnOption<Self>
, but something, somewhere, (theHeaderValueByteIterator
, perhaps?) should retain the bytes that have been read so that the bad value can be obtained.The resulting value that goes in the
HeaderCollection
(currentlyOption<T>
) needs to be something like this:Another option would be
Option<Result<T, ~str>>
.This probably suggests a total redesign of
HeaderValueByteIterator
.An interesting reference from RFC 2616, §14.21 (about the Expires header), which demonstrates how invalid values must be treated as distinct from missing values:
(This does not mandate retaining the invalid value, but I think it's probably going to be best.)
I think we should expect people to normally treat an invalid value and a missing value the same, only using the valid value, but there are clearly certain cases where we need to at least identify that there was an invalid value.
The text was updated successfully, but these errors were encountered: