Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
b5824163
Commit
b5824163
authored
Aug 12, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite http_Merge() to pull from OA_HEADERS
parent
9b35b6f7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
40 deletions
+38
-40
cache.h
bin/varnishd/cache/cache.h
+1
-2
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+1
-1
cache_http.c
bin/varnishd/cache/cache_http.c
+36
-37
No files found.
bin/varnishd/cache/cache.h
View file @
b5824163
...
@@ -185,7 +185,6 @@ struct http {
...
@@ -185,7 +185,6 @@ struct http {
txt
*
hd
;
txt
*
hd
;
unsigned
char
*
hdf
;
unsigned
char
*
hdf
;
#define HDF_FILTER (1 << 0)
/* Filtered by Connection */
#define HDF_FILTER (1 << 0)
/* Filtered by Connection */
#define HDF_MARKER (1 << 1)
/* Marker bit */
/* NB: ->nhd and below zeroed/initialized by http_Teardown */
/* NB: ->nhd and below zeroed/initialized by http_Teardown */
uint16_t
nhd
;
/* Next free hd */
uint16_t
nhd
;
/* Next free hd */
...
@@ -982,7 +981,7 @@ void http_MarkHeader(const struct http *, const char *hdr, unsigned hdrlen,
...
@@ -982,7 +981,7 @@ void http_MarkHeader(const struct http *, const char *hdr, unsigned hdrlen,
uint8_t
flag
);
uint8_t
flag
);
void
http_CollectHdr
(
struct
http
*
hp
,
const
char
*
hdr
);
void
http_CollectHdr
(
struct
http
*
hp
,
const
char
*
hdr
);
void
http_VSL_log
(
const
struct
http
*
hp
);
void
http_VSL_log
(
const
struct
http
*
hp
);
void
http_Merge
(
const
struct
http
*
fm
,
struct
http
*
to
);
void
HTTP_Merge
(
struct
objcore
*
,
struct
dstat
*
,
struct
http
*
to
);
const
char
*
HTTP_GetHdrPack
(
struct
objcore
*
,
struct
dstat
*
,
const
char
*
HTTP_GetHdrPack
(
struct
objcore
*
,
struct
dstat
*
,
const
char
*
hdr
);
const
char
*
hdr
);
...
...
bin/varnishd/cache/cache_fetch.c
View file @
b5824163
...
@@ -359,7 +359,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
...
@@ -359,7 +359,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
http_Unset
(
bo
->
beresp
,
H_Content_Encoding
);
http_Unset
(
bo
->
beresp
,
H_Content_Encoding
);
RFC2616_Weaken_Etag
(
bo
->
beresp
);
RFC2616_Weaken_Etag
(
bo
->
beresp
);
}
}
http_Merge
(
bo
->
ims_obj
->
http
,
bo
->
beresp
);
HTTP_Merge
(
bo
->
ims_oc
,
bo
->
stats
,
bo
->
beresp
);
assert
(
http_IsStatus
(
bo
->
beresp
,
200
));
assert
(
http_IsStatus
(
bo
->
beresp
,
200
));
do_ims
=
1
;
do_ims
=
1
;
}
else
}
else
...
...
bin/varnishd/cache/cache_http.c
View file @
b5824163
...
@@ -726,7 +726,7 @@ HTTP_Decode(struct http *to, uint8_t *fm)
...
@@ -726,7 +726,7 @@ HTTP_Decode(struct http *to, uint8_t *fm)
const
char
*
const
char
*
HTTP_GetHdrPack
(
struct
objcore
*
oc
,
struct
dstat
*
ds
,
const
char
*
hdr
)
HTTP_GetHdrPack
(
struct
objcore
*
oc
,
struct
dstat
*
ds
,
const
char
*
hdr
)
{
{
char
*
ptr
;
c
onst
c
har
*
ptr
;
unsigned
l
;
unsigned
l
;
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
...
@@ -746,14 +746,10 @@ HTTP_GetHdrPack(struct objcore *oc, struct dstat *ds, const char *hdr)
...
@@ -746,14 +746,10 @@ HTTP_GetHdrPack(struct objcore *oc, struct dstat *ds, const char *hdr)
/* Skip PROTO, STATUS and REASON */
/* Skip PROTO, STATUS and REASON */
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
VSL
(
SLT_Debug
,
0
,
"%d %s"
,
__LINE__
,
ptr
);
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
VSL
(
SLT_Debug
,
0
,
"%d %s"
,
__LINE__
,
ptr
);
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
VSL
(
SLT_Debug
,
0
,
"%d %s"
,
__LINE__
,
ptr
);
while
(
*
ptr
!=
'\0'
)
{
while
(
*
ptr
!=
'\0'
)
{
VSL
(
SLT_Debug
,
0
,
"%d <%s> %u <%s>"
,
__LINE__
,
ptr
,
l
,
hdr
);
if
(
!
strncasecmp
(
ptr
,
hdr
,
l
))
{
if
(
!
strncasecmp
(
ptr
,
hdr
,
l
))
{
ptr
+=
l
;
ptr
+=
l
;
assert
(
vct_issp
(
*
ptr
));
assert
(
vct_issp
(
*
ptr
));
...
@@ -762,12 +758,46 @@ HTTP_GetHdrPack(struct objcore *oc, struct dstat *ds, const char *hdr)
...
@@ -762,12 +758,46 @@ HTTP_GetHdrPack(struct objcore *oc, struct dstat *ds, const char *hdr)
return
(
ptr
);
return
(
ptr
);
}
}
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
VSL
(
SLT_Debug
,
0
,
"%d %s"
,
__LINE__
,
ptr
);
}
}
return
(
NULL
);
return
(
NULL
);
}
}
/*--------------------------------------------------------------------
* Merge any headers in the oc->OA_HEADER into the struct http if they
* are not there already.
*/
void
HTTP_Merge
(
struct
objcore
*
oc
,
struct
dstat
*
ds
,
struct
http
*
to
)
{
const
char
*
ptr
;
unsigned
u
;
const
char
*
p
;
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
CHECK_OBJ_NOTNULL
(
to
,
HTTP_MAGIC
);
AN
(
ds
);
ptr
=
ObjGetattr
(
oc
,
ds
,
OA_HEADERS
,
NULL
);
AN
(
ptr
);
to
->
status
=
vbe16dec
(
ptr
+
2
);
ptr
+=
4
;
for
(
u
=
0
;
u
<
HTTP_HDR_FIRST
;
u
++
)
{
if
(
u
==
HTTP_HDR_METHOD
||
u
==
HTTP_HDR_URL
)
continue
;
http_SetH
(
to
,
u
,
ptr
);
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
}
while
(
*
ptr
!=
'\0'
)
{
p
=
strchr
(
ptr
,
':'
);
AN
(
p
);
if
(
!
http_findhdr
(
to
,
p
-
ptr
,
ptr
))
http_SetHeader
(
to
,
ptr
);
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
}
}
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
...
@@ -826,37 +856,6 @@ http_FilterReq(struct http *to, const struct http *fm, unsigned how)
...
@@ -826,37 +856,6 @@ http_FilterReq(struct http *to, const struct http *fm, unsigned how)
http_filterfields
(
to
,
fm
,
how
);
http_filterfields
(
to
,
fm
,
how
);
}
}
/*--------------------------------------------------------------------
* Merge two HTTP headers the "wrong" way. Used by backend IMS to
* merge in the headers of the validated object with the headers of
* the 304 response.
*/
void
http_Merge
(
const
struct
http
*
fm
,
struct
http
*
to
)
{
unsigned
u
,
v
;
const
char
*
p
;
to
->
status
=
fm
->
status
;
http_linkh
(
to
,
fm
,
HTTP_HDR_PROTO
);
http_linkh
(
to
,
fm
,
HTTP_HDR_STATUS
);
http_linkh
(
to
,
fm
,
HTTP_HDR_REASON
);
for
(
u
=
HTTP_HDR_FIRST
;
u
<
fm
->
nhd
;
u
++
)
fm
->
hdf
[
u
]
|=
HDF_MARKER
;
for
(
v
=
HTTP_HDR_FIRST
;
v
<
to
->
nhd
;
v
++
)
{
p
=
strchr
(
to
->
hd
[
v
].
b
,
':'
);
AN
(
p
);
u
=
http_findhdr
(
fm
,
p
-
to
->
hd
[
v
].
b
,
to
->
hd
[
v
].
b
);
if
(
u
)
fm
->
hdf
[
u
]
&=
~
HDF_MARKER
;
}
for
(
u
=
HTTP_HDR_FIRST
;
u
<
fm
->
nhd
;
u
++
)
if
(
fm
->
hdf
[
u
]
&
HDF_MARKER
)
http_SetHeader
(
to
,
fm
->
hd
[
u
].
b
);
}
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
* This function copies any header fields which reference foreign
* This function copies any header fields which reference foreign
* storage into our own WS.
* storage into our own WS.
...
...
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