Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
2bbb032b
Commit
2bbb032b
authored
Jan 30, 2013
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split absolute URIs into URL and Host: as per RFC2616 5.2
Fixes #1255
parent
054fd6a6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
cache_http1_proto.c
bin/varnishd/cache/cache_http1_proto.c
+17
-0
r01255.vtc
bin/varnishtest/tests/r01255.vtc
+19
-0
No files found.
bin/varnishd/cache/cache_http1_proto.c
View file @
2bbb032b
...
...
@@ -389,12 +389,15 @@ htc_proto_ver(struct http *hp)
/*--------------------------------------------------------------------*/
#include <stdio.h>
uint16_t
HTTP1_DissectRequest
(
struct
req
*
req
)
{
struct
http_conn
*
htc
;
struct
http
*
hp
;
uint16_t
retval
;
char
*
b
,
*
e
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
htc
=
req
->
htc
;
...
...
@@ -408,8 +411,22 @@ HTTP1_DissectRequest(struct req *req)
return
(
retval
);
}
htc_proto_ver
(
hp
);
/* RFC2616, section 5.2, point 1 */
if
(
!
strncasecmp
(
hp
->
hd
[
HTTP_HDR_URL
].
b
,
"http://"
,
7
))
{
b
=
e
=
hp
->
hd
[
HTTP_HDR_URL
].
b
+
7
;
while
(
*
e
!=
'/'
&&
*
e
!=
'\0'
)
e
++
;
if
(
*
e
==
'/'
)
{
http_Unset
(
hp
,
H_Host
);
http_PrintfHeader
(
hp
,
"Host: %.*s"
,
(
int
)(
e
-
b
),
b
);
hp
->
hd
[
HTTP_HDR_URL
].
b
=
e
;
}
}
return
(
retval
);
}
/*--------------------------------------------------------------------*/
uint16_t
...
...
bin/varnishtest/tests/r01255.vtc
0 → 100644
View file @
2bbb032b
varnishtest "Test RFC2616 5.2 compliance"
server s1 {
rxreq
txresp -hdr "Foo: 1"
} -start
varnish v1 -vcl+backend {
sub vcl_deliver {
set resp.http.rxhost = req.http.host;
}
} -start
client c1 {
txreq -url http://www.example.com/bar
rxresp
expect resp.http.rxhost == www.example.com
} -run
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