Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
f33a076b
Commit
f33a076b
authored
Feb 14, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Give struct htc the same "tell it what vsl_buffer to use" treatment.
parent
e9e3e2e8
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
34 additions
and
36 deletions
+34
-36
cache.h
bin/varnishd/cache/cache.h
+3
-3
cache_center.c
bin/varnishd/cache/cache_center.c
+1
-1
cache_esi.h
bin/varnishd/cache/cache_esi.h
+1
-1
cache_esi_fetch.c
bin/varnishd/cache/cache_esi_fetch.c
+11
-11
cache_esi_parse.c
bin/varnishd/cache/cache_esi_parse.c
+3
-4
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+8
-8
cache_gzip.c
bin/varnishd/cache/cache_gzip.c
+3
-3
cache_httpconn.c
bin/varnishd/cache/cache_httpconn.c
+4
-5
No files found.
bin/varnishd/cache/cache.h
View file @
f33a076b
...
...
@@ -189,7 +189,7 @@ struct http_conn {
#define HTTP_CONN_MAGIC 0x3e19edd1
int
fd
;
unsigned
vsl_id
;
struct
vsl_log
*
vsl
;
unsigned
maxbytes
;
unsigned
maxhdr
;
struct
ws
*
ws
;
...
...
@@ -831,11 +831,11 @@ void http_Unset(struct http *hp, const char *hdr);
void
http_CollectHdr
(
struct
http
*
hp
,
const
char
*
hdr
);
/* cache_httpconn.c */
void
HTC_Init
(
struct
http_conn
*
htc
,
struct
ws
*
ws
,
int
fd
,
unsigned
vsl_id
,
void
HTC_Init
(
struct
http_conn
*
htc
,
struct
ws
*
ws
,
int
fd
,
struct
vsl_log
*
,
unsigned
maxbytes
,
unsigned
maxhdr
);
int
HTC_Reinit
(
struct
http_conn
*
htc
);
int
HTC_Rx
(
struct
http_conn
*
htc
);
ssize_t
HTC_Read
(
struct
worker
*
w
,
struct
http_conn
*
htc
,
void
*
d
,
size_t
len
);
ssize_t
HTC_Read
(
struct
http_conn
*
htc
,
void
*
d
,
size_t
len
);
int
HTC_Complete
(
struct
http_conn
*
htc
);
#define HTTPH(a, b, c) extern char b[];
...
...
bin/varnishd/cache/cache_center.c
View file @
f33a076b
...
...
@@ -116,7 +116,7 @@ cnt_wait(struct sess *sp, struct worker *wrk, struct req *req)
SES_GetReq
(
sp
);
req
=
sp
->
req
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
HTC_Init
(
req
->
htc
,
req
->
ws
,
sp
->
fd
,
sp
->
vsl_id
,
HTC_Init
(
req
->
htc
,
req
->
ws
,
sp
->
fd
,
sp
->
req
->
vsl
,
cache_param
->
http_req_size
,
cache_param
->
http_req_hdr_len
);
}
...
...
bin/varnishd/cache/cache_esi.h
View file @
f33a076b
...
...
@@ -42,7 +42,7 @@
typedef
ssize_t
vep_callback_t
(
struct
worker
*
w
,
ssize_t
l
,
enum
vgz_flag
flg
);
void
VEP_Init
(
struct
worker
*
w
,
vep_callback_t
*
cb
);
void
VEP_Parse
(
const
struct
worker
*
w
,
const
char
*
p
,
size_t
l
);
void
VEP_Parse
(
const
struct
busyobj
*
,
const
char
*
p
,
size_t
l
);
struct
vsb
*
VEP_Finish
(
const
struct
worker
*
w
);
bin/varnishd/cache/cache_esi_fetch.c
View file @
f33a076b
...
...
@@ -64,7 +64,7 @@ struct vef_priv {
*/
static
ssize_t
vef_read
(
struct
worker
*
wrk
,
struct
http_conn
*
htc
,
void
*
buf
,
ssize_t
buflen
,
vef_read
(
struct
http_conn
*
htc
,
void
*
buf
,
ssize_t
buflen
,
ssize_t
bytes
)
{
ssize_t
d
;
...
...
@@ -76,7 +76,7 @@ vef_read(struct worker *wrk, struct http_conn *htc, void *buf, ssize_t buflen,
if
(
d
<
bytes
)
bytes
=
d
;
}
return
(
HTC_Read
(
wrk
,
htc
,
buf
,
bytes
));
return
(
HTC_Read
(
htc
,
buf
,
bytes
));
}
/*---------------------------------------------------------------------
...
...
@@ -97,11 +97,11 @@ vfp_esi_bytes_uu(struct worker *wrk, const struct vef_priv *vef,
st
=
FetchStorage
(
wrk
,
0
);
if
(
st
==
NULL
)
return
(
-
1
);
wl
=
vef_read
(
wrk
,
htc
,
wl
=
vef_read
(
htc
,
st
->
ptr
+
st
->
len
,
st
->
space
-
st
->
len
,
bytes
);
if
(
wl
<=
0
)
return
(
wl
);
VEP_Parse
(
wrk
,
(
const
char
*
)
st
->
ptr
+
st
->
len
,
wl
);
VEP_Parse
(
wrk
->
busyobj
,
(
const
char
*
)
st
->
ptr
+
st
->
len
,
wl
);
st
->
len
+=
wl
;
wrk
->
busyobj
->
fetch_obj
->
len
+=
wl
;
bytes
-=
wl
;
...
...
@@ -129,7 +129,7 @@ vfp_esi_bytes_gu(struct worker *wrk, const struct vef_priv *vef,
while
(
bytes
>
0
)
{
if
(
VGZ_IbufEmpty
(
vg
)
&&
bytes
>
0
)
{
wl
=
vef_read
(
wrk
,
htc
,
vef
->
ibuf
,
vef
->
ibuf_sz
,
bytes
);
wl
=
vef_read
(
htc
,
vef
->
ibuf
,
vef
->
ibuf_sz
,
bytes
);
if
(
wl
<=
0
)
return
(
wl
);
VGZ_Ibuf
(
vg
,
vef
->
ibuf
,
wl
);
...
...
@@ -139,7 +139,7 @@ vfp_esi_bytes_gu(struct worker *wrk, const struct vef_priv *vef,
return
(
-
1
);
i
=
VGZ_Gunzip
(
vg
,
&
dp
,
&
dl
);
xxxassert
(
i
==
VGZ_OK
||
i
==
VGZ_END
);
VEP_Parse
(
wrk
,
dp
,
dl
);
VEP_Parse
(
wrk
->
busyobj
,
dp
,
dl
);
wrk
->
busyobj
->
fetch_obj
->
len
+=
dl
;
}
return
(
1
);
...
...
@@ -167,7 +167,7 @@ vfp_vep_inject(const struct worker *wrk, struct vef_priv *vef, ssize_t wl)
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
vef
,
VEF_MAGIC
);
VEP_Parse
(
wrk
,
vef
->
ibuf_i
,
wl
);
VEP_Parse
(
wrk
->
busyobj
,
vef
->
ibuf_i
,
wl
);
vef
->
ibuf_i
+=
wl
;
assert
(
vef
->
ibuf_o
>=
vef
->
ibuf
&&
vef
->
ibuf_o
<=
vef
->
ibuf_i
);
if
(
vef
->
error
)
{
...
...
@@ -235,7 +235,7 @@ vfp_vep_callback(struct worker *wrk, ssize_t l, enum vgz_flag flg)
*/
static
int
vfp_esi_bytes_ug
(
struct
worker
*
wrk
,
struct
vef_priv
*
vef
,
vfp_esi_bytes_ug
(
const
struct
worker
*
wrk
,
struct
vef_priv
*
vef
,
struct
http_conn
*
htc
,
ssize_t
bytes
)
{
ssize_t
wl
;
...
...
@@ -246,7 +246,7 @@ vfp_esi_bytes_ug(struct worker *wrk, struct vef_priv *vef,
while
(
bytes
>
0
)
{
wl
=
vef
->
ibuf_sz
-
(
vef
->
ibuf_i
-
vef
->
ibuf
);
wl
=
vef_read
(
wrk
,
htc
,
vef
->
ibuf_i
,
wl
,
bytes
);
wl
=
vef_read
(
htc
,
vef
->
ibuf_i
,
wl
,
bytes
);
if
(
wl
<=
0
)
return
(
wl
);
bytes
-=
wl
;
...
...
@@ -261,7 +261,7 @@ vfp_esi_bytes_ug(struct worker *wrk, struct vef_priv *vef,
*/
static
int
vfp_esi_bytes_gg
(
struct
worker
*
wrk
,
struct
vef_priv
*
vef
,
vfp_esi_bytes_gg
(
const
struct
worker
*
wrk
,
struct
vef_priv
*
vef
,
struct
http_conn
*
htc
,
size_t
bytes
)
{
ssize_t
wl
;
...
...
@@ -274,7 +274,7 @@ vfp_esi_bytes_gg(struct worker *wrk, struct vef_priv *vef,
CHECK_OBJ_NOTNULL
(
wrk
->
busyobj
,
BUSYOBJ_MAGIC
);
while
(
bytes
>
0
)
{
wl
=
vef_read
(
wrk
,
htc
,
vef
->
ibuf2
,
vef
->
ibuf2_sz
,
bytes
);
wl
=
vef_read
(
htc
,
vef
->
ibuf2
,
vef
->
ibuf2_sz
,
bytes
);
if
(
wl
<=
0
)
return
(
wl
);
bytes
-=
wl
;
...
...
bin/varnishd/cache/cache_esi_parse.c
View file @
f33a076b
...
...
@@ -549,16 +549,15 @@ vep_do_include(struct vep_state *vep, enum dowhat what)
*/
void
VEP_Parse
(
const
struct
worker
*
wrk
,
const
char
*
p
,
size_t
l
)
VEP_Parse
(
const
struct
busyobj
*
bo
,
const
char
*
p
,
size_t
l
)
{
struct
vep_state
*
vep
;
const
char
*
e
;
struct
vep_match
*
vm
;
int
i
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
->
busyobj
,
BUSYOBJ_MAGIC
);
vep
=
wrk
->
busyobj
->
vep
;
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
vep
=
bo
->
vep
;
CHECK_OBJ_NOTNULL
(
vep
,
VEP_MAGIC
);
assert
(
l
>
0
);
...
...
bin/varnishd/cache/cache_fetch.c
View file @
f33a076b
...
...
@@ -121,7 +121,7 @@ vfp_nop_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
l
=
st
->
space
-
st
->
len
;
if
(
l
>
bytes
)
l
=
bytes
;
wl
=
HTC_Read
(
wrk
,
htc
,
st
->
ptr
+
st
->
len
,
l
);
wl
=
HTC_Read
(
htc
,
st
->
ptr
+
st
->
len
,
l
);
if
(
wl
<=
0
)
return
(
wl
);
st
->
len
+=
wl
;
...
...
@@ -261,7 +261,7 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
do
{
/* Skip leading whitespace */
do
{
if
(
HTC_Read
(
wrk
,
htc
,
buf
,
1
)
<=
0
)
if
(
HTC_Read
(
htc
,
buf
,
1
)
<=
0
)
return
(
-
1
);
}
while
(
vct_islws
(
buf
[
0
]));
...
...
@@ -271,7 +271,7 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
/* Collect hex digits, skipping leading zeros */
for
(
u
=
1
;
u
<
sizeof
buf
;
u
++
)
{
do
{
if
(
HTC_Read
(
wrk
,
htc
,
buf
+
u
,
1
)
<=
0
)
if
(
HTC_Read
(
htc
,
buf
+
u
,
1
)
<=
0
)
return
(
-
1
);
}
while
(
u
==
1
&&
buf
[
0
]
==
'0'
&&
buf
[
u
]
==
'0'
);
if
(
!
vct_ishex
(
buf
[
u
]))
...
...
@@ -283,7 +283,7 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
/* Skip trailing white space */
while
(
vct_islws
(
buf
[
u
])
&&
buf
[
u
]
!=
'\n'
)
if
(
HTC_Read
(
wrk
,
htc
,
buf
+
u
,
1
)
<=
0
)
if
(
HTC_Read
(
htc
,
buf
+
u
,
1
)
<=
0
)
return
(
-
1
);
if
(
buf
[
u
]
!=
'\n'
)
...
...
@@ -297,10 +297,10 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
if
(
cl
>
0
&&
wrk
->
busyobj
->
vfp
->
bytes
(
wrk
,
htc
,
cl
)
<=
0
)
return
(
-
1
);
i
=
HTC_Read
(
wrk
,
htc
,
buf
,
1
);
i
=
HTC_Read
(
htc
,
buf
,
1
);
if
(
i
<=
0
)
return
(
-
1
);
if
(
buf
[
0
]
==
'\r'
&&
HTC_Read
(
wrk
,
htc
,
buf
,
1
)
<=
0
)
if
(
buf
[
0
]
==
'\r'
&&
HTC_Read
(
htc
,
buf
,
1
)
<=
0
)
return
(
-
1
);
if
(
buf
[
0
]
!=
'\n'
)
return
(
FetchError
(
wrk
,
"chunked tail no NL"
));
...
...
@@ -352,7 +352,7 @@ FetchReqBody(const struct sess *sp, int sendbody)
rdcnt
=
sizeof
buf
;
else
rdcnt
=
content_length
;
rdcnt
=
HTC_Read
(
sp
->
wrk
,
sp
->
req
->
htc
,
buf
,
rdcnt
);
rdcnt
=
HTC_Read
(
sp
->
req
->
htc
,
buf
,
rdcnt
);
if
(
rdcnt
<=
0
)
return
(
1
);
content_length
-=
rdcnt
;
...
...
@@ -447,7 +447,7 @@ FetchHdr(struct sess *sp, int need_host_hdr, int sendbody)
/* Receive response */
HTC_Init
(
htc
,
wrk
->
busyobj
->
ws
,
vc
->
fd
,
vc
->
vsl
_id
,
HTC_Init
(
htc
,
wrk
->
busyobj
->
ws
,
vc
->
fd
,
vc
->
vsl
,
cache_param
->
http_resp_size
,
cache_param
->
http_resp_hdr_len
);
...
...
bin/varnishd/cache/cache_gzip.c
View file @
f33a076b
...
...
@@ -471,7 +471,7 @@ vfp_gunzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
l
=
vg
->
m_sz
;
if
(
l
>
bytes
)
l
=
bytes
;
wl
=
HTC_Read
(
wrk
,
htc
,
vg
->
m_buf
,
l
);
wl
=
HTC_Read
(
htc
,
vg
->
m_buf
,
l
);
if
(
wl
<=
0
)
return
(
wl
);
VGZ_Ibuf
(
vg
,
vg
->
m_buf
,
wl
);
...
...
@@ -554,7 +554,7 @@ vfp_gzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
l
=
vg
->
m_sz
;
if
(
l
>
bytes
)
l
=
bytes
;
wl
=
HTC_Read
(
wrk
,
htc
,
vg
->
m_buf
,
l
);
wl
=
HTC_Read
(
htc
,
vg
->
m_buf
,
l
);
if
(
wl
<=
0
)
return
(
wl
);
VGZ_Ibuf
(
vg
,
vg
->
m_buf
,
wl
);
...
...
@@ -650,7 +650,7 @@ vfp_testgzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
l
=
st
->
space
-
st
->
len
;
if
(
l
>
bytes
)
l
=
bytes
;
wl
=
HTC_Read
(
wrk
,
htc
,
st
->
ptr
+
st
->
len
,
l
);
wl
=
HTC_Read
(
htc
,
st
->
ptr
+
st
->
len
,
l
);
if
(
wl
<=
0
)
return
(
wl
);
bytes
-=
wl
;
...
...
bin/varnishd/cache/cache_httpconn.c
View file @
f33a076b
...
...
@@ -88,14 +88,14 @@ htc_header_complete(txt *t)
/*--------------------------------------------------------------------*/
void
HTC_Init
(
struct
http_conn
*
htc
,
struct
ws
*
ws
,
int
fd
,
unsigned
vsl_id
,
HTC_Init
(
struct
http_conn
*
htc
,
struct
ws
*
ws
,
int
fd
,
struct
vsl_log
*
vsl
,
unsigned
maxbytes
,
unsigned
maxhdr
)
{
htc
->
magic
=
HTTP_CONN_MAGIC
;
htc
->
ws
=
ws
;
htc
->
fd
=
fd
;
htc
->
vsl
_id
=
vsl_id
;
htc
->
vsl
=
vsl
;
htc
->
maxbytes
=
maxbytes
;
htc
->
maxhdr
=
maxhdr
;
...
...
@@ -200,13 +200,12 @@ HTC_Rx(struct http_conn *htc)
*/
ssize_t
HTC_Read
(
struct
worker
*
w
,
struct
http_conn
*
htc
,
void
*
d
,
size_t
len
)
HTC_Read
(
struct
http_conn
*
htc
,
void
*
d
,
size_t
len
)
{
size_t
l
;
unsigned
char
*
p
;
ssize_t
i
;
CHECK_OBJ_NOTNULL
(
w
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
htc
,
HTTP_CONN_MAGIC
);
l
=
0
;
p
=
d
;
...
...
@@ -225,7 +224,7 @@ HTC_Read(struct worker *w, struct http_conn *htc, void *d, size_t len)
return
(
l
);
i
=
read
(
htc
->
fd
,
p
,
len
);
if
(
i
<
0
)
{
WSL
(
w
->
vsl
,
SLT_FetchError
,
htc
->
vsl_id
,
"%s"
,
strerror
(
errno
));
WSL
(
htc
->
vsl
,
SLT_FetchError
,
-
1
,
"%s"
,
strerror
(
errno
));
return
(
i
);
}
return
(
i
+
l
);
...
...
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