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
e19d5efc
Commit
e19d5efc
authored
Sep 05, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Allow absolute URI in Link header field for push
parent
6b38f7e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
18 deletions
+32
-18
doc/nghttpx.h2r
doc/nghttpx.h2r
+3
-8
src/shrpx_http2_upstream.cc
src/shrpx_http2_upstream.cc
+26
-9
src/shrpx_http2_upstream.h
src/shrpx_http2_upstream.h
+3
-1
No files found.
doc/nghttpx.h2r
View file @
e19d5efc
...
...
@@ -59,17 +59,12 @@ header field to initiate server push:
Link: </fonts/font.woff>; rel=preload
Link: </css/theme.css>; rel=preload
Currently, the following restriction
s are
applied for server push:
Currently, the following restriction
is
applied for server push:
1. URI-reference must not contain authority. If it exists, it is not
pushed. ``/fonts/font.woff`` and ``css/theme.css`` are eligible to
be pushed. ``https://example.org/fonts/font.woff`` and
``//example.org/css/theme.css`` are not.
2. The associated stream must have method "GET" or "POST". The
1. The associated stream must have method "GET" or "POST". The
associated stream's status code must be 200.
Th
ese limitations
may be loosened in the future release.
Th
is limitation
may be loosened in the future release.
UNIX DOMAIN SOCKET
------------------
...
...
src/shrpx_http2_upstream.cc
View file @
e19d5efc
...
...
@@ -1501,6 +1501,7 @@ int Http2Upstream::prepare_push_promise(Downstream *downstream) {
const
char
*
relq
=
nullptr
;
size_t
relqlen
=
0
;
std
::
string
authority
,
scheme
;
http_parser_url
v
{};
rv
=
http_parser_parse_url
(
link_url
,
link_urllen
,
0
,
&
v
);
if
(
rv
!=
0
)
{
...
...
@@ -1518,9 +1519,18 @@ int Http2Upstream::prepare_push_promise(Downstream *downstream) {
relqlen
=
end
-
relq
;
}
}
else
{
if
(
v
.
field_set
&
(
1
<<
UF_SCHEMA
))
{
http2
::
copy_url_component
(
scheme
,
&
v
,
UF_SCHEMA
,
link_url
);
}
if
(
v
.
field_set
&
(
1
<<
UF_HOST
))
{
continue
;
http2
::
copy_url_component
(
authority
,
&
v
,
UF_HOST
,
link_url
);
if
(
v
.
field_set
&
(
1
<<
UF_PORT
))
{
authority
+=
":"
;
authority
+=
util
::
utos
(
v
.
port
);
}
}
if
(
v
.
field_set
&
(
1
<<
UF_PATH
))
{
auto
&
f
=
v
.
field_data
[
UF_PATH
];
rel
=
link_url
+
f
.
off
;
...
...
@@ -1536,9 +1546,18 @@ int Http2Upstream::prepare_push_promise(Downstream *downstream) {
relqlen
=
f
.
len
;
}
}
if
(
scheme
.
empty
())
{
scheme
=
downstream
->
get_request_http2_scheme
();
}
if
(
authority
.
empty
())
{
authority
=
downstream
->
get_request_http2_authority
();
}
auto
path
=
http2
::
path_join
(
base
,
baselen
,
nullptr
,
0
,
rel
,
rellen
,
relq
,
relqlen
);
rv
=
submit_push_promise
(
path
,
downstream
);
rv
=
submit_push_promise
(
scheme
,
authority
,
path
,
downstream
);
if
(
rv
!=
0
)
{
return
-
1
;
}
...
...
@@ -1547,7 +1566,9 @@ int Http2Upstream::prepare_push_promise(Downstream *downstream) {
return
0
;
}
int
Http2Upstream
::
submit_push_promise
(
const
std
::
string
&
path
,
int
Http2Upstream
::
submit_push_promise
(
const
std
::
string
&
scheme
,
const
std
::
string
&
authority
,
const
std
::
string
&
path
,
Downstream
*
downstream
)
{
int
rv
;
std
::
vector
<
nghttp2_nv
>
nva
;
...
...
@@ -1555,13 +1576,9 @@ int Http2Upstream::submit_push_promise(const std::string &path,
// juse use "GET" for now
nva
.
push_back
(
http2
::
make_nv_ll
(
":method"
,
"GET"
));
nva
.
push_back
(
http2
::
make_nv_ls
(
":scheme"
,
downstream
->
get_request_http2_scheme
()));
nva
.
push_back
(
http2
::
make_nv_ls
(
":scheme"
,
scheme
));
nva
.
push_back
(
http2
::
make_nv_ls
(
":path"
,
path
));
auto
&
authority
=
downstream
->
get_request_http2_authority
();
if
(
!
authority
.
empty
())
{
nva
.
push_back
(
http2
::
make_nv_ls
(
":authority"
,
authority
));
}
nva
.
push_back
(
http2
::
make_nv_ls
(
":authority"
,
authority
));
for
(
auto
&
kv
:
downstream
->
get_request_headers
())
{
switch
(
kv
.
token
)
{
...
...
src/shrpx_http2_upstream.h
View file @
e19d5efc
...
...
@@ -96,7 +96,9 @@ public:
void
check_shutdown
();
int
prepare_push_promise
(
Downstream
*
downstream
);
int
submit_push_promise
(
const
std
::
string
&
path
,
Downstream
*
downstream
);
int
submit_push_promise
(
const
std
::
string
&
scheme
,
const
std
::
string
&
authority
,
const
std
::
string
&
path
,
Downstream
*
downstream
);
int
on_request_headers
(
Downstream
*
downstream
,
const
nghttp2_frame
*
frame
);
...
...
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