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
1910640d
Commit
1910640d
authored
Feb 26, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Encapsulate Expect: and Connection: processing in a transport
agnostic function.
parent
22857119
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
35 deletions
+53
-35
cache.h
bin/varnishd/cache/cache.h
+1
-0
cache_http.c
bin/varnishd/cache/cache_http.c
+1
-2
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+49
-2
cache_http1_fsm.c
bin/varnishd/http1/cache_http1_fsm.c
+2
-31
No files found.
bin/varnishd/cache/cache.h
View file @
1910640d
...
...
@@ -940,6 +940,7 @@ void VRB_Free(struct req *);
/* cache_req_fsm.c [CNT] */
enum
req_fsm_nxt
CNT_Request
(
struct
worker
*
,
struct
req
*
);
void
CNT_AcctLogCharge
(
struct
dstat
*
,
struct
req
*
);
int
CNT_GotReq
(
struct
worker
*
,
struct
req
*
);
/* cache_session.c [SES] */
struct
sess
*
SES_New
(
struct
pool
*
);
...
...
bin/varnishd/cache/cache_http.c
View file @
1910640d
...
...
@@ -664,13 +664,12 @@ http_DoConnection(struct http *hp)
retval
=
SC_NULL
;
/* Refuse removal of well-known-headers if they would pass. */
/*lint -save -e506 */
/*lint -save -e506
[constant value boolean]
*/
#define HTTPH(a, x, c) \
if (!((c) & HTTPH_R_PASS) && \
strlen(a) == u && !strncasecmp(a, b, u)) \
return (SC_RX_BAD);
#include "tbl/http_headers.h"
/*lint -restore */
v
=
http_findhdr
(
hp
,
u
,
b
);
...
...
bin/varnishd/cache/cache_req_fsm.c
View file @
1910640d
...
...
@@ -49,6 +49,51 @@
#include "vsha256.h"
#include "vtim.h"
/*--------------------------------------------------------------------
* Handle "Expect:" and "Connection:" on incoming request
*/
int
CNT_GotReq
(
struct
worker
*
wrk
,
struct
req
*
req
)
{
const
char
*
p
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
->
http
,
HTTP_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
->
transport
,
TRANSPORT_MAGIC
);
AN
(
req
->
transport
->
minimal_response
);
if
(
http_GetHdr
(
req
->
http
,
H_Expect
,
&
p
))
{
if
(
strcasecmp
(
p
,
"100-continue"
))
{
req
->
doclose
=
SC_RX_JUNK
;
(
void
)
req
->
transport
->
minimal_response
(
req
,
417
);
wrk
->
stats
->
client_req_417
++
;
return
(
-
1
);
}
if
(
req
->
http
->
protover
>=
11
&&
req
->
htc
->
pipeline_b
==
NULL
)
req
->
want100cont
=
1
;
http_Unset
(
req
->
http
,
H_Expect
);
}
wrk
->
stats
->
client_req
++
;
wrk
->
stats
->
s_req
++
;
AZ
(
req
->
err_code
);
req
->
ws_req
=
WS_Snapshot
(
req
->
ws
);
req
->
doclose
=
http_DoConnection
(
req
->
http
);
if
(
req
->
doclose
==
SC_RX_BAD
)
{
(
void
)
req
->
transport
->
minimal_response
(
req
,
400
);
return
(
-
1
);
}
assert
(
req
->
req_body_status
!=
REQ_BODY_INIT
);
HTTP_Copy
(
req
->
http0
,
req
->
http
);
// For ESI & restart
return
(
0
);
}
/*--------------------------------------------------------------------
* Deliver an object to client
*/
...
...
@@ -766,8 +811,10 @@ cnt_recv(struct worker *wrk, struct req *req)
if
(
req
->
want100cont
&&
!
req
->
late100cont
)
{
req
->
want100cont
=
0
;
if
(
req
->
transport
->
minimal_response
(
req
,
100
))
return
(
-
1
);
if
(
req
->
transport
->
minimal_response
(
req
,
100
))
{
req
->
doclose
=
SC_REM_CLOSE
;
return
(
REQ_FSM_DONE
);
}
}
/* Attempts to cache req.body may fail */
...
...
bin/varnishd/http1/cache_http1_fsm.c
View file @
1910640d
...
...
@@ -255,7 +255,7 @@ struct transport HTTP1_transport = {
*/
static
inline
void
http1_abort
(
struct
req
*
req
,
u
nsigned
status
)
http1_abort
(
struct
req
*
req
,
u
int16_t
status
)
{
AN
(
req
->
doclose
);
assert
(
status
>=
400
);
...
...
@@ -265,7 +265,6 @@ http1_abort(struct req *req, unsigned status)
static
int
http1_dissect
(
struct
worker
*
wrk
,
struct
req
*
req
)
{
const
char
*
p
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
...
...
@@ -320,35 +319,7 @@ http1_dissect(struct worker *wrk, struct req *req)
WRONG
(
"Unknown req_body_status situation"
);
}
if
(
http_GetHdr
(
req
->
http
,
H_Expect
,
&
p
))
{
if
(
strcasecmp
(
p
,
"100-continue"
))
{
req
->
doclose
=
SC_RX_JUNK
;
http1_abort
(
req
,
417
);
wrk
->
stats
->
client_req_417
++
;
return
(
-
1
);
}
if
(
req
->
http
->
protover
>=
11
&&
req
->
htc
->
pipeline_b
==
NULL
)
req
->
want100cont
=
1
;
http_Unset
(
req
->
http
,
H_Expect
);
}
wrk
->
stats
->
client_req
++
;
wrk
->
stats
->
s_req
++
;
AZ
(
req
->
err_code
);
req
->
ws_req
=
WS_Snapshot
(
req
->
ws
);
req
->
doclose
=
http_DoConnection
(
req
->
http
);
if
(
req
->
doclose
==
SC_RX_BAD
)
{
http1_abort
(
req
,
400
);
return
(
-
1
);
}
assert
(
req
->
req_body_status
!=
REQ_BODY_INIT
);
HTTP_Copy
(
req
->
http0
,
req
->
http
);
// For ESI & restart
return
(
0
);
return
(
CNT_GotReq
(
wrk
,
req
));
}
/*----------------------------------------------------------------------
...
...
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