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
69600783
Commit
69600783
authored
Jun 10, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor polishing in http space, to get them out of substantial change
to follow shortly.
parent
b3562068
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
45 deletions
+41
-45
cache.h
bin/varnishd/cache/cache.h
+2
-7
cache_http.c
bin/varnishd/cache/cache_http.c
+35
-34
cache_http1_proto.c
bin/varnishd/cache/cache_http1_proto.c
+4
-4
No files found.
bin/varnishd/cache/cache.h
View file @
69600783
...
@@ -89,15 +89,10 @@ enum sess_close {
...
@@ -89,15 +89,10 @@ enum sess_close {
#undef SESS_CLOSE
#undef SESS_CLOSE
};
};
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------
* Indicies into http->hd[]
/*
* NB: HDR_STATUS is only used in cache_http.c, everybody else uses the
* http->status integer field.
*/
*/
enum
{
enum
{
/* Fields from the first line of HTTP proto */
#define SLTH(tag, ind, req, resp, sdesc, ldesc) ind,
#define SLTH(tag, ind, req, resp, sdesc, ldesc) ind,
#include "tbl/vsl_tags_http.h"
#include "tbl/vsl_tags_http.h"
#undef SLTH
#undef SLTH
...
...
bin/varnishd/cache/cache_http.c
View file @
69600783
...
@@ -193,6 +193,39 @@ HTTP_Copy(struct http *to, const struct http * const fm)
...
@@ -193,6 +193,39 @@ HTTP_Copy(struct http *to, const struct http * const fm)
memcpy
(
to
->
hdf
,
fm
->
hdf
,
fm
->
nhd
*
sizeof
*
to
->
hdf
);
memcpy
(
to
->
hdf
,
fm
->
hdf
,
fm
->
nhd
*
sizeof
*
to
->
hdf
);
}
}
/*--------------------------------------------------------------------*/
void
http_SetH
(
const
struct
http
*
to
,
unsigned
n
,
const
char
*
fm
)
{
assert
(
n
<
to
->
shd
);
AN
(
fm
);
to
->
hd
[
n
].
b
=
TRUST_ME
(
fm
);
to
->
hd
[
n
].
e
=
strchr
(
to
->
hd
[
n
].
b
,
'\0'
);
to
->
hdf
[
n
]
=
0
;
http_VSLH
(
to
,
n
);
}
/*--------------------------------------------------------------------*/
static
void
http_PutField
(
struct
http
*
to
,
int
field
,
const
char
*
string
)
{
char
*
p
;
CHECK_OBJ_NOTNULL
(
to
,
HTTP_MAGIC
);
p
=
WS_Copy
(
to
->
ws
,
string
,
-
1
);
if
(
p
==
NULL
)
{
http_fail
(
to
);
VSLb
(
to
->
vsl
,
SLT_LostHeader
,
"%s"
,
string
);
return
;
}
to
->
hd
[
field
].
b
=
p
;
to
->
hd
[
field
].
e
=
strchr
(
p
,
'\0'
);
to
->
hdf
[
field
]
=
0
;
http_VSLH
(
to
,
field
);
}
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
...
@@ -515,6 +548,7 @@ uint16_t
...
@@ -515,6 +548,7 @@ uint16_t
http_GetStatus
(
const
struct
http
*
hp
)
http_GetStatus
(
const
struct
http
*
hp
)
{
{
CHECK_OBJ_NOTNULL
(
hp
,
HTTP_MAGIC
);
return
(
hp
->
status
);
return
(
hp
->
status
);
}
}
...
@@ -522,44 +556,11 @@ const char *
...
@@ -522,44 +556,11 @@ const char *
http_GetReq
(
const
struct
http
*
hp
)
http_GetReq
(
const
struct
http
*
hp
)
{
{
CHECK_OBJ_NOTNULL
(
hp
,
HTTP_MAGIC
);
Tcheck
(
hp
->
hd
[
HTTP_HDR_METHOD
]);
Tcheck
(
hp
->
hd
[
HTTP_HDR_METHOD
]);
return
(
hp
->
hd
[
HTTP_HDR_METHOD
].
b
);
return
(
hp
->
hd
[
HTTP_HDR_METHOD
].
b
);
}
}
/*--------------------------------------------------------------------*/
static
void
http_PutField
(
struct
http
*
to
,
int
field
,
const
char
*
string
)
{
char
*
p
;
CHECK_OBJ_NOTNULL
(
to
,
HTTP_MAGIC
);
p
=
WS_Copy
(
to
->
ws
,
string
,
-
1
);
if
(
p
==
NULL
)
{
http_fail
(
to
);
VSLb
(
to
->
vsl
,
SLT_LostHeader
,
"%s"
,
string
);
return
;
}
to
->
hd
[
field
].
b
=
p
;
to
->
hd
[
field
].
e
=
strchr
(
p
,
'\0'
);
to
->
hdf
[
field
]
=
0
;
http_VSLH
(
to
,
field
);
}
/*--------------------------------------------------------------------*/
void
http_SetH
(
const
struct
http
*
to
,
unsigned
n
,
const
char
*
fm
)
{
assert
(
n
<
to
->
shd
);
AN
(
fm
);
to
->
hd
[
n
].
b
=
TRUST_ME
(
fm
);
to
->
hd
[
n
].
e
=
strchr
(
to
->
hd
[
n
].
b
,
'\0'
);
to
->
hdf
[
n
]
=
0
;
http_VSLH
(
to
,
n
);
}
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
* Force a particular header field to a particular value
* Force a particular header field to a particular value
*/
*/
...
...
bin/varnishd/cache/cache_http1_proto.c
View file @
69600783
...
@@ -312,6 +312,9 @@ htc_splitline(struct http *hp, const struct http_conn *htc, int req)
...
@@ -312,6 +312,9 @@ htc_splitline(struct http *hp, const struct http_conn *htc, int req)
h2
=
HTTP_HDR_STATUS
;
h2
=
HTTP_HDR_STATUS
;
h3
=
HTTP_HDR_REASON
;
h3
=
HTTP_HDR_REASON
;
}
}
AZ
(
hp
->
hd
[
h1
].
b
);
AZ
(
hp
->
hd
[
h2
].
b
);
AZ
(
hp
->
hd
[
h3
].
b
);
/* Skip leading LWS */
/* Skip leading LWS */
for
(
p
=
htc
->
rxbuf
.
b
;
vct_islws
(
*
p
);
p
++
)
for
(
p
=
htc
->
rxbuf
.
b
;
vct_islws
(
*
p
);
p
++
)
...
@@ -339,7 +342,6 @@ htc_splitline(struct http *hp, const struct http_conn *htc, int req)
...
@@ -339,7 +342,6 @@ htc_splitline(struct http *hp, const struct http_conn *htc, int req)
return
(
400
);
return
(
400
);
}
}
hp
->
hd
[
h2
].
e
=
p
;
hp
->
hd
[
h2
].
e
=
p
;
if
(
!
Tlen
(
hp
->
hd
[
h2
]))
if
(
!
Tlen
(
hp
->
hd
[
h2
]))
return
(
400
);
return
(
400
);
...
@@ -364,8 +366,6 @@ htc_splitline(struct http *hp, const struct http_conn *htc, int req)
...
@@ -364,8 +366,6 @@ htc_splitline(struct http *hp, const struct http_conn *htc, int req)
*
hp
->
hd
[
h1
].
e
=
'\0'
;
*
hp
->
hd
[
h1
].
e
=
'\0'
;
*
hp
->
hd
[
h2
].
e
=
'\0'
;
*
hp
->
hd
[
h2
].
e
=
'\0'
;
if
(
hp
->
hd
[
h3
].
e
!=
NULL
)
*
hp
->
hd
[
h3
].
e
=
'\0'
;
*
hp
->
hd
[
h3
].
e
=
'\0'
;
return
(
htc_dissect_hdrs
(
hp
,
p
,
htc
));
return
(
htc_dissect_hdrs
(
hp
,
p
,
htc
));
...
...
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