Commit 856b638e authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

Cosmetic: redefine HTTP_HDR_* as an enum and rename MAX_HTTP_HDRS to

HTTP_HDR_MAX.

git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@777 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 4bac98e0
......@@ -17,16 +17,18 @@
#include "common.h"
#include "miniobj.h"
#define MAX_HTTP_HDRS 32
#define MAX_IOVS (MAX_HTTP_HDRS * 2)
enum {
HTTP_HDR_REQ,
HTTP_HDR_URL,
HTTP_HDR_PROTO,
HTTP_HDR_STATUS,
HTTP_HDR_RESPONSE,
/* add more here */
HTTP_HDR_FIRST,
HTTP_HDR_MAX = 32
};
#define HTTP_HDR_REQ 0
#define HTTP_HDR_URL 1
#define HTTP_HDR_PROTO 2
#define HTTP_HDR_STATUS 3
#define HTTP_HDR_RESPONSE 4
#define HTTP_HDR_FIRST 5
#define MAX_IOVS (HTTP_HDR_MAX * 2)
struct cli;
struct vsb;
......@@ -70,7 +72,7 @@ struct http {
HTTP_Obj
} logtag;
struct http_hdr hd[MAX_HTTP_HDRS];
struct http_hdr hd[HTTP_HDR_MAX];
unsigned nhd;
};
......
......@@ -274,7 +274,7 @@ http_dissect_hdrs(struct http *hp, int fd, char *p)
p[2] == '-')
hp->conds = 1;
if (hp->nhd < MAX_HTTP_HDRS) {
if (hp->nhd < HTTP_HDR_MAX) {
hp->hd[hp->nhd].b = p;
hp->hd[hp->nhd].e = q;
VSLH(HTTP_T_Header, fd, hp, hp->nhd);
......@@ -573,7 +573,7 @@ http_CopyHttp(struct http *to, struct http *fm)
static void
http_seth(int fd, struct http *to, unsigned n, enum httptag tag, const char *fm)
{
assert(n < MAX_HTTP_HDRS);
assert(n < HTTP_HDR_MAX);
assert(fm != NULL);
to->hd[n].b = (void*)(uintptr_t)fm;
to->hd[n].e = (void*)(uintptr_t)strchr(fm, '\0');
......@@ -584,7 +584,7 @@ static void
http_copyh(int fd, struct http *to, struct http *fm, unsigned n, enum httptag tag)
{
assert(n < MAX_HTTP_HDRS);
assert(n < HTTP_HDR_MAX);
assert(fm->hd[n].b != NULL);
to->hd[n].b = fm->hd[n].b;
to->hd[n].e = fm->hd[n].e;
......@@ -640,9 +640,9 @@ http_copyheader(int fd, struct http *to, struct http *fm, unsigned n)
CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC);
CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
assert(n < MAX_HTTP_HDRS);
assert(n < HTTP_HDR_MAX);
assert(fm->hd[n].b != NULL);
if (to->nhd < MAX_HTTP_HDRS) {
if (to->nhd < HTTP_HDR_MAX) {
to->hd[to->nhd].b = fm->hd[n].b;
to->hd[to->nhd].e = fm->hd[n].e;
VSLH(HTTP_T_Header, fd, to, to->nhd);
......@@ -692,7 +692,7 @@ http_SetHeader(int fd, struct http *to, const char *hdr)
{
CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
if (to->nhd >= MAX_HTTP_HDRS) {
if (to->nhd >= HTTP_HDR_MAX) {
VSL_stats->losthdr++;
VSL(T(to, HTTP_T_LostHeader), fd, "%s", hdr);
return;
......@@ -712,7 +712,7 @@ http_PrintfHeader(int fd, struct http *to, const char *fmt, ...)
va_start(ap, fmt);
l = to->e - to->f;
n = vsnprintf(to->f, l, fmt, ap);
if (n + 1 > l || to->nhd >= MAX_HTTP_HDRS) {
if (n + 1 > l || to->nhd >= HTTP_HDR_MAX) {
VSL_stats->losthdr++;
VSL(T(to, HTTP_T_LostHeader), fd, "%s", to->f);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment