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
825c1bac
Commit
825c1bac
authored
Sep 24, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shrpx_downstream.cc: Utilize std::move
parent
dc0af2e0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
27 deletions
+25
-27
src/shrpx_downstream.cc
src/shrpx_downstream.cc
+17
-19
src/shrpx_downstream.h
src/shrpx_downstream.h
+6
-6
src/shrpx_http2_upstream.cc
src/shrpx_http2_upstream.cc
+1
-1
src/shrpx_spdy_upstream.cc
src/shrpx_spdy_upstream.cc
+1
-1
No files found.
src/shrpx_downstream.cc
View file @
825c1bac
...
...
@@ -190,18 +190,17 @@ Headers::const_iterator Downstream::get_norm_request_header
return
get_norm_header
(
request_headers_
,
name
);
}
void
Downstream
::
add_request_header
(
const
std
::
string
&
name
,
const
std
::
string
&
value
)
void
Downstream
::
add_request_header
(
std
::
string
name
,
std
::
string
value
)
{
request_header_key_prev_
=
true
;
request_headers_
.
push_back
(
std
::
make_pair
(
name
,
value
));
request_headers_
.
emplace_back
(
std
::
move
(
name
),
std
::
move
(
value
));
}
void
Downstream
::
set_last_request_header_value
(
const
std
::
string
&
value
)
void
Downstream
::
set_last_request_header_value
(
std
::
string
value
)
{
request_header_key_prev_
=
false
;
Headers
::
value_type
&
item
=
request_headers_
.
back
();
item
.
second
=
value
;
item
.
second
=
std
::
move
(
value
)
;
check_transfer_encoding_chunked
(
&
chunked_request_
,
item
);
check_expect_100_continue
(
&
request_expect_100_continue_
,
item
);
}
...
...
@@ -214,20 +213,20 @@ bool Downstream::get_request_header_key_prev() const
void
Downstream
::
append_last_request_header_key
(
const
char
*
data
,
size_t
len
)
{
assert
(
request_header_key_prev_
);
Headers
::
value_type
&
item
=
request_headers_
.
back
();
auto
&
item
=
request_headers_
.
back
();
item
.
first
.
append
(
data
,
len
);
}
void
Downstream
::
append_last_request_header_value
(
const
char
*
data
,
size_t
len
)
{
assert
(
!
request_header_key_prev_
);
Headers
::
value_type
&
item
=
request_headers_
.
back
();
auto
&
item
=
request_headers_
.
back
();
item
.
second
.
append
(
data
,
len
);
}
void
Downstream
::
set_request_method
(
const
std
::
string
&
method
)
void
Downstream
::
set_request_method
(
std
::
string
method
)
{
request_method_
=
method
;
request_method_
=
std
::
move
(
method
)
;
}
const
std
::
string
&
Downstream
::
get_request_method
()
const
...
...
@@ -235,9 +234,9 @@ const std::string& Downstream::get_request_method() const
return
request_method_
;
}
void
Downstream
::
set_request_path
(
const
std
::
string
&
path
)
void
Downstream
::
set_request_path
(
std
::
string
path
)
{
request_path_
=
path
;
request_path_
=
std
::
move
(
path
)
;
}
void
Downstream
::
append_request_path
(
const
char
*
data
,
size_t
len
)
...
...
@@ -372,20 +371,19 @@ Headers::const_iterator Downstream::get_norm_response_header
return
get_norm_header
(
response_headers_
,
name
);
}
void
Downstream
::
add_response_header
(
const
std
::
string
&
name
,
const
std
::
string
&
value
)
void
Downstream
::
add_response_header
(
std
::
string
name
,
std
::
string
value
)
{
response_header_key_prev_
=
true
;
response_headers_
.
push_back
(
std
::
make_pair
(
name
,
value
));
response_headers_
.
emplace_back
(
std
::
move
(
name
),
std
::
move
(
value
));
check_transfer_encoding_chunked
(
&
chunked_response_
,
response_headers_
.
back
());
}
void
Downstream
::
set_last_response_header_value
(
const
std
::
string
&
value
)
void
Downstream
::
set_last_response_header_value
(
std
::
string
value
)
{
response_header_key_prev_
=
false
;
Headers
::
value_type
&
item
=
response_headers_
.
back
();
item
.
second
=
value
;
auto
&
item
=
response_headers_
.
back
();
item
.
second
=
std
::
move
(
value
)
;
check_transfer_encoding_chunked
(
&
chunked_response_
,
item
);
}
...
...
@@ -397,7 +395,7 @@ bool Downstream::get_response_header_key_prev() const
void
Downstream
::
append_last_response_header_key
(
const
char
*
data
,
size_t
len
)
{
assert
(
response_header_key_prev_
);
Headers
::
value_type
&
item
=
response_headers_
.
back
();
auto
&
item
=
response_headers_
.
back
();
item
.
first
.
append
(
data
,
len
);
}
...
...
@@ -405,7 +403,7 @@ void Downstream::append_last_response_header_value(const char *data,
size_t
len
)
{
assert
(
!
response_header_key_prev_
);
Headers
::
value_type
&
item
=
response_headers_
.
back
();
auto
&
item
=
response_headers_
.
back
();
item
.
second
.
append
(
data
,
len
);
}
...
...
src/shrpx_downstream.h
View file @
825c1bac
...
...
@@ -93,16 +93,16 @@ public:
// called after calling normalize_request_headers().
Headers
::
const_iterator
get_norm_request_header
(
const
std
::
string
&
name
)
const
;
void
add_request_header
(
const
std
::
string
&
name
,
const
std
::
string
&
value
);
void
set_last_request_header_value
(
const
std
::
string
&
value
);
void
add_request_header
(
std
::
string
name
,
std
::
string
value
);
void
set_last_request_header_value
(
std
::
string
value
);
bool
get_request_header_key_prev
()
const
;
void
append_last_request_header_key
(
const
char
*
data
,
size_t
len
);
void
append_last_request_header_value
(
const
char
*
data
,
size_t
len
);
void
set_request_method
(
const
std
::
string
&
method
);
void
set_request_method
(
std
::
string
method
);
const
std
::
string
&
get_request_method
()
const
;
void
set_request_path
(
const
std
::
string
&
path
);
void
set_request_path
(
std
::
string
path
);
void
append_request_path
(
const
char
*
data
,
size_t
len
);
const
std
::
string
&
get_request_path
()
const
;
void
set_request_major
(
int
major
);
...
...
@@ -138,8 +138,8 @@ public:
// called after calling normalize_response_headers().
Headers
::
const_iterator
get_norm_response_header
(
const
std
::
string
&
name
)
const
;
void
add_response_header
(
const
std
::
string
&
name
,
const
std
::
string
&
value
);
void
set_last_response_header_value
(
const
std
::
string
&
value
);
void
add_response_header
(
std
::
string
name
,
std
::
string
value
);
void
set_last_response_header_value
(
std
::
string
value
);
bool
get_response_header_key_prev
()
const
;
void
append_last_response_header_key
(
const
char
*
data
,
size_t
len
);
...
...
src/shrpx_http2_upstream.cc
View file @
825c1bac
...
...
@@ -261,7 +261,7 @@ int on_frame_recv_callback
reqpath
+=
"://"
;
reqpath
+=
http2
::
value_to_str
(
host
);
reqpath
+=
http2
::
value_to_str
(
path
);
downstream
->
set_request_path
(
reqpath
);
downstream
->
set_request_path
(
std
::
move
(
reqpath
)
);
}
else
{
downstream
->
set_request_path
(
http2
::
value_to_str
(
path
));
}
...
...
src/shrpx_spdy_upstream.cc
View file @
825c1bac
...
...
@@ -204,7 +204,7 @@ void on_ctrl_recv_callback
reqpath
+=
"://"
;
reqpath
+=
host
;
reqpath
+=
path
;
downstream
->
set_request_path
(
reqpath
);
downstream
->
set_request_path
(
std
::
move
(
reqpath
)
);
}
else
{
downstream
->
set_request_path
(
path
);
}
...
...
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