CLEANUP: payload: remove useless and confusing nullity checks for channel buffer

The buffer could not be null by definition since we moved the stream out
of the session. It's the stream which gained the ability to be NULL (hence
the recent fix for this case). The checks in place are useless and make one
think this situation can happen.
This commit is contained in:
Willy Tarreau 2016-03-10 16:53:03 +01:00
parent 6204cd9f27
commit 4cefbc0752
1 changed files with 0 additions and 27 deletions

View File

@ -50,9 +50,6 @@ smp_fetch_len(const struct arg *args, struct sample *smp, const char *kw, void *
return 0;
chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
if (!chn->buf)
return 0;
smp->data.type = SMP_T_SINT;
smp->data.u.sint = chn->buf->i;
smp->flags = SMP_F_VOLATILE | SMP_F_MAY_CHANGE;
@ -75,9 +72,6 @@ smp_fetch_req_ssl_st_ext(const struct arg *args, struct sample *smp, const char
goto not_ssl_hello;
chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
if (!chn->buf)
goto not_ssl_hello;
bleft = chn->buf->i;
data = (unsigned char *)chn->buf->p;
@ -211,9 +205,6 @@ smp_fetch_req_ssl_ec_ext(const struct arg *args, struct sample *smp, const char
goto not_ssl_hello;
chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
if (!chn->buf)
goto not_ssl_hello;
bleft = chn->buf->i;
data = (unsigned char *)chn->buf->p;
@ -335,9 +326,6 @@ smp_fetch_ssl_hello_type(const struct arg *args, struct sample *smp, const char
goto not_ssl_hello;
chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
if (!chn->buf)
goto not_ssl_hello;
bleft = chn->buf->i;
data = (const unsigned char *)chn->buf->p;
@ -404,9 +392,6 @@ smp_fetch_req_ssl_ver(const struct arg *args, struct sample *smp, const char *kw
return 0;
req = &smp->strm->req;
if (!req->buf)
return 0;
msg_len = 0;
bleft = req->buf->i;
if (!bleft)
@ -547,9 +532,6 @@ smp_fetch_ssl_hello_sni(const struct arg *args, struct sample *smp, const char *
goto not_ssl_hello;
chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
if (!chn->buf)
goto not_ssl_hello;
bleft = chn->buf->i;
data = (unsigned char *)chn->buf->p;
@ -681,9 +663,6 @@ fetch_rdp_cookie_name(struct stream *s, struct sample *smp, const char *cname, i
int bleft;
const unsigned char *data;
if (!s->req.buf)
return 0;
smp->flags = SMP_F_CONST;
smp->data.type = SMP_T_STR;
@ -812,9 +791,6 @@ smp_fetch_payload_lv(const struct arg *arg_p, struct sample *smp, const char *kw
return 0;
chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
if (!chn->buf)
return 0;
if (len_offset + len_size > chn->buf->i)
goto too_short;
@ -865,9 +841,6 @@ smp_fetch_payload(const struct arg *arg_p, struct sample *smp, const char *kw, v
return 0;
chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
if (!chn->buf)
return 0;
if (!buf_size || buf_size > global.tune.bufsize || buf_offset + buf_size > global.tune.bufsize) {
/* will never match */
smp->flags = 0;