You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2021/12/01 08:30:47 UTC
[GitHub] [incubator-brpc] jl2005 opened a new pull request #1620: Fix HttpResponse error
jl2005 opened a new pull request #1620:
URL: https://github.com/apache/incubator-brpc/pull/1620
When an incorrect HTTP request is received, the existing code returns an `HttpRequest`, which should actually return an `HttpResponse`.
before fixing:
```
# curl 127.0.0.1:8010/v1/queue/stop\ 1 -v ✔ 16:21:13
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8010 (#0)
> GET /v1/queue/stop 1 HTTP/1.1
> Host: 127.0.0.1:8010
> User-Agent: curl/7.64.1
> Accept: */*
>
GET / HTTP/1.1
Host: 127.0.0.1:58674
Accept: */*
User-Agent: brpc/1.0 curl/7.0
* Closing connection 0
```
After modification:
```
# curl 127.0.0.1:8010/v1/queue/stop\ 1 -v ✔ 15:43:28
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8010 (#0)
> GET /v1/queue/stop 1 HTTP/1.1
> Host: 127.0.0.1:8010
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 400 Bad Request
* no chunk, no close, no size. Assume close to signal end
<
* Closing connection 0
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] chenzhangyi commented on a change in pull request #1620: Fix HttpResponse error
Posted by GitBox <gi...@apache.org>.
chenzhangyi commented on a change in pull request #1620:
URL: https://github.com/apache/incubator-brpc/pull/1620#discussion_r760199710
##########
File path: src/brpc/policy/http_rpc_protocol.cpp
##########
@@ -1146,13 +1146,13 @@ ParseResult ParseHttpMessage(butil::IOBuf *source, Socket *socket,
return MakeParseError(PARSE_ERROR_NOT_ENOUGH_DATA);
}
// Send 400 back.
- butil::IOBuf bad_req;
+ butil::IOBuf bad_resp;
Review comment:
The variable name should be bad_req, which indicates that the response content is 'Bad Request', rather than a 'bad' response.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] jl2005 commented on pull request #1620: Fix HttpResponse error
Posted by GitBox <gi...@apache.org>.
jl2005 commented on pull request #1620:
URL: https://github.com/apache/incubator-brpc/pull/1620#issuecomment-983623623
cc @chenzhangyi @wanglun @jbonofre @llhe @ke4qqq
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] jl2005 commented on a change in pull request #1620: Fix HttpResponse error
Posted by GitBox <gi...@apache.org>.
jl2005 commented on a change in pull request #1620:
URL: https://github.com/apache/incubator-brpc/pull/1620#discussion_r760718335
##########
File path: src/brpc/policy/http_rpc_protocol.cpp
##########
@@ -1146,13 +1146,13 @@ ParseResult ParseHttpMessage(butil::IOBuf *source, Socket *socket,
return MakeParseError(PARSE_ERROR_NOT_ENOUGH_DATA);
}
// Send 400 back.
- butil::IOBuf bad_req;
+ butil::IOBuf bad_resp;
Review comment:
@wasphin I have modified.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] wasphin commented on a change in pull request #1620: Fix HttpResponse error
Posted by GitBox <gi...@apache.org>.
wasphin commented on a change in pull request #1620:
URL: https://github.com/apache/incubator-brpc/pull/1620#discussion_r761637156
##########
File path: src/brpc/policy/http_rpc_protocol.cpp
##########
@@ -1146,13 +1146,13 @@ ParseResult ParseHttpMessage(butil::IOBuf *source, Socket *socket,
return MakeParseError(PARSE_ERROR_NOT_ENOUGH_DATA);
}
// Send 400 back.
- butil::IOBuf bad_req;
+ butil::IOBuf bad_resp;
Review comment:
Not a member.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] wasphin commented on a change in pull request #1620: Fix HttpResponse error
Posted by GitBox <gi...@apache.org>.
wasphin commented on a change in pull request #1620:
URL: https://github.com/apache/incubator-brpc/pull/1620#discussion_r760249352
##########
File path: src/brpc/policy/http_rpc_protocol.cpp
##########
@@ -1146,13 +1146,13 @@ ParseResult ParseHttpMessage(butil::IOBuf *source, Socket *socket,
return MakeParseError(PARSE_ERROR_NOT_ENOUGH_DATA);
}
// Send 400 back.
- butil::IOBuf bad_req;
+ butil::IOBuf bad_resp;
Review comment:
Then a simple `resp` maybe better.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] chenzhangyi commented on pull request #1620: Fix HttpResponse error
Posted by GitBox <gi...@apache.org>.
chenzhangyi commented on pull request #1620:
URL: https://github.com/apache/incubator-brpc/pull/1620#issuecomment-985221046
Merged, thanks for your contribution.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] chenzhangyi merged pull request #1620: Fix HttpResponse error
Posted by GitBox <gi...@apache.org>.
chenzhangyi merged pull request #1620:
URL: https://github.com/apache/incubator-brpc/pull/1620
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org