Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
6dd0af66
Commit
6dd0af66
authored
6 years ago
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary condition judgement
parent
eeb07057
master
0.9.8-rc01
0.9.7
0.9.7-rc03
0.9.7-rc02
0.9.7-rc01
0.9.6
0.9.6-rc03
0.9.6-rc02
0.9.6-rc01
0.9.5
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
18 deletions
+15
-18
http_rpc_protocol.cpp
src/brpc/policy/http_rpc_protocol.cpp
+15
-18
No files found.
src/brpc/policy/http_rpc_protocol.cpp
View file @
6dd0af66
...
...
@@ -771,25 +771,22 @@ HttpResponseSender::~HttpResponseSender() {
ParseContentType
(
req_header
->
content_type
())
==
HTTP_CONTENT_GRPC
;
if
(
cntl
->
Failed
())
{
// TODO(zhujiashun): really need this?
if
(
!
grpc_protocol
)
{
// Set status-code with default value(converted from error code)
// if user did not set it.
if
(
res_header
->
status_code
()
==
HTTP_STATUS_OK
)
{
res_header
->
set_status_code
(
ErrorCodeToStatusCode
(
cntl
->
ErrorCode
()));
}
// Fill ErrorCode into header
res_header
->
SetHeader
(
common
->
ERROR_CODE
,
butil
::
string_printf
(
"%d"
,
cntl
->
ErrorCode
()));
// Fill body with ErrorText.
// user may compress the output and change content-encoding. However
// body is error-text right now, remove the header.
res_header
->
RemoveHeader
(
common
->
CONTENT_ENCODING
);
res_header
->
set_content_type
(
common
->
CONTENT_TYPE_TEXT
);
cntl
->
response_attachment
().
clear
();
cntl
->
response_attachment
().
append
(
cntl
->
ErrorText
());
// Set status-code with default value(converted from error code)
// if user did not set it.
if
(
res_header
->
status_code
()
==
HTTP_STATUS_OK
)
{
res_header
->
set_status_code
(
ErrorCodeToStatusCode
(
cntl
->
ErrorCode
()));
}
// Fill ErrorCode into header
res_header
->
SetHeader
(
common
->
ERROR_CODE
,
butil
::
string_printf
(
"%d"
,
cntl
->
ErrorCode
()));
// Fill body with ErrorText.
// user may compress the output and change content-encoding. However
// body is error-text right now, remove the header.
res_header
->
RemoveHeader
(
common
->
CONTENT_ENCODING
);
res_header
->
set_content_type
(
common
->
CONTENT_TYPE_TEXT
);
cntl
->
response_attachment
().
clear
();
cntl
->
response_attachment
().
append
(
cntl
->
ErrorText
());
}
else
if
(
cntl
->
has_progressive_writer
())
{
// Transfer-Encoding is supported since HTTP/1.1
if
(
res_header
->
major_version
()
<
2
&&
!
res_header
->
before_http_1_1
())
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment