-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] feat: support XCocaineHTTPProtoVersion logic #13
Conversation
XCocaineHTTPProtoVersion sets when the reply must be sent Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
2c0f6e8
to
02e5044
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partially reviewed, there will be more.
@@ -28,10 +29,12 @@ use cocaine::protocol::{self, Flatten}; | |||
use logging::AccessLogger; | |||
use pool::{Event, EventDispatch, Settings}; | |||
use route::{Match, Route}; | |||
use self::CocaineHttpProtoVersion::{Proto10, Proto11}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary.
|
||
impl FromStr for CocaineHttpProtoVersion { | ||
type Err = Error; | ||
fn from_str(s: &str) -> Result<CocaineHttpProtoVersion, Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blank line between type
and fn
.
impl FromStr for CocaineHttpProtoVersion { | ||
type Err = Error; | ||
fn from_str(s: &str) -> Result<CocaineHttpProtoVersion, Error> { | ||
Ok(match s { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I try to avoid nested braces.
This looks better:
match s {
"1.0" => Ok(Proto10),
"1.1" => Ok(Proto11),
_ => Err(Error::InvalidCocaineHttpProtoVersion),
}
match resp.headers().get::<XCocaineHTTPProtoVersion>() { | ||
Some(h) => { | ||
match CocaineHttpProtoVersion::from_str(h) { | ||
Err(err) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something went wrong with indents here.
XCocaineHTTPProtoVersion sets when the reply must be sent
It looks like 💩
Related to #12