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
92d43d17
Commit
92d43d17
authored
Jan 22, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add FetchStorage() which will feed storage segments into objects
via sp->wrk->storage.
parent
76c392cc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
50 deletions
+33
-50
cache.h
bin/varnishd/cache.h
+1
-0
cache_esi_fetch.c
bin/varnishd/cache_esi_fetch.c
+1
-21
cache_fetch.c
bin/varnishd/cache_fetch.c
+28
-15
cache_gzip.c
bin/varnishd/cache_gzip.c
+3
-14
No files found.
bin/varnishd/cache.h
View file @
92d43d17
...
@@ -619,6 +619,7 @@ void EXP_Touch(struct object *o, double tnow);
...
@@ -619,6 +619,7 @@ void EXP_Touch(struct object *o, double tnow);
int
EXP_NukeOne
(
const
struct
sess
*
sp
,
const
struct
lru
*
lru
);
int
EXP_NukeOne
(
const
struct
sess
*
sp
,
const
struct
lru
*
lru
);
/* cache_fetch.c */
/* cache_fetch.c */
int
FetchStorage
(
const
struct
sess
*
sp
);
int
FetchHdr
(
struct
sess
*
sp
);
int
FetchHdr
(
struct
sess
*
sp
);
int
FetchBody
(
struct
sess
*
sp
);
int
FetchBody
(
struct
sess
*
sp
);
int
FetchReqBody
(
struct
sess
*
sp
);
int
FetchReqBody
(
struct
sess
*
sp
);
...
...
bin/varnishd/cache_esi_fetch.c
View file @
92d43d17
...
@@ -55,14 +55,8 @@ vfp_esi_bytes_uu(struct sess *sp, struct http_conn *htc, size_t bytes)
...
@@ -55,14 +55,8 @@ vfp_esi_bytes_uu(struct sess *sp, struct http_conn *htc, size_t bytes)
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
while
(
bytes
>
0
)
{
while
(
bytes
>
0
)
{
if
(
sp
->
wrk
->
storage
==
NULL
)
{
if
(
FetchStorage
(
sp
))
l
=
params
->
fetch_chunksize
*
1024LL
;
sp
->
wrk
->
storage
=
STV_alloc
(
sp
,
l
);
}
if
(
sp
->
wrk
->
storage
==
NULL
)
{
errno
=
ENOMEM
;
return
(
-
1
);
return
(
-
1
);
}
st
=
sp
->
wrk
->
storage
;
st
=
sp
->
wrk
->
storage
;
l
=
st
->
space
-
st
->
len
;
l
=
st
->
space
-
st
->
len
;
if
(
l
>
bytes
)
if
(
l
>
bytes
)
...
@@ -83,12 +77,6 @@ vfp_esi_bytes_uu(struct sess *sp, struct http_conn *htc, size_t bytes)
...
@@ -83,12 +77,6 @@ vfp_esi_bytes_uu(struct sess *sp, struct http_conn *htc, size_t bytes)
VEP_parse
(
sp
,
(
const
char
*
)
st
->
ptr
+
st
->
len
,
w
);
VEP_parse
(
sp
,
(
const
char
*
)
st
->
ptr
+
st
->
len
,
w
);
st
->
len
+=
w
;
st
->
len
+=
w
;
sp
->
obj
->
len
+=
w
;
sp
->
obj
->
len
+=
w
;
if
(
st
->
len
==
st
->
space
)
{
VTAILQ_INSERT_TAIL
(
&
sp
->
obj
->
store
,
sp
->
wrk
->
storage
,
list
);
sp
->
wrk
->
storage
=
NULL
;
st
=
NULL
;
}
bytes
-=
w
;
bytes
-=
w
;
}
}
return
(
1
);
return
(
1
);
...
@@ -205,14 +193,6 @@ vfp_esi_bytes_ug(struct sess *sp, struct http_conn *htc, size_t bytes)
...
@@ -205,14 +193,6 @@ vfp_esi_bytes_ug(struct sess *sp, struct http_conn *htc, size_t bytes)
CHECK_OBJ_NOTNULL
(
vef
,
VEF_MAGIC
);
CHECK_OBJ_NOTNULL
(
vef
,
VEF_MAGIC
);
while
(
bytes
>
0
)
{
while
(
bytes
>
0
)
{
if
(
sp
->
wrk
->
storage
==
NULL
)
{
l
=
params
->
fetch_chunksize
*
1024LL
;
sp
->
wrk
->
storage
=
STV_alloc
(
sp
,
l
);
}
if
(
sp
->
wrk
->
storage
==
NULL
)
{
errno
=
ENOMEM
;
return
(
-
1
);
}
l
=
sizeof
ibuf
;
l
=
sizeof
ibuf
;
if
(
l
>
bytes
)
if
(
l
>
bytes
)
l
=
bytes
;
l
=
bytes
;
...
...
bin/varnishd/cache_fetch.c
View file @
92d43d17
...
@@ -91,16 +91,8 @@ vfp_nop_bytes(struct sess *sp, struct http_conn *htc, size_t bytes)
...
@@ -91,16 +91,8 @@ vfp_nop_bytes(struct sess *sp, struct http_conn *htc, size_t bytes)
struct
storage
*
st
;
struct
storage
*
st
;
while
(
bytes
>
0
)
{
while
(
bytes
>
0
)
{
if
(
sp
->
wrk
->
storage
==
NULL
)
{
if
(
FetchStorage
(
sp
))
l
=
fetchfrag
;
if
(
l
==
0
)
l
=
params
->
fetch_chunksize
*
1024LL
;
sp
->
wrk
->
storage
=
STV_alloc
(
sp
,
l
);
}
if
(
sp
->
wrk
->
storage
==
NULL
)
{
errno
=
ENOMEM
;
return
(
-
1
);
return
(
-
1
);
}
st
=
sp
->
wrk
->
storage
;
st
=
sp
->
wrk
->
storage
;
l
=
st
->
space
-
st
->
len
;
l
=
st
->
space
-
st
->
len
;
if
(
l
>
bytes
)
if
(
l
>
bytes
)
...
@@ -110,12 +102,6 @@ vfp_nop_bytes(struct sess *sp, struct http_conn *htc, size_t bytes)
...
@@ -110,12 +102,6 @@ vfp_nop_bytes(struct sess *sp, struct http_conn *htc, size_t bytes)
return
(
w
);
return
(
w
);
st
->
len
+=
w
;
st
->
len
+=
w
;
sp
->
obj
->
len
+=
w
;
sp
->
obj
->
len
+=
w
;
if
(
st
->
len
==
st
->
space
)
{
VTAILQ_INSERT_TAIL
(
&
sp
->
obj
->
store
,
sp
->
wrk
->
storage
,
list
);
sp
->
wrk
->
storage
=
NULL
;
st
=
NULL
;
}
bytes
-=
w
;
bytes
-=
w
;
}
}
return
(
1
);
return
(
1
);
...
@@ -156,6 +142,33 @@ static struct vfp vfp_nop = {
...
@@ -156,6 +142,33 @@ static struct vfp vfp_nop = {
.
end
=
vfp_nop_end
,
.
end
=
vfp_nop_end
,
};
};
/*--------------------------------------------------------------------
* Fetch Storage
*/
int
FetchStorage
(
const
struct
sess
*
sp
)
{
ssize_t
l
;
if
(
sp
->
wrk
->
storage
!=
NULL
&&
sp
->
wrk
->
storage
->
len
==
sp
->
wrk
->
storage
->
space
)
{
VTAILQ_INSERT_TAIL
(
&
sp
->
obj
->
store
,
sp
->
wrk
->
storage
,
list
);
sp
->
wrk
->
storage
=
NULL
;
}
if
(
sp
->
wrk
->
storage
==
NULL
)
{
l
=
fetchfrag
;
if
(
l
==
0
)
l
=
params
->
fetch_chunksize
*
1024LL
;
sp
->
wrk
->
storage
=
STV_alloc
(
sp
,
l
);
}
if
(
sp
->
wrk
->
storage
==
NULL
)
{
errno
=
ENOMEM
;
return
(
-
1
);
}
return
(
0
);
}
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
* Convert a string to a size_t safely
* Convert a string to a size_t safely
*/
*/
...
...
bin/varnishd/cache_gzip.c
View file @
92d43d17
...
@@ -231,21 +231,10 @@ VGZ_ObufStorage(const struct sess *sp, struct vgz *vg)
...
@@ -231,21 +231,10 @@ VGZ_ObufStorage(const struct sess *sp, struct vgz *vg)
{
{
struct
storage
*
st
;
struct
storage
*
st
;
if
(
FetchStorage
(
sp
))
return
(
-
1
);
st
=
sp
->
wrk
->
storage
;
st
=
sp
->
wrk
->
storage
;
if
(
st
!=
NULL
&&
st
->
len
==
st
->
space
)
{
VTAILQ_INSERT_TAIL
(
&
sp
->
obj
->
store
,
st
,
list
);
sp
->
wrk
->
storage
=
NULL
;
st
=
NULL
;
vg
->
obuf
=
NULL
;
}
if
(
st
==
NULL
)
{
st
=
STV_alloc
(
sp
,
params
->
fetch_chunksize
*
1024LL
);
if
(
st
==
NULL
)
{
errno
=
ENOMEM
;
return
(
-
1
);
}
sp
->
wrk
->
storage
=
st
;
}
vg
->
obuf
=
st
;
vg
->
obuf
=
st
;
VGZ_Obuf
(
vg
,
st
->
ptr
+
st
->
len
,
st
->
space
-
st
->
len
);
VGZ_Obuf
(
vg
,
st
->
ptr
+
st
->
len
,
st
->
space
-
st
->
len
);
...
...
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