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
cbd7675a
Commit
cbd7675a
authored
Oct 21, 2019
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid setting the http response twice via http_PutResponse()
parent
084cd13e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
11 deletions
+11
-11
cache.h
bin/varnishd/cache/cache.h
+1
-1
cache_http.c
bin/varnishd/cache/cache_http.c
+7
-6
cache_vrt_var.c
bin/varnishd/cache/cache_vrt_var.c
+1
-1
cache_http1_proto.c
bin/varnishd/http1/cache_http1_proto.c
+1
-1
c00018.vtc
bin/varnishtest/tests/c00018.vtc
+1
-2
No files found.
bin/varnishd/cache/cache.h
View file @
cbd7675a
...
...
@@ -628,7 +628,7 @@ double http_GetHdrQ(const struct http *hp, const char *hdr, const char *field);
ssize_t
http_GetContentLength
(
const
struct
http
*
hp
);
uint16_t
http_GetStatus
(
const
struct
http
*
hp
);
int
http_IsStatus
(
const
struct
http
*
hp
,
int
);
void
http_SetStatus
(
struct
http
*
to
,
uint16_t
status
);
void
http_SetStatus
(
struct
http
*
to
,
uint16_t
status
,
const
char
*
reason
);
const
char
*
http_GetMethod
(
const
struct
http
*
hp
);
int
http_HdrIs
(
const
struct
http
*
hp
,
const
char
*
hdr
,
const
char
*
val
);
void
http_CopyHome
(
const
struct
http
*
hp
);
...
...
bin/varnishd/cache/cache_http.c
View file @
cbd7675a
...
...
@@ -798,10 +798,9 @@ http_IsStatus(const struct http *hp, int val)
*/
void
http_SetStatus
(
struct
http
*
to
,
uint16_t
status
)
http_SetStatus
(
struct
http
*
to
,
uint16_t
status
,
const
char
*
reason
)
{
char
buf
[
4
];
const
char
*
reason
;
const
char
*
sstr
=
NULL
;
CHECK_OBJ_NOTNULL
(
to
,
HTTP_MAGIC
);
...
...
@@ -813,7 +812,11 @@ http_SetStatus(struct http *to, uint16_t status)
status
%=
1000
;
assert
(
status
>=
100
);
reason
=
http_Status2Reason
(
status
,
&
sstr
);
if
(
reason
==
NULL
)
reason
=
http_Status2Reason
(
status
,
&
sstr
);
else
(
void
)
http_Status2Reason
(
status
,
&
sstr
);
if
(
sstr
)
{
http_SetH
(
to
,
HTTP_HDR_STATUS
,
sstr
);
}
else
{
...
...
@@ -865,9 +868,7 @@ http_PutResponse(struct http *to, const char *proto, uint16_t status,
CHECK_OBJ_NOTNULL
(
to
,
HTTP_MAGIC
);
if
(
proto
!=
NULL
)
http_SetH
(
to
,
HTTP_HDR_PROTO
,
proto
);
http_SetStatus
(
to
,
status
);
if
(
reason
!=
NULL
)
http_SetH
(
to
,
HTTP_HDR_REASON
,
reason
);
http_SetStatus
(
to
,
status
,
reason
);
}
/*--------------------------------------------------------------------
...
...
bin/varnishd/cache/cache_vrt_var.c
View file @
cbd7675a
...
...
@@ -108,7 +108,7 @@ VRT_l_##obj##_status(VRT_CTX, VCL_INT num) \
VRT_fail(ctx, "illegal %s.status (%jd) (..0##)", \
#obj, (intmax_t)num); \
else \
http_SetStatus(ctx->http_##obj, (uint16_t)num
);
\
http_SetStatus(ctx->http_##obj, (uint16_t)num
, NULL);
\
}
#define VRT_STATUS_R(obj) \
...
...
bin/varnishd/http1/cache_http1_proto.c
View file @
cbd7675a
...
...
@@ -453,7 +453,7 @@ HTTP1_DissectResponse(struct http_conn *htc, struct http *hp,
(
int
)(
htc
->
rxbuf_e
-
htc
->
rxbuf_b
),
htc
->
rxbuf_b
);
assert
(
retval
>=
100
&&
retval
<=
999
);
assert
(
retval
==
503
);
http_SetStatus
(
hp
,
503
);
http_SetStatus
(
hp
,
503
,
NULL
);
}
if
(
hp
->
hd
[
HTTP_HDR_REASON
].
b
==
NULL
||
...
...
bin/varnishtest/tests/c00018.vtc
View file @
cbd7675a
...
...
@@ -125,8 +125,7 @@ logexpect l1 -v v1 -g raw {
expect 0 1011 RespProtocol {^HTTP/1.1$}
expect 0 1011 RespStatus {^405$}
expect 0 1011 RespReason {^Method Not Allowed$}
# XXX dup RespReason
expect 1 1011 RespHeader {^Date:}
expect 0 1011 RespHeader {^Date:}
expect 0 1011 RespHeader {^Server: Varnish$}
expect 0 1011 RespHeader {^X-Varnish: 1011$}
expect * 1011 Timestamp {^Process:}
...
...
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