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
bb603b3d
Commit
bb603b3d
authored
Jun 10, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce a dedicated http_SetStatus() function.
parent
69600783
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
13 deletions
+28
-13
cache.h
bin/varnishd/cache/cache.h
+1
-0
cache_http.c
bin/varnishd/cache/cache_http.c
+24
-11
cache_vrt_var.c
bin/varnishd/cache/cache_vrt_var.c
+3
-2
No files found.
bin/varnishd/cache/cache.h
View file @
bb603b3d
...
...
@@ -1001,6 +1001,7 @@ int http_GetHdrField(const struct http *hp, const char *hdr,
const
char
*
field
,
char
**
ptr
);
double
http_GetHdrQ
(
const
struct
http
*
hp
,
const
char
*
hdr
,
const
char
*
field
);
uint16_t
http_GetStatus
(
const
struct
http
*
hp
);
void
http_SetStatus
(
struct
http
*
to
,
uint16_t
status
);
const
char
*
http_GetReq
(
const
struct
http
*
hp
);
int
http_HdrIs
(
const
struct
http
*
hp
,
const
char
*
hdr
,
const
char
*
val
);
int
http_IsHdr
(
const
txt
*
hh
,
const
char
*
hdr
);
...
...
bin/varnishd/cache/cache_http.c
View file @
bb603b3d
...
...
@@ -552,6 +552,27 @@ http_GetStatus(const struct http *hp)
return
(
hp
->
status
);
}
/*--------------------------------------------------------------------*/
void
http_SetStatus
(
struct
http
*
to
,
uint16_t
status
)
{
char
buf
[
4
];
CHECK_OBJ_NOTNULL
(
to
,
HTTP_MAGIC
);
/*
* We allow people to use top digits for internal VCL
* signalling, but strip them from the ASCII version.
*/
to
->
status
=
status
;
status
%=
1000
;
assert
(
status
>=
100
);
bprintf
(
buf
,
"%03d"
,
status
);
http_PutField
(
to
,
HTTP_HDR_STATUS
,
buf
);
}
/*--------------------------------------------------------------------*/
const
char
*
http_GetReq
(
const
struct
http
*
hp
)
{
...
...
@@ -581,19 +602,11 @@ void
http_PutResponse
(
struct
http
*
to
,
const
char
*
proto
,
uint16_t
status
,
const
char
*
reason
)
{
char
buf
[
4
];
CHECK_OBJ_NOTNULL
(
to
,
HTTP_MAGIC
);
http_SetH
(
to
,
HTTP_HDR_PROTO
,
proto
);
/*
* We allow people to use top digits for internal VCL
* signalling, strip them here.
*/
status
%=
1000
;
assert
(
status
>=
100
);
to
->
status
=
status
;
bprintf
(
buf
,
"%03d"
,
status
%
1000
);
http_PutField
(
to
,
HTTP_HDR_STATUS
,
buf
);
if
(
proto
!=
NULL
)
http_SetH
(
to
,
HTTP_HDR_PROTO
,
proto
);
http_SetStatus
(
to
,
status
);
if
(
reason
==
NULL
)
reason
=
http_Status2Reason
(
status
);
http_SetH
(
to
,
HTTP_HDR_REASON
,
reason
);
...
...
bin/varnishd/cache/cache_vrt_var.c
View file @
bb603b3d
...
...
@@ -105,8 +105,9 @@ VRT_l_##obj##_status(const struct vrt_ctx *ctx, long num) \
VSLb(ctx->vsl, SLT_VCL_Error, "illegal %s.status (..0##)", \
#obj); \
ctx->http_##obj->failed = 1; \
} else \
ctx->http_##obj->status = (uint16_t)num; \
} else { \
http_SetStatus(ctx->http_##obj, (uint16_t)num); \
} \
}
#define VRT_STATUS_R(obj) \
...
...
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