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
f176fe92
Commit
f176fe92
authored
Sep 26, 2018
by
zyearn
Committed by
zhujiashun
Sep 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix conflicts after rebase origin/master
parent
9f166e85
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
9 deletions
+11
-9
http2_rpc_protocol.cpp
src/brpc/policy/http2_rpc_protocol.cpp
+5
-4
http2_rpc_protocol.h
src/brpc/policy/http2_rpc_protocol.h
+2
-2
http_rpc_protocol.cpp
src/brpc/policy/http_rpc_protocol.cpp
+2
-2
brpc_http_rpc_protocol_unittest.cpp
test/brpc_http_rpc_protocol_unittest.cpp
+2
-1
No files found.
src/brpc/policy/http2_rpc_protocol.cpp
View file @
f176fe92
...
...
@@ -1629,15 +1629,16 @@ void H2UnsentRequest::Describe(butil::IOBuf* desc) const {
}
}
H2UnsentResponse
::
H2UnsentResponse
(
Controller
*
c
,
const
TrailerMessage
&
trailers
)
H2UnsentResponse
::
H2UnsentResponse
(
Controller
*
c
,
int
stream_id
,
const
TrailerMessage
&
trailers
)
:
_size
(
0
)
,
_stream_id
(
c
->
http_request
().
h2_stream_id
()
)
,
_stream_id
(
stream_id
)
,
_http_response
(
c
->
release_http_response
())
,
_trailers
(
trailers
)
{
_data
.
swap
(
c
->
response_attachment
());
}
H2UnsentResponse
*
H2UnsentResponse
::
New
(
Controller
*
c
,
const
TrailerMessage
&
trailers
)
{
H2UnsentResponse
*
H2UnsentResponse
::
New
(
Controller
*
c
,
int
stream_id
,
const
TrailerMessage
&
trailers
)
{
const
HttpHeader
*
const
h
=
&
c
->
http_response
();
const
CommonStrings
*
const
common
=
get_common_strings
();
const
bool
need_content_length
=
...
...
@@ -1648,7 +1649,7 @@ H2UnsentResponse* H2UnsentResponse::New(Controller* c, const TrailerMessage& tra
+
(
size_t
)
need_content_type
;
const
size_t
memsize
=
offsetof
(
H2UnsentResponse
,
_list
)
+
sizeof
(
HPacker
::
Header
)
*
maxsize
;
H2UnsentResponse
*
msg
=
new
(
malloc
(
memsize
))
H2UnsentResponse
(
c
,
trailers
);
H2UnsentResponse
*
msg
=
new
(
malloc
(
memsize
))
H2UnsentResponse
(
c
,
stream_id
,
trailers
);
// :status
if
(
h
->
status_code
()
==
200
)
{
msg
->
push
(
common
->
H2_STATUS
,
common
->
STATUS_200
);
...
...
src/brpc/policy/http2_rpc_protocol.h
View file @
f176fe92
...
...
@@ -194,7 +194,7 @@ private:
class
H2UnsentResponse
:
public
SocketMessage
{
public
:
static
H2UnsentResponse
*
New
(
Controller
*
c
,
const
TrailerMessage
&
trailers
);
static
H2UnsentResponse
*
New
(
Controller
*
c
,
int
stream_id
,
const
TrailerMessage
&
trailers
);
void
Destroy
();
void
Describe
(
butil
::
IOBuf
*
)
const
;
// @SocketMessage
...
...
@@ -208,7 +208,7 @@ private:
void
push
(
const
std
::
string
&
name
,
const
std
::
string
&
value
)
{
new
(
&
_list
[
_size
++
])
HPacker
::
Header
(
name
,
value
);
}
H2UnsentResponse
(
Controller
*
c
,
const
TrailerMessage
&
trailers
);
H2UnsentResponse
(
Controller
*
c
,
int
stream_id
,
const
TrailerMessage
&
trailers
);
~
H2UnsentResponse
()
{}
H2UnsentResponse
(
const
H2UnsentResponse
&
);
void
operator
=
(
const
H2UnsentResponse
&
);
...
...
src/brpc/policy/http_rpc_protocol.cpp
View file @
f176fe92
...
...
@@ -802,7 +802,7 @@ HttpResponseSender::~HttpResponseSender() {
// 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
(
ErrorCode
2
StatusCode
(
cntl
->
ErrorCode
()));
res_header
->
set_status_code
(
ErrorCode
To
StatusCode
(
cntl
->
ErrorCode
()));
}
// Fill ErrorCode into header
res_header
->
SetHeader
(
common
->
ERROR_CODE
,
...
...
@@ -907,7 +907,7 @@ HttpResponseSender::~HttpResponseSender() {
wopt
.
ignore_eovercrowded
=
true
;
if
(
req_header
->
is_http2
())
{
SocketMessagePtr
<
H2UnsentResponse
>
h2_response
(
H2UnsentResponse
::
New
(
cntl
,
trailers
));
H2UnsentResponse
::
New
(
cntl
,
_h2_stream_id
,
trailers
));
if
(
h2_response
==
NULL
)
{
LOG
(
ERROR
)
<<
"Fail to make http2 response"
;
errno
=
EINVAL
;
...
...
test/brpc_http_rpc_protocol_unittest.cpp
View file @
f176fe92
...
...
@@ -216,7 +216,8 @@ protected:
butil
::
IOBufAsZeroCopyOutputStream
wrapper
(
&
cntl
.
response_attachment
());
EXPECT_TRUE
(
res
.
SerializeToZeroCopyStream
(
&
wrapper
));
}
brpc
::
policy
::
H2UnsentResponse
*
h2_res
=
brpc
::
policy
::
H2UnsentResponse
::
New
(
&
cntl
,
h2_stream_id
);
const
brpc
::
TrailerMessage
dummy
;
brpc
::
policy
::
H2UnsentResponse
*
h2_res
=
brpc
::
policy
::
H2UnsentResponse
::
New
(
&
cntl
,
h2_stream_id
,
dummy
);
butil
::
Status
st
=
h2_res
->
AppendAndDestroySelf
(
out
,
_h2_client_sock
.
get
());
ASSERT_TRUE
(
st
.
ok
());
}
...
...
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