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

Fix HttpResponse error #1620

Merged
merged 2 commits into from
Dec 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/brpc/policy/http_rpc_protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 resp;
HttpHeader header;
header.set_status_code(HTTP_STATUS_BAD_REQUEST);
MakeRawHttpRequest(&bad_req, &header, socket->remote_side(), NULL);
MakeRawHttpResponse(&resp, &header, NULL);
Socket::WriteOptions wopt;
wopt.ignore_eovercrowded = true;
socket->Write(&bad_req, &wopt);
socket->Write(&resp, &wopt);
return MakeParseError(PARSE_ERROR_NOT_ENOUGH_DATA);
} else {
return MakeParseError(PARSE_ERROR_TRY_OTHERS);
Expand Down