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
c94a4271
Commit
c94a4271
authored
Jan 30, 2013
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move http_Write() to HTTP1_Write(). The name is still not really
good, but at least it belongs here.
parent
2bbb032b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
47 deletions
+47
-47
cache.h
bin/varnishd/cache/cache.h
+1
-1
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+1
-1
cache_http.c
bin/varnishd/cache/cache_http.c
+0
-43
cache_http1_proto.c
bin/varnishd/cache/cache_http1_proto.c
+43
-0
cache_pipe.c
bin/varnishd/cache/cache_pipe.c
+1
-1
cache_response.c
bin/varnishd/cache/cache_response.c
+1
-1
No files found.
bin/varnishd/cache/cache.h
View file @
c94a4271
...
...
@@ -851,7 +851,6 @@ const char *http_StatusMessage(unsigned);
unsigned
http_EstimateWS
(
const
struct
http
*
fm
,
unsigned
how
,
uint16_t
*
nhd
);
void
HTTP_Init
(
void
);
void
http_ClrHeader
(
struct
http
*
to
);
unsigned
http_Write
(
const
struct
worker
*
w
,
const
struct
http
*
hp
,
int
resp
);
void
http_SetResp
(
struct
http
*
to
,
const
char
*
proto
,
uint16_t
status
,
const
char
*
response
);
void
http_FilterReq
(
const
struct
req
*
,
unsigned
how
);
...
...
@@ -899,6 +898,7 @@ ssize_t HTTP1_Read(struct http_conn *htc, void *d, size_t len);
enum
htc_status_e
HTTP1_Complete
(
struct
http_conn
*
htc
);
uint16_t
HTTP1_DissectRequest
(
struct
req
*
);
uint16_t
HTTP1_DissectResponse
(
struct
http
*
sp
,
const
struct
http_conn
*
htc
);
unsigned
HTTP1_Write
(
const
struct
worker
*
w
,
const
struct
http
*
hp
,
int
resp
);
#define HTTPH(a, b, c) extern char b[];
#include "tbl/http_headers.h"
...
...
bin/varnishd/cache/cache_fetch.c
View file @
c94a4271
...
...
@@ -402,7 +402,7 @@ FetchHdr(struct req *req, int need_host_hdr, int sendbody)
(
void
)
VTCP_blocking
(
vc
->
fd
);
/* XXX: we should timeout instead */
WRW_Reserve
(
wrk
,
&
vc
->
fd
,
bo
->
vsl
,
req
->
t_req
);
/* XXX t_resp ? */
(
void
)
http
_Write
(
wrk
,
hp
,
0
);
/* XXX: stats ? */
(
void
)
HTTP1
_Write
(
wrk
,
hp
,
0
);
/* XXX: stats ? */
/* Deal with any message-body the request might (still) have */
i
=
0
;
...
...
bin/varnishd/cache/cache_http.c
View file @
c94a4271
...
...
@@ -793,49 +793,6 @@ HTTP_Copy(struct http *to, const struct http * const fm)
/*--------------------------------------------------------------------*/
unsigned
http_Write
(
const
struct
worker
*
w
,
const
struct
http
*
hp
,
int
resp
)
{
unsigned
u
,
l
;
if
(
resp
)
{
l
=
WRW_WriteH
(
w
,
&
hp
->
hd
[
HTTP_HDR_PROTO
],
" "
);
http_VSLH
(
hp
,
HTTP_HDR_PROTO
);
hp
->
hd
[
HTTP_HDR_STATUS
].
b
=
WS_Alloc
(
hp
->
ws
,
4
);
AN
(
hp
->
hd
[
HTTP_HDR_STATUS
].
b
);
sprintf
(
hp
->
hd
[
HTTP_HDR_STATUS
].
b
,
"%3d"
,
hp
->
status
);
hp
->
hd
[
HTTP_HDR_STATUS
].
e
=
hp
->
hd
[
HTTP_HDR_STATUS
].
b
+
3
;
l
+=
WRW_WriteH
(
w
,
&
hp
->
hd
[
HTTP_HDR_STATUS
],
" "
);
http_VSLH
(
hp
,
HTTP_HDR_STATUS
);
l
+=
WRW_WriteH
(
w
,
&
hp
->
hd
[
HTTP_HDR_RESPONSE
],
"
\r\n
"
);
http_VSLH
(
hp
,
HTTP_HDR_RESPONSE
);
}
else
{
AN
(
hp
->
hd
[
HTTP_HDR_URL
].
b
);
l
=
WRW_WriteH
(
w
,
&
hp
->
hd
[
HTTP_HDR_METHOD
],
" "
);
http_VSLH
(
hp
,
HTTP_HDR_METHOD
);
l
+=
WRW_WriteH
(
w
,
&
hp
->
hd
[
HTTP_HDR_URL
],
" "
);
http_VSLH
(
hp
,
HTTP_HDR_URL
);
l
+=
WRW_WriteH
(
w
,
&
hp
->
hd
[
HTTP_HDR_PROTO
],
"
\r\n
"
);
http_VSLH
(
hp
,
HTTP_HDR_PROTO
);
}
for
(
u
=
HTTP_HDR_FIRST
;
u
<
hp
->
nhd
;
u
++
)
{
if
(
hp
->
hd
[
u
].
b
==
NULL
)
continue
;
AN
(
hp
->
hd
[
u
].
b
);
AN
(
hp
->
hd
[
u
].
e
);
l
+=
WRW_WriteH
(
w
,
&
hp
->
hd
[
u
],
"
\r\n
"
);
http_VSLH
(
hp
,
u
);
}
l
+=
WRW_Write
(
w
,
"
\r\n
"
,
-
1
);
return
(
l
);
}
/*--------------------------------------------------------------------*/
void
HTTP_Init
(
void
)
{
...
...
bin/varnishd/cache/cache_http1_proto.c
View file @
c94a4271
...
...
@@ -482,3 +482,46 @@ HTTP1_DissectResponse(struct http *hp, const struct http_conn *htc)
return
(
retval
);
}
/*--------------------------------------------------------------------*/
unsigned
HTTP1_Write
(
const
struct
worker
*
w
,
const
struct
http
*
hp
,
int
resp
)
{
unsigned
u
,
l
;
if
(
resp
)
{
l
=
WRW_WriteH
(
w
,
&
hp
->
hd
[
HTTP_HDR_PROTO
],
" "
);
http_VSLH
(
hp
,
HTTP_HDR_PROTO
);
hp
->
hd
[
HTTP_HDR_STATUS
].
b
=
WS_Alloc
(
hp
->
ws
,
4
);
AN
(
hp
->
hd
[
HTTP_HDR_STATUS
].
b
);
sprintf
(
hp
->
hd
[
HTTP_HDR_STATUS
].
b
,
"%3d"
,
hp
->
status
);
hp
->
hd
[
HTTP_HDR_STATUS
].
e
=
hp
->
hd
[
HTTP_HDR_STATUS
].
b
+
3
;
l
+=
WRW_WriteH
(
w
,
&
hp
->
hd
[
HTTP_HDR_STATUS
],
" "
);
http_VSLH
(
hp
,
HTTP_HDR_STATUS
);
l
+=
WRW_WriteH
(
w
,
&
hp
->
hd
[
HTTP_HDR_RESPONSE
],
"
\r\n
"
);
http_VSLH
(
hp
,
HTTP_HDR_RESPONSE
);
}
else
{
AN
(
hp
->
hd
[
HTTP_HDR_URL
].
b
);
l
=
WRW_WriteH
(
w
,
&
hp
->
hd
[
HTTP_HDR_METHOD
],
" "
);
http_VSLH
(
hp
,
HTTP_HDR_METHOD
);
l
+=
WRW_WriteH
(
w
,
&
hp
->
hd
[
HTTP_HDR_URL
],
" "
);
http_VSLH
(
hp
,
HTTP_HDR_URL
);
l
+=
WRW_WriteH
(
w
,
&
hp
->
hd
[
HTTP_HDR_PROTO
],
"
\r\n
"
);
http_VSLH
(
hp
,
HTTP_HDR_PROTO
);
}
for
(
u
=
HTTP_HDR_FIRST
;
u
<
hp
->
nhd
;
u
++
)
{
if
(
hp
->
hd
[
u
].
b
==
NULL
)
continue
;
AN
(
hp
->
hd
[
u
].
b
);
AN
(
hp
->
hd
[
u
].
e
);
l
+=
WRW_WriteH
(
w
,
&
hp
->
hd
[
u
],
"
\r\n
"
);
http_VSLH
(
hp
,
u
);
}
l
+=
WRW_Write
(
w
,
"
\r\n
"
,
-
1
);
return
(
l
);
}
bin/varnishd/cache/cache_pipe.c
View file @
c94a4271
...
...
@@ -82,7 +82,7 @@ PipeRequest(struct req *req)
(
void
)
VTCP_blocking
(
vc
->
fd
);
WRW_Reserve
(
wrk
,
&
vc
->
fd
,
bo
->
vsl
,
req
->
t_req
);
req
->
acct_req
.
hdrbytes
+=
http
_Write
(
wrk
,
bo
->
bereq
,
0
);
req
->
acct_req
.
hdrbytes
+=
HTTP1
_Write
(
wrk
,
bo
->
bereq
,
0
);
if
(
req
->
htc
->
pipeline
.
b
!=
NULL
)
req
->
acct_req
.
bodybytes
+=
...
...
bin/varnishd/cache/cache_response.c
View file @
c94a4271
...
...
@@ -260,7 +260,7 @@ RES_WriteObj(struct req *req)
*/
if
(
!
(
req
->
res_mode
&
RES_ESI_CHILD
))
req
->
acct_req
.
hdrbytes
+=
http
_Write
(
req
->
wrk
,
req
->
resp
,
1
);
HTTP1
_Write
(
req
->
wrk
,
req
->
resp
,
1
);
if
(
!
req
->
wantbody
)
req
->
res_mode
&=
~
RES_CHUNKED
;
...
...
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