Hi Rachel, hi Willy,
just a few comments about coding style, unrelated to the discussion about
the actual code:
> + if(s->req->flags & CF_READ_TIMEOUT)
> + {
You can move the opening square bracket to the first line (as we do in
the rest of the code).
> @@ -2401,9 +2401,21 @@ struct task *process_session(struct task
>
> if ((s->rep->flags & (CF_AUTO_CLOSE|CF_SHUTR)) == 0 &&
> (tick_isset(s->req->wex) || tick_isset(s->rep->rex))) {
> + if((s->txn.req.body_len + s->txn.req.eoh) < s->req->total) {
> s->req->flags |= CF_READ_NOEXP;
> s->req->rex = TICK_ETERNITY;
> }
> + else
> + {
> + if(!(s->req->flags & CF_READ_TIMEOUT))
> + {
> + s->req->analysers |= AN_REQ_WAIT_HTTP;
> + if(s->txn.req.msg_state >= HTTP_MSG_BODY) {
> + s->txn.req.msg_state = HTTP_MSG_LAST_LF;
> + }
> + }
> + }
> + }
Same as before, plus its lacks proper indention. The else/if can be
simplified as well.
Its much more readable like this:
if ((s->rep->flags & (CF_AUTO_CLOSE|CF_SHUTR)) == 0 &&
(tick_isset(s->req->wex) || tick_isset(s->rep->rex))) {
- s->req->flags |= CF_READ_NOEXP;
- s->req->rex = TICK_ETERNITY;
+ if((s->txn.req.body_len + s->txn.req.eoh) < s->req->total) {
+ s->req->flags |= CF_READ_NOEXP;
+ s->req->rex = TICK_ETERNITY;
+ } else if(!(s->req->flags & CF_READ_TIMEOUT)) {
+ s->req->analysers |= AN_REQ_WAIT_HTTP;
+ if(s->txn.req.msg_state >= HTTP_MSG_BODY)
+ s->txn.req.msg_state = HTTP_MSG_LAST_LF;
+ }
}
I'm attaching your original proposal and the "style-simplified" version
as output from "git diff" in case there are any mailer related troubles.
Regards,
Lukas
diff --git a/src/proto_http.c b/src/proto_http.c
index 2febda4..065505f 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -5646,6 +5646,10 @@ int http_wait_for_response(struct session *s, struct
channel *rep, int an_bit)
/* client abort with an abortonclose */
else if ((rep->flags & CF_SHUTR) && ((s->req->flags &
(CF_SHUTR|CF_SHUTW)) == (CF_SHUTR|CF_SHUTW))) {
+ if(s->req->flags & CF_READ_TIMEOUT) {
+ rep->analysers = 0;
+ return 0;
+ }
s->fe->fe_counters.cli_aborts++;
s->be->be_counters.cli_aborts++;
if (objt_server(s->target))
diff --git a/src/session.c b/src/session.c
index 0824167..ad727a6 100644
--- a/src/session.c
+++ b/src/session.c
@@ -2421,8 +2421,14 @@ struct task *process_session(struct task *t)
if ((s->rep->flags & (CF_AUTO_CLOSE|CF_SHUTR)) == 0 &&
(tick_isset(s->req->wex) || tick_isset(s->rep->rex))) {
- s->req->flags |= CF_READ_NOEXP;
- s->req->rex = TICK_ETERNITY;
+ if((s->txn.req.body_len + s->txn.req.eoh) <
s->req->total) {
+ s->req->flags |= CF_READ_NOEXP;
+ s->req->rex = TICK_ETERNITY;
+ } else if(!(s->req->flags & CF_READ_TIMEOUT)) {
+ s->req->analysers |= AN_REQ_WAIT_HTTP;
+ if(s->txn.req.msg_state >= HTTP_MSG_BODY)
+ s->txn.req.msg_state = HTTP_MSG_LAST_LF;
+ }
}
/* When any of the stream interfaces is attached to an applet,
diff --git a/src/proto_http.c b/src/proto_http.c
index 2febda4..5db5843 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -5646,6 +5646,11 @@ int http_wait_for_response(struct session *s, struct
channel *rep, int an_bit)
/* client abort with an abortonclose */
else if ((rep->flags & CF_SHUTR) && ((s->req->flags &
(CF_SHUTR|CF_SHUTW)) == (CF_SHUTR|CF_SHUTW))) {
+ if(s->req->flags & CF_READ_TIMEOUT)
+ {
+ rep->analysers = 0;
+ return 0;
+ }
s->fe->fe_counters.cli_aborts++;
s->be->be_counters.cli_aborts++;
if (objt_server(s->target))
diff --git a/src/session.c b/src/session.c
index 0824167..546f00b 100644
--- a/src/session.c
+++ b/src/session.c
@@ -2421,9 +2421,21 @@ struct task *process_session(struct task *t)
if ((s->rep->flags & (CF_AUTO_CLOSE|CF_SHUTR)) == 0 &&
(tick_isset(s->req->wex) || tick_isset(s->rep->rex))) {
+ if((s->txn.req.body_len + s->txn.req.eoh) <
s->req->total) {
s->req->flags |= CF_READ_NOEXP;
s->req->rex = TICK_ETERNITY;
}
+ else
+ {
+ if(!(s->req->flags & CF_READ_TIMEOUT))
+ {
+ s->req->analysers |= AN_REQ_WAIT_HTTP;
+ if(s->txn.req.msg_state >=
HTTP_MSG_BODY) {
+ s->txn.req.msg_state =
HTTP_MSG_LAST_LF;
+ }
+ }
+ }
+ }
/* When any of the stream interfaces is attached to an applet,
* we have to call it here. Note that this one may wake the