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
0e3c3ed0
Commit
0e3c3ed0
authored
Aug 15, 2011
by
Kristian Lyngstol
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
git+ssh://git.varnish-cache.org/git/varnish-cache
parents
1695f2ab
e13e923d
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
78 additions
and
59 deletions
+78
-59
cache.h
bin/varnishd/cache.h
+7
-7
cache_center.c
bin/varnishd/cache_center.c
+6
-5
cache_http.c
bin/varnishd/cache_http.c
+50
-35
cache_pool.c
bin/varnishd/cache_pool.c
+4
-3
cache_session.c
bin/varnishd/cache_session.c
+3
-3
cache_vrt.c
bin/varnishd/cache_vrt.c
+3
-1
cache_vrt_var.c
bin/varnishd/cache_vrt_var.c
+1
-1
mgt_param.c
bin/varnishd/mgt_param.c
+1
-1
stevedore.c
bin/varnishd/stevedore.c
+2
-2
stevedore.h
bin/varnishd/stevedore.h
+1
-1
No files found.
bin/varnishd/cache.h
View file @
0e3c3ed0
...
@@ -739,21 +739,21 @@ int VGZ_WrwGunzip(const struct sess *, struct vgz *, const void *ibuf,
...
@@ -739,21 +739,21 @@ int VGZ_WrwGunzip(const struct sess *, struct vgz *, const void *ibuf,
/* cache_http.c */
/* cache_http.c */
unsigned
HTTP_estimate
(
unsigned
nhttp
);
unsigned
HTTP_estimate
(
unsigned
nhttp
);
void
HTTP_Copy
(
struct
http
*
to
,
const
struct
http
*
const
fm
);
void
HTTP_Copy
(
struct
http
*
to
,
const
struct
http
*
const
fm
);
struct
http
*
HTTP_create
(
void
*
p
,
u
nsigned
nhttp
);
struct
http
*
HTTP_create
(
void
*
p
,
u
int16_t
nhttp
);
const
char
*
http_StatusMessage
(
unsigned
);
const
char
*
http_StatusMessage
(
unsigned
);
unsigned
http_EstimateWS
(
const
struct
http
*
fm
,
unsigned
how
,
u
nsigned
*
nhd
);
unsigned
http_EstimateWS
(
const
struct
http
*
fm
,
unsigned
how
,
u
int16_t
*
nhd
);
void
HTTP_Init
(
void
);
void
HTTP_Init
(
void
);
void
http_ClrHeader
(
struct
http
*
to
);
void
http_ClrHeader
(
struct
http
*
to
);
unsigned
http_Write
(
struct
worker
*
w
,
const
struct
http
*
hp
,
int
resp
);
unsigned
http_Write
(
struct
worker
*
w
,
const
struct
http
*
hp
,
int
resp
);
void
http_CopyResp
(
struct
http
*
to
,
const
struct
http
*
fm
);
void
http_CopyResp
(
struct
http
*
to
,
const
struct
http
*
fm
);
void
http_SetResp
(
struct
http
*
to
,
const
char
*
proto
,
in
t
status
,
void
http_SetResp
(
struct
http
*
to
,
const
char
*
proto
,
uint16_
t
status
,
const
char
*
response
);
const
char
*
response
);
void
http_FilterFields
(
struct
worker
*
w
,
int
fd
,
struct
http
*
to
,
void
http_FilterFields
(
struct
worker
*
w
,
int
fd
,
struct
http
*
to
,
const
struct
http
*
fm
,
unsigned
how
);
const
struct
http
*
fm
,
unsigned
how
);
void
http_FilterHeader
(
const
struct
sess
*
sp
,
unsigned
how
);
void
http_FilterHeader
(
const
struct
sess
*
sp
,
unsigned
how
);
void
http_PutProtocol
(
struct
worker
*
w
,
int
fd
,
const
struct
http
*
to
,
void
http_PutProtocol
(
struct
worker
*
w
,
int
fd
,
const
struct
http
*
to
,
const
char
*
protocol
);
const
char
*
protocol
);
void
http_PutStatus
(
struct
http
*
to
,
in
t
status
);
void
http_PutStatus
(
struct
http
*
to
,
uint16_
t
status
);
void
http_PutResponse
(
struct
worker
*
w
,
int
fd
,
const
struct
http
*
to
,
void
http_PutResponse
(
struct
worker
*
w
,
int
fd
,
const
struct
http
*
to
,
const
char
*
response
);
const
char
*
response
);
void
http_PrintfHeader
(
struct
worker
*
w
,
int
fd
,
struct
http
*
to
,
void
http_PrintfHeader
(
struct
worker
*
w
,
int
fd
,
struct
http
*
to
,
...
@@ -768,11 +768,11 @@ int http_GetHdrData(const struct http *hp, const char *hdr,
...
@@ -768,11 +768,11 @@ int http_GetHdrData(const struct http *hp, const char *hdr,
int
http_GetHdrField
(
const
struct
http
*
hp
,
const
char
*
hdr
,
int
http_GetHdrField
(
const
struct
http
*
hp
,
const
char
*
hdr
,
const
char
*
field
,
char
**
ptr
);
const
char
*
field
,
char
**
ptr
);
double
http_GetHdrQ
(
const
struct
http
*
hp
,
const
char
*
hdr
,
const
char
*
field
);
double
http_GetHdrQ
(
const
struct
http
*
hp
,
const
char
*
hdr
,
const
char
*
field
);
in
t
http_GetStatus
(
const
struct
http
*
hp
);
uint16_
t
http_GetStatus
(
const
struct
http
*
hp
);
const
char
*
http_GetReq
(
const
struct
http
*
hp
);
const
char
*
http_GetReq
(
const
struct
http
*
hp
);
int
http_HdrIs
(
const
struct
http
*
hp
,
const
char
*
hdr
,
const
char
*
val
);
int
http_HdrIs
(
const
struct
http
*
hp
,
const
char
*
hdr
,
const
char
*
val
);
in
t
http_DissectRequest
(
struct
sess
*
sp
);
uint16_
t
http_DissectRequest
(
struct
sess
*
sp
);
in
t
http_DissectResponse
(
struct
worker
*
w
,
const
struct
http_conn
*
htc
,
uint16_
t
http_DissectResponse
(
struct
worker
*
w
,
const
struct
http_conn
*
htc
,
struct
http
*
sp
);
struct
http
*
sp
);
const
char
*
http_DoConnection
(
const
struct
http
*
hp
);
const
char
*
http_DoConnection
(
const
struct
http
*
hp
);
void
http_CopyHome
(
struct
worker
*
w
,
int
fd
,
const
struct
http
*
hp
);
void
http_CopyHome
(
struct
worker
*
w
,
int
fd
,
const
struct
http
*
hp
);
...
...
bin/varnishd/cache_center.c
View file @
0e3c3ed0
...
@@ -417,10 +417,10 @@ cnt_error(struct sess *sp)
...
@@ -417,10 +417,10 @@ cnt_error(struct sess *sp)
/* XXX: 1024 is a pure guess */
/* XXX: 1024 is a pure guess */
EXP_Clr
(
&
w
->
exp
);
EXP_Clr
(
&
w
->
exp
);
sp
->
obj
=
STV_NewObject
(
sp
,
NULL
,
1024
,
&
w
->
exp
,
sp
->
obj
=
STV_NewObject
(
sp
,
NULL
,
1024
,
&
w
->
exp
,
params
->
http_max_hdr
);
(
uint16_t
)
params
->
http_max_hdr
);
if
(
sp
->
obj
==
NULL
)
if
(
sp
->
obj
==
NULL
)
sp
->
obj
=
STV_NewObject
(
sp
,
TRANSIENT_STORAGE
,
sp
->
obj
=
STV_NewObject
(
sp
,
TRANSIENT_STORAGE
,
1024
,
&
w
->
exp
,
params
->
http_max_hdr
);
1024
,
&
w
->
exp
,
(
uint16_t
)
params
->
http_max_hdr
);
if
(
sp
->
obj
==
NULL
)
{
if
(
sp
->
obj
==
NULL
)
{
sp
->
doclose
=
"Out of objects"
;
sp
->
doclose
=
"Out of objects"
;
sp
->
step
=
STP_DONE
;
sp
->
step
=
STP_DONE
;
...
@@ -637,7 +637,8 @@ cnt_fetchbody(struct sess *sp)
...
@@ -637,7 +637,8 @@ cnt_fetchbody(struct sess *sp)
int
i
;
int
i
;
struct
http
*
hp
,
*
hp2
;
struct
http
*
hp
,
*
hp2
;
char
*
b
;
char
*
b
;
unsigned
l
,
nhttp
;
uint16_t
nhttp
;
unsigned
l
;
struct
vsb
*
vary
=
NULL
;
struct
vsb
*
vary
=
NULL
;
int
varyl
=
0
,
pass
;
int
varyl
=
0
,
pass
;
...
@@ -1411,7 +1412,7 @@ DOT start -> recv [style=bold,color=green]
...
@@ -1411,7 +1412,7 @@ DOT start -> recv [style=bold,color=green]
static
int
static
int
cnt_start
(
struct
sess
*
sp
)
cnt_start
(
struct
sess
*
sp
)
{
{
in
t
done
;
uint16_
t
done
;
char
*
p
;
char
*
p
;
const
char
*
r
=
"HTTP/1.1 100 Continue
\r\n\r\n
"
;
const
char
*
r
=
"HTTP/1.1 100 Continue
\r\n\r\n
"
;
...
@@ -1439,7 +1440,7 @@ cnt_start(struct sess *sp)
...
@@ -1439,7 +1440,7 @@ cnt_start(struct sess *sp)
done
=
http_DissectRequest
(
sp
);
done
=
http_DissectRequest
(
sp
);
/* If we could not even parse the request, just close */
/* If we could not even parse the request, just close */
if
(
done
<
0
)
{
if
(
done
==
40
0
)
{
sp
->
step
=
STP_DONE
;
sp
->
step
=
STP_DONE
;
vca_close_session
(
sp
,
"junk"
);
vca_close_session
(
sp
,
"junk"
);
return
(
0
);
return
(
0
);
...
...
bin/varnishd/cache_http.c
View file @
0e3c3ed0
...
@@ -118,7 +118,7 @@ HTTP_estimate(unsigned nhttp)
...
@@ -118,7 +118,7 @@ HTTP_estimate(unsigned nhttp)
}
}
struct
http
*
struct
http
*
HTTP_create
(
void
*
p
,
u
nsigned
nhttp
)
HTTP_create
(
void
*
p
,
u
int16_t
nhttp
)
{
{
struct
http
*
hp
;
struct
http
*
hp
;
...
@@ -135,7 +135,7 @@ HTTP_create(void *p, unsigned nhttp)
...
@@ -135,7 +135,7 @@ HTTP_create(void *p, unsigned nhttp)
void
void
http_Setup
(
struct
http
*
hp
,
struct
ws
*
ws
)
http_Setup
(
struct
http
*
hp
,
struct
ws
*
ws
)
{
{
u
nsigned
shd
;
u
int16_t
shd
;
txt
*
hd
;
txt
*
hd
;
unsigned
char
*
hdf
;
unsigned
char
*
hdf
;
...
@@ -425,6 +425,7 @@ http_DoConnection(const struct http *hp)
...
@@ -425,6 +425,7 @@ http_DoConnection(const struct http *hp)
return
(
NULL
);
return
(
NULL
);
}
}
ret
=
NULL
;
ret
=
NULL
;
AN
(
p
);
for
(;
*
p
;
p
++
)
{
for
(;
*
p
;
p
++
)
{
if
(
vct_issp
(
*
p
))
if
(
vct_issp
(
*
p
))
continue
;
continue
;
...
@@ -463,7 +464,7 @@ http_HdrIs(const struct http *hp, const char *hdr, const char *val)
...
@@ -463,7 +464,7 @@ http_HdrIs(const struct http *hp, const char *hdr, const char *val)
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
in
t
uint16_
t
http_GetStatus
(
const
struct
http
*
hp
)
http_GetStatus
(
const
struct
http
*
hp
)
{
{
...
@@ -483,7 +484,7 @@ http_GetReq(const struct http *hp)
...
@@ -483,7 +484,7 @@ http_GetReq(const struct http *hp)
* Detect conditionals (headers which start with '^[Ii][Ff]-')
* Detect conditionals (headers which start with '^[Ii][Ff]-')
*/
*/
static
in
t
static
uint16_
t
http_dissect_hdrs
(
struct
worker
*
w
,
struct
http
*
hp
,
int
fd
,
char
*
p
,
http_dissect_hdrs
(
struct
worker
*
w
,
struct
http
*
hp
,
int
fd
,
char
*
p
,
const
struct
http_conn
*
htc
)
const
struct
http_conn
*
htc
)
{
{
...
@@ -557,7 +558,7 @@ http_dissect_hdrs(struct worker *w, struct http *hp, int fd, char *p,
...
@@ -557,7 +558,7 @@ http_dissect_hdrs(struct worker *w, struct http *hp, int fd, char *p,
* Deal with first line of HTTP protocol message.
* Deal with first line of HTTP protocol message.
*/
*/
static
in
t
static
uint16_
t
http_splitline
(
struct
worker
*
w
,
int
fd
,
struct
http
*
hp
,
http_splitline
(
struct
worker
*
w
,
int
fd
,
struct
http
*
hp
,
const
struct
http_conn
*
htc
,
int
h1
,
int
h2
,
int
h3
)
const
struct
http_conn
*
htc
,
int
h1
,
int
h2
,
int
h3
)
{
{
...
@@ -577,7 +578,7 @@ http_splitline(struct worker *w, int fd, struct http *hp,
...
@@ -577,7 +578,7 @@ http_splitline(struct worker *w, int fd, struct http *hp,
q
=
p
;
q
=
p
;
for
(;
!
vct_issp
(
*
p
);
p
++
)
{
for
(;
!
vct_issp
(
*
p
);
p
++
)
{
if
(
vct_isctl
(
*
p
))
if
(
vct_isctl
(
*
p
))
return
(
-
1
);
return
(
400
);
}
}
hp
->
hd
[
h1
].
b
=
q
;
hp
->
hd
[
h1
].
b
=
q
;
hp
->
hd
[
h1
].
e
=
p
;
hp
->
hd
[
h1
].
e
=
p
;
...
@@ -585,14 +586,14 @@ http_splitline(struct worker *w, int fd, struct http *hp,
...
@@ -585,14 +586,14 @@ http_splitline(struct worker *w, int fd, struct http *hp,
/* Skip SP */
/* Skip SP */
for
(;
vct_issp
(
*
p
);
p
++
)
{
for
(;
vct_issp
(
*
p
);
p
++
)
{
if
(
vct_isctl
(
*
p
))
if
(
vct_isctl
(
*
p
))
return
(
-
1
);
return
(
400
);
}
}
/* Second field cannot contain LWS or CTL */
/* Second field cannot contain LWS or CTL */
q
=
p
;
q
=
p
;
for
(;
!
vct_islws
(
*
p
);
p
++
)
{
for
(;
!
vct_islws
(
*
p
);
p
++
)
{
if
(
vct_isctl
(
*
p
))
if
(
vct_isctl
(
*
p
))
return
(
-
1
);
return
(
400
);
}
}
hp
->
hd
[
h2
].
b
=
q
;
hp
->
hd
[
h2
].
b
=
q
;
hp
->
hd
[
h2
].
e
=
p
;
hp
->
hd
[
h2
].
e
=
p
;
...
@@ -603,7 +604,7 @@ http_splitline(struct worker *w, int fd, struct http *hp,
...
@@ -603,7 +604,7 @@ http_splitline(struct worker *w, int fd, struct http *hp,
/* Skip SP */
/* Skip SP */
for
(;
vct_issp
(
*
p
);
p
++
)
{
for
(;
vct_issp
(
*
p
);
p
++
)
{
if
(
vct_isctl
(
*
p
))
if
(
vct_isctl
(
*
p
))
return
(
-
1
);
return
(
400
);
}
}
/* Third field is optional and cannot contain CTL */
/* Third field is optional and cannot contain CTL */
...
@@ -611,7 +612,7 @@ http_splitline(struct worker *w, int fd, struct http *hp,
...
@@ -611,7 +612,7 @@ http_splitline(struct worker *w, int fd, struct http *hp,
if
(
!
vct_iscrlf
(
*
p
))
{
if
(
!
vct_iscrlf
(
*
p
))
{
for
(;
!
vct_iscrlf
(
*
p
);
p
++
)
for
(;
!
vct_iscrlf
(
*
p
);
p
++
)
if
(
!
vct_issep
(
*
p
)
&&
vct_isctl
(
*
p
))
if
(
!
vct_issep
(
*
p
)
&&
vct_isctl
(
*
p
))
return
(
-
1
);
return
(
400
);
}
}
hp
->
hd
[
h3
].
b
=
q
;
hp
->
hd
[
h3
].
b
=
q
;
hp
->
hd
[
h3
].
e
=
p
;
hp
->
hd
[
h3
].
e
=
p
;
...
@@ -650,12 +651,12 @@ http_ProtoVer(struct http *hp)
...
@@ -650,12 +651,12 @@ http_ProtoVer(struct http *hp)
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
in
t
uint16_
t
http_DissectRequest
(
struct
sess
*
sp
)
http_DissectRequest
(
struct
sess
*
sp
)
{
{
struct
http_conn
*
htc
;
struct
http_conn
*
htc
;
struct
http
*
hp
;
struct
http
*
hp
;
int
i
;
uint16_t
retval
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
htc
=
sp
->
htc
;
htc
=
sp
->
htc
;
...
@@ -665,23 +666,26 @@ http_DissectRequest(struct sess *sp)
...
@@ -665,23 +666,26 @@ http_DissectRequest(struct sess *sp)
hp
->
logtag
=
HTTP_Rx
;
hp
->
logtag
=
HTTP_Rx
;
i
=
http_splitline
(
sp
->
wrk
,
sp
->
fd
,
hp
,
htc
,
retval
=
http_splitline
(
sp
->
wrk
,
sp
->
fd
,
hp
,
htc
,
HTTP_HDR_REQ
,
HTTP_HDR_URL
,
HTTP_HDR_PROTO
);
HTTP_HDR_REQ
,
HTTP_HDR_URL
,
HTTP_HDR_PROTO
);
if
(
i
!=
0
)
{
if
(
retval
!=
0
)
{
WSPR
(
sp
,
SLT_HttpGarbage
,
htc
->
rxbuf
);
WSPR
(
sp
,
SLT_HttpGarbage
,
htc
->
rxbuf
);
return
(
i
);
return
(
retval
);
}
}
http_ProtoVer
(
hp
);
http_ProtoVer
(
hp
);
return
(
i
);
return
(
retval
);
}
}
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
in
t
uint16_
t
http_DissectResponse
(
struct
worker
*
w
,
const
struct
http_conn
*
htc
,
http_DissectResponse
(
struct
worker
*
w
,
const
struct
http_conn
*
htc
,
struct
http
*
hp
)
struct
http
*
hp
)
{
{
int
i
=
0
;
int
j
;
uint16_t
retval
=
0
;
char
*
p
;
CHECK_OBJ_NOTNULL
(
htc
,
HTTP_CONN_MAGIC
);
CHECK_OBJ_NOTNULL
(
htc
,
HTTP_CONN_MAGIC
);
CHECK_OBJ_NOTNULL
(
hp
,
HTTP_MAGIC
);
CHECK_OBJ_NOTNULL
(
hp
,
HTTP_MAGIC
);
...
@@ -689,23 +693,33 @@ http_DissectResponse(struct worker *w, const struct http_conn *htc,
...
@@ -689,23 +693,33 @@ http_DissectResponse(struct worker *w, const struct http_conn *htc,
if
(
http_splitline
(
w
,
htc
->
fd
,
hp
,
htc
,
if
(
http_splitline
(
w
,
htc
->
fd
,
hp
,
htc
,
HTTP_HDR_PROTO
,
HTTP_HDR_STATUS
,
HTTP_HDR_RESPONSE
))
HTTP_HDR_PROTO
,
HTTP_HDR_STATUS
,
HTTP_HDR_RESPONSE
))
i
=
503
;
retval
=
503
;
if
(
i
==
0
&&
memcmp
(
hp
->
hd
[
HTTP_HDR_PROTO
].
b
,
"HTTP/1."
,
7
))
if
(
retval
==
0
&&
memcmp
(
hp
->
hd
[
HTTP_HDR_PROTO
].
b
,
"HTTP/1."
,
7
))
i
=
503
;
retval
=
503
;
if
(
i
==
0
&&
Tlen
(
hp
->
hd
[
HTTP_HDR_STATUS
])
!=
3
)
if
(
retval
==
0
&&
Tlen
(
hp
->
hd
[
HTTP_HDR_STATUS
])
!=
3
)
i
=
503
;
retval
=
503
;
if
(
i
==
0
)
{
if
(
retval
==
0
)
{
hp
->
status
=
strtoul
(
hp
->
hd
[
HTTP_HDR_STATUS
].
b
,
NULL
,
10
);
hp
->
status
=
0
;
if
(
hp
->
status
<
100
||
hp
->
status
>
999
)
p
=
hp
->
hd
[
HTTP_HDR_STATUS
].
b
;
i
=
503
;
for
(
j
=
100
;
j
!=
0
;
j
/=
10
)
{
if
(
!
vct_isdigit
(
*
p
))
{
retval
=
503
;
break
;
}
hp
->
status
+=
(
uint16_t
)(
j
*
(
*
p
-
'0'
));
p
++
;
}
if
(
*
p
!=
'\0'
)
retval
=
503
;
}
}
if
(
i
!=
0
)
{
if
(
retval
!=
0
)
{
WSLR
(
w
,
SLT_HttpGarbage
,
htc
->
fd
,
htc
->
rxbuf
);
WSLR
(
w
,
SLT_HttpGarbage
,
htc
->
fd
,
htc
->
rxbuf
);
hp
->
status
=
i
;
assert
(
retval
>=
100
&&
retval
<=
999
);
hp
->
status
=
retval
;
}
else
{
}
else
{
http_ProtoVer
(
hp
);
http_ProtoVer
(
hp
);
}
}
...
@@ -718,7 +732,7 @@ http_DissectResponse(struct worker *w, const struct http_conn *htc,
...
@@ -718,7 +732,7 @@ http_DissectResponse(struct worker *w, const struct http_conn *htc,
hp
->
hd
[
HTTP_HDR_RESPONSE
].
e
=
hp
->
hd
[
HTTP_HDR_RESPONSE
].
e
=
strchr
(
hp
->
hd
[
HTTP_HDR_RESPONSE
].
b
,
'\0'
);
strchr
(
hp
->
hd
[
HTTP_HDR_RESPONSE
].
b
,
'\0'
);
}
}
return
(
i
);
return
(
retval
);
}
}
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
...
@@ -763,12 +777,13 @@ http_CopyResp(struct http *to, const struct http *fm)
...
@@ -763,12 +777,13 @@ http_CopyResp(struct http *to, const struct http *fm)
}
}
void
void
http_SetResp
(
struct
http
*
to
,
const
char
*
proto
,
in
t
status
,
http_SetResp
(
struct
http
*
to
,
const
char
*
proto
,
uint16_
t
status
,
const
char
*
response
)
const
char
*
response
)
{
{
CHECK_OBJ_NOTNULL
(
to
,
HTTP_MAGIC
);
CHECK_OBJ_NOTNULL
(
to
,
HTTP_MAGIC
);
http_SetH
(
to
,
HTTP_HDR_PROTO
,
proto
);
http_SetH
(
to
,
HTTP_HDR_PROTO
,
proto
);
assert
(
status
>=
100
&&
status
<=
999
);
to
->
status
=
status
;
to
->
status
=
status
;
http_SetH
(
to
,
HTTP_HDR_RESPONSE
,
response
);
http_SetH
(
to
,
HTTP_HDR_RESPONSE
,
response
);
}
}
...
@@ -798,7 +813,7 @@ http_copyheader(struct worker *w, int fd, struct http *to,
...
@@ -798,7 +813,7 @@ http_copyheader(struct worker *w, int fd, struct http *to,
*/
*/
unsigned
unsigned
http_EstimateWS
(
const
struct
http
*
fm
,
unsigned
how
,
u
nsigned
*
nhd
)
http_EstimateWS
(
const
struct
http
*
fm
,
unsigned
how
,
u
int16_t
*
nhd
)
{
{
unsigned
u
,
l
;
unsigned
u
,
l
;
...
@@ -967,10 +982,10 @@ http_PutProtocol(struct worker *w, int fd, const struct http *to,
...
@@ -967,10 +982,10 @@ http_PutProtocol(struct worker *w, int fd, const struct http *to,
}
}
void
void
http_PutStatus
(
struct
http
*
to
,
in
t
status
)
http_PutStatus
(
struct
http
*
to
,
uint16_
t
status
)
{
{
assert
(
status
>=
0
&&
status
<=
999
);
assert
(
status
>=
10
0
&&
status
<=
999
);
to
->
status
=
status
;
to
->
status
=
status
;
}
}
...
@@ -1011,7 +1026,7 @@ http_PrintfHeader(struct worker *w, int fd, struct http *to,
...
@@ -1011,7 +1026,7 @@ http_PrintfHeader(struct worker *w, int fd, struct http *to,
void
void
http_Unset
(
struct
http
*
hp
,
const
char
*
hdr
)
http_Unset
(
struct
http
*
hp
,
const
char
*
hdr
)
{
{
u
nsigned
u
,
v
;
u
int16_t
u
,
v
;
for
(
v
=
u
=
HTTP_HDR_FIRST
;
u
<
hp
->
nhd
;
u
++
)
{
for
(
v
=
u
=
HTTP_HDR_FIRST
;
u
<
hp
->
nhd
;
u
++
)
{
if
(
hp
->
hd
[
u
].
b
==
NULL
)
if
(
hp
->
hd
[
u
].
b
==
NULL
)
...
...
bin/varnishd/cache_pool.c
View file @
0e3c3ed0
...
@@ -116,7 +116,7 @@ WRK_SumStat(struct worker *w)
...
@@ -116,7 +116,7 @@ WRK_SumStat(struct worker *w)
static
void
*
static
void
*
wrk_thread_real
(
struct
wq
*
qp
,
unsigned
shm_workspace
,
unsigned
sess_workspace
,
wrk_thread_real
(
struct
wq
*
qp
,
unsigned
shm_workspace
,
unsigned
sess_workspace
,
u
nsigned
nhttp
,
unsigned
http_space
,
unsigned
siov
)
u
int16_t
nhttp
,
unsigned
http_space
,
unsigned
siov
)
{
{
struct
worker
*
w
,
ww
;
struct
worker
*
w
,
ww
;
uint32_t
wlog
[
shm_workspace
/
4
];
uint32_t
wlog
[
shm_workspace
/
4
];
...
@@ -218,12 +218,13 @@ static void *
...
@@ -218,12 +218,13 @@ static void *
wrk_thread
(
void
*
priv
)
wrk_thread
(
void
*
priv
)
{
{
struct
wq
*
qp
;
struct
wq
*
qp
;
u
nsigned
nhttp
;
u
int16_t
nhttp
;
unsigned
siov
;
unsigned
siov
;
CAST_OBJ_NOTNULL
(
qp
,
priv
,
WQ_MAGIC
);
CAST_OBJ_NOTNULL
(
qp
,
priv
,
WQ_MAGIC
);
assert
(
params
->
http_max_hdr
<=
65535
);
/* We need to snapshot these two for consistency */
/* We need to snapshot these two for consistency */
nhttp
=
params
->
http_max_hdr
;
nhttp
=
(
uint16_t
)
params
->
http_max_hdr
;
siov
=
nhttp
*
2
;
siov
=
nhttp
*
2
;
if
(
siov
>
IOV_MAX
)
if
(
siov
>
IOV_MAX
)
siov
=
IOV_MAX
;
siov
=
IOV_MAX
;
...
...
bin/varnishd/cache_session.c
View file @
0e3c3ed0
...
@@ -101,8 +101,8 @@ ses_sm_alloc(void)
...
@@ -101,8 +101,8 @@ ses_sm_alloc(void)
{
{
struct
sessmem
*
sm
;
struct
sessmem
*
sm
;
unsigned
char
*
p
,
*
q
;
unsigned
char
*
p
,
*
q
;
volatile
unsigned
nws
;
unsigned
nws
;
volatile
unsigned
nhttp
;
uint16_t
nhttp
;
unsigned
l
,
hl
;
unsigned
l
,
hl
;
if
(
VSC_C_main
->
n_sess_mem
>=
params
->
max_sess
)
if
(
VSC_C_main
->
n_sess_mem
>=
params
->
max_sess
)
...
@@ -113,7 +113,7 @@ ses_sm_alloc(void)
...
@@ -113,7 +113,7 @@ ses_sm_alloc(void)
* view of the value.
* view of the value.
*/
*/
nws
=
params
->
sess_workspace
;
nws
=
params
->
sess_workspace
;
nhttp
=
params
->
http_max_hdr
;
nhttp
=
(
uint16_t
)
params
->
http_max_hdr
;
hl
=
HTTP_estimate
(
nhttp
);
hl
=
HTTP_estimate
(
nhttp
);
l
=
sizeof
*
sm
+
nws
+
2
*
hl
;
l
=
sizeof
*
sm
+
nws
+
2
*
hl
;
p
=
malloc
(
l
);
p
=
malloc
(
l
);
...
...
bin/varnishd/cache_vrt.c
View file @
0e3c3ed0
...
@@ -61,7 +61,9 @@ VRT_error(struct sess *sp, unsigned code, const char *reason)
...
@@ -61,7 +61,9 @@ VRT_error(struct sess *sp, unsigned code, const char *reason)
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
WSL
(
sp
->
wrk
,
SLT_Debug
,
0
,
"VCL_error(%u, %s)"
,
code
,
reason
?
WSL
(
sp
->
wrk
,
SLT_Debug
,
0
,
"VCL_error(%u, %s)"
,
code
,
reason
?
reason
:
"(null)"
);
reason
:
"(null)"
);
sp
->
err_code
=
code
?
code
:
503
;
if
(
code
<
100
||
code
>
999
)
code
=
503
;
sp
->
err_code
=
(
uint16_t
)
code
;
sp
->
err_reason
=
reason
?
reason
:
http_StatusMessage
(
sp
->
err_code
);
sp
->
err_reason
=
reason
?
reason
:
http_StatusMessage
(
sp
->
err_code
);
}
}
...
...
bin/varnishd/cache_vrt_var.c
View file @
0e3c3ed0
...
@@ -102,7 +102,7 @@ VRT_l_##obj##_status(const struct sess *sp, int num) \
...
@@ -102,7 +102,7 @@ VRT_l_##obj##_status(const struct sess *sp, int num) \
{ \
{ \
\
\
assert(num >= 100 && num <= 999); \
assert(num >= 100 && num <= 999); \
http->status =
num;
\
http->status =
(uint16_t)num;
\
} \
} \
\
\
int \
int \
...
...
bin/varnishd/mgt_param.c
View file @
0e3c3ed0
...
@@ -549,7 +549,7 @@ static const struct parspec input_parspec[] = {
...
@@ -549,7 +549,7 @@ static const struct parspec input_parspec[] = {
"how much of that the request is allowed to take up."
,
"how much of that the request is allowed to take up."
,
0
,
0
,
"32768"
,
"bytes"
},
"32768"
,
"bytes"
},
{
"http_max_hdr"
,
tweak_uint
,
&
master
.
http_max_hdr
,
32
,
UINT_MAX
,
{
"http_max_hdr"
,
tweak_uint
,
&
master
.
http_max_hdr
,
32
,
65535
,
"Maximum number of HTTP headers we will deal with in "
"Maximum number of HTTP headers we will deal with in "
"client request or backend reponses. "
"client request or backend reponses. "
"Note that the first line occupies five header fields.
\n
"
"Note that the first line occupies five header fields.
\n
"
...
...
bin/varnishd/stevedore.c
View file @
0e3c3ed0
...
@@ -199,7 +199,7 @@ stv_alloc(const struct sess *sp, size_t size)
...
@@ -199,7 +199,7 @@ stv_alloc(const struct sess *sp, size_t size)
struct
stv_objsecrets
{
struct
stv_objsecrets
{
unsigned
magic
;
unsigned
magic
;
#define STV_OBJ_SECRETES_MAGIC 0x78c87247
#define STV_OBJ_SECRETES_MAGIC 0x78c87247
u
nsigned
nhttp
;
u
int16_t
nhttp
;
unsigned
lhttp
;
unsigned
lhttp
;
unsigned
wsl
;
unsigned
wsl
;
struct
exp
*
exp
;
struct
exp
*
exp
;
...
@@ -294,7 +294,7 @@ stv_default_allocobj(struct stevedore *stv, struct sess *sp, unsigned ltot,
...
@@ -294,7 +294,7 @@ stv_default_allocobj(struct stevedore *stv, struct sess *sp, unsigned ltot,
struct
object
*
struct
object
*
STV_NewObject
(
struct
sess
*
sp
,
const
char
*
hint
,
unsigned
wsl
,
struct
exp
*
ep
,
STV_NewObject
(
struct
sess
*
sp
,
const
char
*
hint
,
unsigned
wsl
,
struct
exp
*
ep
,
u
nsigned
nhttp
)
u
int16_t
nhttp
)
{
{
struct
object
*
o
;
struct
object
*
o
;
struct
stevedore
*
stv
;
struct
stevedore
*
stv
;
...
...
bin/varnishd/stevedore.h
View file @
0e3c3ed0
...
@@ -91,7 +91,7 @@ struct object *STV_MkObject(struct sess *sp, void *ptr, unsigned ltot,
...
@@ -91,7 +91,7 @@ struct object *STV_MkObject(struct sess *sp, void *ptr, unsigned ltot,
const
struct
stv_objsecrets
*
soc
);
const
struct
stv_objsecrets
*
soc
);
struct
object
*
STV_NewObject
(
struct
sess
*
sp
,
const
char
*
hint
,
unsigned
len
,
struct
object
*
STV_NewObject
(
struct
sess
*
sp
,
const
char
*
hint
,
unsigned
len
,
struct
exp
*
,
u
nsigned
nhttp
);
struct
exp
*
,
u
int16_t
nhttp
);
struct
storage
*
STV_alloc
(
const
struct
sess
*
sp
,
size_t
size
);
struct
storage
*
STV_alloc
(
const
struct
sess
*
sp
,
size_t
size
);
void
STV_trim
(
struct
storage
*
st
,
size_t
size
);
void
STV_trim
(
struct
storage
*
st
,
size_t
size
);
void
STV_free
(
struct
storage
*
st
);
void
STV_free
(
struct
storage
*
st
);
...
...
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