Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

noxiouz
Copy link
Contributor

@noxiouz noxiouz commented Jun 20, 2017

XCocaineHTTPProtoVersion sets when the reply must be sent
It looks like 💩

Related to #12

XCocaineHTTPProtoVersion sets when the reply must be sent

Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
@noxiouz noxiouz force-pushed the feat_x_http_proto_version branch from 2c0f6e8 to 02e5044 Compare June 20, 2017 13:19
Copy link
Owner

@3Hren 3Hren left a 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};
Copy link
Owner

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> {
Copy link
Owner

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 {
Copy link
Owner

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) => {
Copy link
Owner

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.

@3Hren 3Hren closed this Mar 6, 2018
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.

2 participants