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
279bc2ea
Commit
279bc2ea
authored
Aug 07, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move most of CNT::start into HTTP1_fsm where it belongs.
parent
27f24b57
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
42 deletions
+53
-42
cache_http1_fsm.c
bin/varnishd/cache/cache_http1_fsm.c
+52
-2
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+1
-40
No files found.
bin/varnishd/cache/cache_http1_fsm.c
View file @
279bc2ea
...
...
@@ -238,13 +238,60 @@ http1_cleanup(struct sess *sp, struct worker *wrk, struct req *req)
}
}
/*--------------------------------------------------------------------
*/
static
int
http1_dissect
(
struct
worker
*
wrk
,
struct
req
*
req
)
{
const
char
*
r
=
"HTTP/1.1 100 Continue
\r\n\r\n
"
;
char
*
p
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
/* Borrow VCL reference from worker thread */
VCL_Refresh
(
&
wrk
->
vcl
);
req
->
vcl
=
wrk
->
vcl
;
wrk
->
vcl
=
NULL
;
HTTP_Setup
(
req
->
http
,
req
->
ws
,
req
->
vsl
,
HTTP_Req
);
req
->
err_code
=
http_DissectRequest
(
req
);
/* If we could not even parse the request, just close */
if
(
req
->
err_code
==
400
)
{
SES_Close
(
req
->
sp
,
SC_RX_JUNK
);
return
(
1
);
}
req
->
ws_req
=
WS_Snapshot
(
req
->
ws
);
req
->
doclose
=
http_DoConnection
(
req
->
http
);
/* XXX: Expect headers are a mess */
if
(
req
->
err_code
==
0
&&
http_GetHdr
(
req
->
http
,
H_Expect
,
&
p
))
{
if
(
strcasecmp
(
p
,
"100-continue"
))
{
req
->
err_code
=
417
;
}
else
if
(
strlen
(
r
)
!=
write
(
req
->
sp
->
fd
,
r
,
strlen
(
r
)))
{
SES_Close
(
req
->
sp
,
SC_REM_CLOSE
);
return
(
1
);
}
}
http_Unset
(
req
->
http
,
H_Expect
);
/* XXX: pull in req-body and make it available instead. */
req
->
reqbodydone
=
0
;
HTTP_Copy
(
req
->
http0
,
req
->
http
);
// For ESI & restart
return
(
0
);
}
/*--------------------------------------------------------------------
*/
void
HTTP1_Session
(
struct
worker
*
wrk
,
struct
req
*
req
)
{
int
done
;
int
done
=
0
;
struct
sess
*
sp
;
enum
http1_cleanup_ret
sdr
;
...
...
@@ -284,6 +331,9 @@ HTTP1_Session(struct worker *wrk, struct req *req)
req
->
req_step
==
R_STP_START
);
if
(
sp
->
sess_step
==
S_STP_WORKING
)
{
if
(
req
->
req_step
==
R_STP_START
)
done
=
http1_dissect
(
wrk
,
req
);
if
(
done
==
0
)
done
=
CNT_Request
(
wrk
,
req
);
if
(
done
==
2
)
return
;
...
...
bin/varnishd/cache/cache_req_fsm.c
View file @
279bc2ea
...
...
@@ -1181,14 +1181,12 @@ DOT start -> DONE [label=errors]
static
int
cnt_start
(
struct
worker
*
wrk
,
struct
req
*
req
)
{
char
*
p
;
const
char
*
r
=
"HTTP/1.1 100 Continue
\r\n\r\n
"
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
AZ
(
req
->
restarts
);
AZ
(
req
->
obj
);
A
Z
(
req
->
vcl
);
A
N
(
req
->
vcl
);
AZ
(
req
->
esi_level
);
assert
(
!
isnan
(
req
->
t_req
));
...
...
@@ -1201,45 +1199,8 @@ cnt_start(struct worker *wrk, struct req *req)
VSLb
(
req
->
vsl
,
SLT_ReqStart
,
"%s %s %u"
,
req
->
sp
->
addr
,
req
->
sp
->
port
,
req
->
xid
);
/* Borrow VCL reference from worker thread */
VCL_Refresh
(
&
wrk
->
vcl
);
req
->
vcl
=
wrk
->
vcl
;
wrk
->
vcl
=
NULL
;
EXP_Clr
(
&
req
->
exp
);
HTTP_Setup
(
req
->
http
,
req
->
ws
,
req
->
vsl
,
HTTP_Req
);
req
->
err_code
=
http_DissectRequest
(
req
);
/* If we could not even parse the request, just close */
if
(
req
->
err_code
==
400
)
{
SES_Close
(
req
->
sp
,
SC_RX_JUNK
);
return
(
1
);
}
req
->
ws_req
=
WS_Snapshot
(
req
->
ws
);
req
->
doclose
=
http_DoConnection
(
req
->
http
);
/*
* We want to deal with Expect: headers the first time we
* attempt the request, and remove them before we move on.
*/
if
(
req
->
err_code
==
0
&&
http_GetHdr
(
req
->
http
,
H_Expect
,
&
p
))
{
if
(
strcasecmp
(
p
,
"100-continue"
))
{
req
->
err_code
=
417
;
}
else
if
(
strlen
(
r
)
!=
write
(
req
->
sp
->
fd
,
r
,
strlen
(
r
)))
{
SES_Close
(
req
->
sp
,
SC_REM_CLOSE
);
return
(
1
);
}
}
http_Unset
(
req
->
http
,
H_Expect
);
/* XXX: pull in req-body and make it available instead. */
req
->
reqbodydone
=
0
;
HTTP_Copy
(
req
->
http0
,
req
->
http
);
/* Copy for restart/ESI use */
if
(
req
->
err_code
)
req
->
req_step
=
R_STP_ERROR
;
else
...
...
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