Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
3ff14881
Commit
3ff14881
authored
Feb 20, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Use StringRef for add_hedeader
parent
6f1347fc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
26 deletions
+20
-26
src/shrpx_downstream.cc
src/shrpx_downstream.cc
+8
-16
src/shrpx_downstream.h
src/shrpx_downstream.h
+4
-4
src/shrpx_http2_session.cc
src/shrpx_http2_session.cc
+4
-3
src/shrpx_http2_upstream.cc
src/shrpx_http2_upstream.cc
+4
-3
No files found.
src/shrpx_downstream.cc
View file @
3ff14881
...
...
@@ -338,14 +338,10 @@ void add_header(bool &key_prev, size_t &sum, Headers &headers, std::string name,
}
// namespace
namespace
{
void
add_header
(
size_t
&
sum
,
Headers
&
headers
,
const
uint8_t
*
name
,
size_t
namelen
,
const
uint8_t
*
value
,
size_t
valuelen
,
bool
no_index
,
int16_t
token
)
{
sum
+=
namelen
+
valuelen
;
headers
.
emplace_back
(
std
::
string
(
reinterpret_cast
<
const
char
*>
(
name
),
namelen
),
std
::
string
(
reinterpret_cast
<
const
char
*>
(
value
),
valuelen
),
no_index
,
token
);
void
add_header
(
size_t
&
sum
,
Headers
&
headers
,
const
StringRef
&
name
,
const
StringRef
&
value
,
bool
no_index
,
int16_t
token
)
{
sum
+=
name
.
size
()
+
value
.
size
();
headers
.
emplace_back
(
name
.
str
(),
value
.
str
(),
no_index
,
token
);
}
}
// namespace
...
...
@@ -430,11 +426,9 @@ void FieldStore::add_header(std::string name, std::string value,
headers_
.
emplace_back
(
std
::
move
(
name
),
std
::
move
(
value
),
false
,
token
);
}
void
FieldStore
::
add_header
(
const
uint8_t
*
name
,
size_t
namelen
,
const
uint8_t
*
value
,
size_t
valuelen
,
void
FieldStore
::
add_header
(
const
StringRef
&
name
,
const
StringRef
&
value
,
bool
no_index
,
int16_t
token
)
{
shrpx
::
add_header
(
buffer_size_
,
headers_
,
name
,
namelen
,
value
,
valuelen
,
no_index
,
token
);
shrpx
::
add_header
(
buffer_size_
,
headers_
,
name
,
value
,
no_index
,
token
);
}
void
FieldStore
::
append_last_header_key
(
const
char
*
data
,
size_t
len
)
{
...
...
@@ -449,13 +443,11 @@ void FieldStore::append_last_header_value(const char *data, size_t len) {
void
FieldStore
::
clear_headers
()
{
headers_
.
clear
();
}
void
FieldStore
::
add_trailer
(
const
uint8_t
*
name
,
size_t
namelen
,
const
uint8_t
*
value
,
size_t
valuelen
,
void
FieldStore
::
add_trailer
(
const
StringRef
&
name
,
const
StringRef
&
value
,
bool
no_index
,
int16_t
token
)
{
// Header size limit should be applied to all header and trailer
// fields combined.
shrpx
::
add_header
(
buffer_size_
,
trailers_
,
name
,
namelen
,
value
,
valuelen
,
no_index
,
token
);
shrpx
::
add_header
(
buffer_size_
,
trailers_
,
name
,
value
,
no_index
,
token
);
}
void
FieldStore
::
add_trailer_lower
(
const
StringRef
&
name
,
...
...
src/shrpx_downstream.h
View file @
3ff14881
...
...
@@ -81,8 +81,8 @@ public:
void
add_header_lower
(
const
StringRef
&
name
,
const
StringRef
&
value
);
void
add_header
(
std
::
string
name
,
std
::
string
value
,
int16_t
token
);
void
add_header
(
const
uint8_t
*
name
,
size_t
namelen
,
const
uint8_t
*
value
,
size_t
valuelen
,
bool
no_index
,
int16_t
token
);
void
add_header
(
const
StringRef
&
name
,
const
StringRef
&
value
,
bool
no_index
,
int16_t
token
);
void
append_last_header_key
(
const
char
*
data
,
size_t
len
);
void
append_last_header_value
(
const
char
*
data
,
size_t
len
);
...
...
@@ -97,8 +97,8 @@ public:
// Empties headers.
void
clear_headers
();
void
add_trailer
(
const
uint8_t
*
name
,
size_t
namelen
,
const
uint8_t
*
value
,
size_t
valuelen
,
bool
no_index
,
int16_t
token
);
void
add_trailer
(
const
StringRef
&
name
,
const
StringRef
&
value
,
bool
no_index
,
int16_t
token
);
void
add_trailer_lower
(
const
StringRef
&
name
,
const
StringRef
&
value
);
void
append_last_trailer_key
(
const
char
*
data
,
size_t
len
);
...
...
src/shrpx_http2_session.cc
View file @
3ff14881
...
...
@@ -739,12 +739,12 @@ int on_header_callback(nghttp2_session *session, const nghttp2_frame *frame,
if
(
trailer
)
{
// just store header fields for trailer part
resp
.
fs
.
add_trailer
(
name
,
namelen
,
value
,
valuelen
,
resp
.
fs
.
add_trailer
(
StringRef
{
name
,
namelen
},
StringRef
{
value
,
valuelen
}
,
flags
&
NGHTTP2_NV_FLAG_NO_INDEX
,
token
);
return
0
;
}
resp
.
fs
.
add_header
(
name
,
namelen
,
value
,
valuelen
,
resp
.
fs
.
add_header
(
StringRef
{
name
,
namelen
},
StringRef
{
value
,
valuelen
}
,
flags
&
NGHTTP2_NV_FLAG_NO_INDEX
,
token
);
return
0
;
}
...
...
@@ -778,7 +778,8 @@ int on_header_callback(nghttp2_session *session, const nghttp2_frame *frame,
}
auto
token
=
http2
::
lookup_token
(
name
,
namelen
);
promised_req
.
fs
.
add_header
(
name
,
namelen
,
value
,
valuelen
,
promised_req
.
fs
.
add_header
(
StringRef
{
name
,
namelen
},
StringRef
{
value
,
valuelen
},
flags
&
NGHTTP2_NV_FLAG_NO_INDEX
,
token
);
return
0
;
}
...
...
src/shrpx_http2_upstream.cc
View file @
3ff14881
...
...
@@ -205,12 +205,12 @@ int on_header_callback(nghttp2_session *session, const nghttp2_frame *frame,
if
(
frame
->
headers
.
cat
==
NGHTTP2_HCAT_HEADERS
)
{
// just store header fields for trailer part
req
.
fs
.
add_trailer
(
name
,
namelen
,
value
,
valuelen
,
req
.
fs
.
add_trailer
(
StringRef
{
name
,
namelen
},
StringRef
{
value
,
valuelen
}
,
flags
&
NGHTTP2_NV_FLAG_NO_INDEX
,
token
);
return
0
;
}
req
.
fs
.
add_header
(
name
,
namelen
,
value
,
valuelen
,
req
.
fs
.
add_header
(
StringRef
{
name
,
namelen
},
StringRef
{
value
,
valuelen
}
,
flags
&
NGHTTP2_NV_FLAG_NO_INDEX
,
token
);
return
0
;
}
...
...
@@ -593,7 +593,8 @@ int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame,
req
.
path
=
http2
::
rewrite_clean_path
(
nv
.
value
,
nv
.
value
+
nv
.
valuelen
);
break
;
}
req
.
fs
.
add_header
(
nv
.
name
,
nv
.
namelen
,
nv
.
value
,
nv
.
valuelen
,
req
.
fs
.
add_header
(
StringRef
{
nv
.
name
,
nv
.
namelen
},
StringRef
{
nv
.
value
,
nv
.
valuelen
},
nv
.
flags
&
NGHTTP2_NV_FLAG_NO_INDEX
,
token
);
}
...
...
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