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
adb2032a
Commit
adb2032a
authored
Apr 27, 2018
by
Zhu Jiashun
Committed by
zhujiashun
Sep 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add http2.
TODO: 1. socket management 2. window mechanism
parent
b232a463
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
3 deletions
+25
-3
http_header.cpp
src/brpc/http_header.cpp
+7
-1
http_header.h
src/brpc/http_header.h
+8
-0
options.proto.rej
src/brpc/options.proto.rej
+9
-0
server.h
src/brpc/server.h
+1
-2
No files found.
src/brpc/http_header.cpp
View file @
adb2032a
...
...
@@ -24,7 +24,9 @@ namespace brpc {
HttpHeader
::
HttpHeader
()
:
_status_code
(
HTTP_STATUS_OK
)
,
_method
(
HTTP_METHOD_GET
)
,
_version
(
1
,
1
)
{
,
_version
(
1
,
1
)
,
_h2_stream_id
(
0
)
,
_h2_error
(
H2_NO_ERROR
)
{
// NOTE: don't forget to clear the field in Clear() as well.
}
...
...
@@ -48,6 +50,8 @@ void HttpHeader::Swap(HttpHeader &rhs) {
_content_type
.
swap
(
rhs
.
_content_type
);
_unresolved_path
.
swap
(
rhs
.
_unresolved_path
);
std
::
swap
(
_version
,
rhs
.
_version
);
std
::
swap
(
_h2_stream_id
,
rhs
.
_h2_stream_id
);
std
::
swap
(
_h2_error
,
rhs
.
_h2_error
);
}
void
HttpHeader
::
Clear
()
{
...
...
@@ -58,6 +62,8 @@ void HttpHeader::Clear() {
_content_type
.
clear
();
_unresolved_path
.
clear
();
_version
=
std
::
make_pair
(
1
,
1
);
_h2_stream_id
=
0
;
_h2_error
=
H2_NO_ERROR
;
}
const
char
*
HttpHeader
::
reason_phrase
()
const
{
...
...
src/brpc/http_header.h
View file @
adb2032a
...
...
@@ -63,6 +63,12 @@ public:
// True if the message is from HTTP2.
bool
is_http2
()
const
{
return
major_version
()
==
2
;
}
// Id of the HTTP2 stream where the message is from.
// 0 when is_http2() is false.
int
h2_stream_id
()
const
{
return
_h2_stream_id
;
}
H2Error
h2_error
()
const
{
return
_h2_error
;
}
// Get/set "Content-Type". Notice that you can't get "Content-Type"
// via GetHeader().
// possible values: "text/plain", "application/json" ...
...
...
@@ -154,6 +160,8 @@ friend void policy::ProcessHttpRequest(InputMessageBase *msg);
std
::
string
_content_type
;
std
::
string
_unresolved_path
;
std
::
pair
<
int
,
int
>
_version
;
int
_h2_stream_id
;
H2Error
_h2_error
;
};
const
HttpHeader
&
DefaultHttpHeader
();
...
...
src/brpc/options.proto.rej
0 → 100644
View file @
adb2032a
diff a/src/brpc/options.proto b/src/brpc/options.proto (rejected hunks)
@@ -53,6 +53,7 @@ enum ProtocolType {
// Reserve special protocol for cds-agent, which depends on FIFO right now
PROTOCOL_CDS_AGENT = 23; // Client side only
PROTOCOL_ESP = 24; // Client side only
+ PROTOCOL_HTTP2 = 25;
}
message ChunkInfo {
src/brpc/server.h
View file @
adb2032a
...
...
@@ -53,8 +53,7 @@ class RtmpService;
class
SocketSSLContext
;
struct
ServerOptions
{
// Constructed with default options.
ServerOptions
();
ServerOptions
();
// Constructed with default options.
// connections without data transmission for so many seconds will be closed
// Default: -1 (disabled)
...
...
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