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
9b35b6f7
Commit
9b35b6f7
authored
Aug 12, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce a function to extract a header from OA_HEADER
parent
d9a6da6d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
20 deletions
+58
-20
cache.h
bin/varnishd/cache/cache.h
+2
-0
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+7
-19
cache_http.c
bin/varnishd/cache/cache_http.c
+48
-0
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+1
-1
No files found.
bin/varnishd/cache/cache.h
View file @
9b35b6f7
...
@@ -983,6 +983,8 @@ void http_MarkHeader(const struct http *, const char *hdr, unsigned hdrlen,
...
@@ -983,6 +983,8 @@ void http_MarkHeader(const struct http *, const char *hdr, unsigned hdrlen,
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
(
const
struct
http
*
fm
,
struct
http
*
to
);
const
char
*
HTTP_GetHdrPack
(
struct
objcore
*
,
struct
dstat
*
,
const
char
*
hdr
);
/* cache_http1_proto.c */
/* cache_http1_proto.c */
...
...
bin/varnishd/cache/cache_fetch.c
View file @
9b35b6f7
...
@@ -176,7 +176,7 @@ vbf_beresp2obj(struct busyobj *bo)
...
@@ -176,7 +176,7 @@ vbf_beresp2obj(struct busyobj *bo)
static
enum
fetch_step
static
enum
fetch_step
vbf_stp_mkbereq
(
const
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
vbf_stp_mkbereq
(
const
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
{
{
c
har
*
p
;
c
onst
char
*
q
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
...
@@ -202,14 +202,14 @@ vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo)
...
@@ -202,14 +202,14 @@ vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo)
}
}
if
(
bo
->
ims_oc
!=
NULL
)
{
if
(
bo
->
ims_oc
!=
NULL
)
{
if
(
http_GetHdr
(
bo
->
ims_obj
->
http
,
H_Last_Modified
,
&
p
))
{
q
=
HTTP_GetHdrPack
(
bo
->
ims_oc
,
bo
->
stats
,
H_Last_Modified
);
if
(
q
!=
NULL
)
http_PrintfHeader
(
bo
->
bereq0
,
http_PrintfHeader
(
bo
->
bereq0
,
"If-Modified-Since: %s"
,
p
);
"If-Modified-Since: %s"
,
q
);
}
q
=
HTTP_GetHdrPack
(
bo
->
ims_oc
,
bo
->
stats
,
H_ETag
);
if
(
http_GetHdr
(
bo
->
ims_obj
->
http
,
H_ETag
,
&
p
))
{
if
(
q
!=
NULL
)
http_PrintfHeader
(
bo
->
bereq0
,
http_PrintfHeader
(
bo
->
bereq0
,
"If-None-Match: %s"
,
p
);
"If-None-Match: %s"
,
q
);
}
}
}
HTTP_Setup
(
bo
->
bereq
,
bo
->
ws
,
bo
->
vsl
,
SLT_BereqMethod
);
HTTP_Setup
(
bo
->
bereq
,
bo
->
ws
,
bo
->
vsl
,
SLT_BereqMethod
);
...
@@ -568,22 +568,10 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
...
@@ -568,22 +568,10 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
uint64_t
ol
;
uint64_t
ol
;
struct
storage
*
st
;
struct
storage
*
st
;
enum
objiter_status
ois
;
enum
objiter_status
ois
;
char
*
p
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
if
(
ObjCheckFlag
(
bo
->
ims_oc
,
bo
->
stats
,
OF_CHGGZIP
))
{
/*
* If we modified the gzip status of the IMS object, that
* must control the C-E header, if any.
*/
http_Unset
(
bo
->
beresp
,
H_Content_Encoding
);
if
(
http_GetHdr
(
bo
->
ims_obj
->
http
,
H_Content_Encoding
,
&
p
))
http_PrintfHeader
(
bo
->
beresp
,
"Content-Encoding: %s"
,
p
);
}
AZ
(
vbf_beresp2obj
(
bo
));
AZ
(
vbf_beresp2obj
(
bo
));
if
(
ObjGetattr
(
bo
->
ims_oc
,
bo
->
stats
,
OA_ESIDATA
,
NULL
)
!=
NULL
)
if
(
ObjGetattr
(
bo
->
ims_oc
,
bo
->
stats
,
OA_ESIDATA
,
NULL
)
!=
NULL
)
...
...
bin/varnishd/cache/cache_http.c
View file @
9b35b6f7
...
@@ -721,6 +721,54 @@ HTTP_Decode(struct http *to, uint8_t *fm)
...
@@ -721,6 +721,54 @@ HTTP_Decode(struct http *to, uint8_t *fm)
return
(
-
1
);
return
(
-
1
);
}
}
/*--------------------------------------------------------------------*/
const
char
*
HTTP_GetHdrPack
(
struct
objcore
*
oc
,
struct
dstat
*
ds
,
const
char
*
hdr
)
{
char
*
ptr
;
unsigned
l
;
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
AN
(
ds
);
AN
(
hdr
);
l
=
hdr
[
0
];
assert
(
l
==
strlen
(
hdr
+
1
));
assert
(
hdr
[
l
]
==
':'
);
hdr
++
;
ptr
=
ObjGetattr
(
oc
,
ds
,
OA_HEADERS
,
NULL
);
AN
(
ptr
);
/* Skip nhd and status */
ptr
+=
4
;
VSL
(
SLT_Debug
,
0
,
"%d %s"
,
__LINE__
,
ptr
);
/* Skip PROTO, STATUS and REASON */
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
VSL
(
SLT_Debug
,
0
,
"%d %s"
,
__LINE__
,
ptr
);
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
VSL
(
SLT_Debug
,
0
,
"%d %s"
,
__LINE__
,
ptr
);
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
VSL
(
SLT_Debug
,
0
,
"%d %s"
,
__LINE__
,
ptr
);
while
(
*
ptr
!=
'\0'
)
{
VSL
(
SLT_Debug
,
0
,
"%d <%s> %u <%s>"
,
__LINE__
,
ptr
,
l
,
hdr
);
if
(
!
strncasecmp
(
ptr
,
hdr
,
l
))
{
ptr
+=
l
;
assert
(
vct_issp
(
*
ptr
));
ptr
++
;
assert
(
!
vct_issp
(
*
ptr
));
return
(
ptr
);
}
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
VSL
(
SLT_Debug
,
0
,
"%d %s"
,
__LINE__
,
ptr
);
}
return
(
NULL
);
}
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
static
void
static
void
...
...
bin/varnishd/cache/cache_req_fsm.c
View file @
9b35b6f7
...
@@ -105,7 +105,7 @@ cnt_deliver(struct worker *wrk, struct req *req)
...
@@ -105,7 +105,7 @@ cnt_deliver(struct worker *wrk, struct req *req)
EXP_Touch
(
req
->
objcore
,
req
->
t_prev
);
EXP_Touch
(
req
->
objcore
,
req
->
t_prev
);
HTTP_Setup
(
req
->
resp
,
req
->
ws
,
req
->
vsl
,
SLT_RespMethod
);
HTTP_Setup
(
req
->
resp
,
req
->
ws
,
req
->
vsl
,
SLT_RespMethod
);
AZ
(
HTTP_Decode
(
req
->
resp
,
AZ
(
HTTP_Decode
(
req
->
resp
,
ObjGetattr
(
req
->
objcore
,
&
req
->
wrk
->
stats
,
OA_HEADERS
,
NULL
)));
ObjGetattr
(
req
->
objcore
,
&
req
->
wrk
->
stats
,
OA_HEADERS
,
NULL
)));
http_ForceField
(
req
->
resp
,
HTTP_HDR_PROTO
,
"HTTP/1.1"
);
http_ForceField
(
req
->
resp
,
HTTP_HDR_PROTO
,
"HTTP/1.1"
);
...
...
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