]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: chunks: make the chunk struct's fields match the buffer struct
authorWilly Tarreau <w@1wt.eu>
Fri, 13 Jul 2018 08:54:26 +0000 (10:54 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 19 Jul 2018 14:23:43 +0000 (16:23 +0200)
Chunks are only a subset of a buffer (a non-wrapping version with no head
offset). Despite this we still carry a lot of duplicated code between
buffers and chunks. Replacing chunks with buffers would significantly
reduce the maintenance efforts. This first patch renames the chunk's
fields to match the name and types used by struct buffers, with the goal
of isolating the code changes from the declaration changes.

Most of the changes were made with spatch using this coccinelle script :

  @rule_d1@
  typedef chunk;
  struct chunk chunk;
  @@
  - chunk.str
  + chunk.area

  @rule_d2@
  typedef chunk;
  struct chunk chunk;
  @@
  - chunk.len
  + chunk.data

  @rule_i1@
  typedef chunk;
  struct chunk *chunk;
  @@
  - chunk->str
  + chunk->area

  @rule_i2@
  typedef chunk;
  struct chunk *chunk;
  @@
  - chunk->len
  + chunk->data

Some minor updates to 3 http functions had to be performed to take size_t
ints instead of ints in order to match the unsigned length here.

52 files changed:
contrib/hpack/decode.c
contrib/mod_defender/defender.c
contrib/modsecurity/modsec_wrapper.c
include/common/chunk.h
include/proto/action.h
include/proto/channel.h
include/proto/proto_http.h
include/proto/sample.h
include/proto/spoe.h
src/51d.c
src/acl.c
src/arg.c
src/auth.c
src/backend.c
src/cache.c
src/cfgparse.c
src/checks.c
src/chunk.c
src/cli.c
src/connection.c
src/da.c
src/dns.c
src/flt_http_comp.c
src/flt_spoe.c
src/frontend.c
src/haproxy.c
src/hlua.c
src/hlua_fcn.c
src/hpack-dec.c
src/hpack-enc.c
src/log.c
src/map.c
src/memory.c
src/mux_h2.c
src/namespace.c
src/pattern.c
src/payload.c
src/peers.c
src/proto_http.c
src/proto_tcp.c
src/sample.c
src/server.c
src/session.c
src/ssl_sock.c
src/standard.c
src/stats.c
src/stick_table.c
src/stream.c
src/stream_interface.c
src/tcp_rules.c
src/vars.c
src/wurfl.c

index 2fd43b8a85430ff7d458fede696a9ec5e2b629e5..6f575eb07899cc56f369aaab934581fd6e7dfe37 100644 (file)
@@ -29,8 +29,8 @@ uint8_t buf[MAX_RQ_SIZE];
 char trash_buf[MAX_RQ_SIZE];
 char tmp_buf[MAX_RQ_SIZE];
 
-struct chunk trash = { .str = trash_buf, .len = 0, .size = sizeof(trash_buf) };
-struct chunk tmp   = { .str = tmp_buf,   .len = 0, .size = sizeof(tmp_buf)   };
+struct chunk trash = { .area = trash_buf, .data = 0, .size = sizeof(trash_buf) };
+struct chunk tmp   = { .area = tmp_buf,   .data = 0, .size = sizeof(tmp_buf)   };
 
 /* displays a <len> long memory block at <buf>, assuming first byte of <buf>
  * has address <baseaddr>. String <pfx> may be placed as a prefix in front of
@@ -193,10 +193,11 @@ int main(int argc, char **argv)
                        //printf("\e[1;35m%s\e[0m\n", istpad(trash.str, list[idx].v).ptr);
 
                        printf("      %s: ", list[idx].n.ptr ?
-                              istpad(trash.str, list[idx].n).ptr :
+                              istpad(trash.area, list[idx].n).ptr :
                               h2_phdr_to_str(list[idx].n.len));
 
-                       printf("%s [n=(%p,%d) v=(%p,%d)]\n", istpad(trash.str, list[idx].v).ptr,
+                       printf("%s [n=(%p,%d) v=(%p,%d)]\n",
+                              istpad(trash.area, list[idx].v).ptr,
                               list[idx].n.ptr, (int)list[idx].n.len, list[idx].v.ptr, (int)list[idx].v.len);
                }
                puts(">>>");
index 17341760c6314cb093fb0aafec22e59c29094b54..789db71d49e9c79257d9bd0f47829fa90ebdce54 100644 (file)
@@ -83,8 +83,8 @@ static apr_status_t defender_bucket_read(apr_bucket *b, const char **str,
 {
        struct apr_bucket_defender *d = b->data;
 
-       *str = d->buf.str;
-       *len = d->buf.len;
+       *str = d->buf.area;
+       *len = d->buf.data;
 
        return APR_SUCCESS;
 }
@@ -103,11 +103,11 @@ static apr_bucket *defender_bucket_make(apr_bucket *b, const struct chunk *buf)
 
        d = apr_bucket_alloc(sizeof(*d), b->list);
 
-       d->buf.str = buf->str;
-       d->buf.len = buf->len;
+       d->buf.area = buf->area;
+       d->buf.data = buf->data;
        d->buf.size = 0;
 
-       b = apr_bucket_shared_make(b, d, 0, buf->len);
+       b = apr_bucket_shared_make(b, d, 0, buf->data);
        b->type = &apr_bucket_type_defender;
        return b;
 }
@@ -487,10 +487,10 @@ int defender_process_request(struct worker *worker, struct defender_request *req
        if (!(r->useragent_ip = defender_addr2str(r->pool, &request->clientip)))
                goto out;
 
-       if (request->id.data.u.str.str && request->id.data.u.str.len > 0) {
+       if (request->id.data.u.str.area && request->id.data.u.str.data > 0) {
                apr_table_setn(r->subprocess_env, "UNIQUE_ID",
-                              defender_strdup(r->pool, request->id.data.u.str.str,
-                                              request->id.data.u.str.len));
+                              defender_strdup(r->pool, request->id.data.u.str.area,
+                                              request->id.data.u.str.data));
        }
        else {
                apr_table_setn(r->subprocess_env, "UNIQUE_ID",
@@ -502,37 +502,37 @@ int defender_process_request(struct worker *worker, struct defender_request *req
        query = &request->query.data.u.str;
        version = &request->version.data.u.str;
 
-       r->method_number = lookup_builtin_method(method->str, method->len);
-       if (!(r->method = defender_strdup(r->pool, method->str, method->len)))
+       r->method_number = lookup_builtin_method(method->area, method->data);
+       if (!(r->method = defender_strdup(r->pool, method->area, method->data)))
                goto out;
 
        r->unparsed_uri = defender_printf(r->pool, "%.*s%s%.*s",
-                                         path->len, path->str,
-                                         query->len > 0 ? "?" : "",
-                                         query->len, query->str);
+                                         path->data, path->area,
+                                         query->data > 0 ? "?" : "",
+                                         query->data, query->area);
        if (!r->unparsed_uri)
                goto out;
 
-       if (!(r->uri = defender_strdup(r->pool, path->str, path->len)))
+       if (!(r->uri = defender_strdup(r->pool, path->area, path->data)))
                goto out;
 
        r->parsed_uri.path = r->filename = r->uri;
 
-       if (!(r->args = defender_strdup(r->pool, query->str, query->len)))
+       if (!(r->args = defender_strdup(r->pool, query->area, query->data)))
                goto out;
 
        r->parsed_uri.query = r->args;
 
        r->protocol = defender_printf(r->pool, "%s%.*s",
-                                     version->len > 0 ? "HTTP/" : "",
-                                     version->len, version->str);
+                                     version->data > 0 ? "HTTP/" : "",
+                                     version->data, version->area);
        if (!r->protocol)
                goto out;
 
        r->the_request = defender_printf(r->pool, "%.*s %s%s%s",
-                                        method->len, method->str,
+                                        method->data, method->area,
                                         r->unparsed_uri,
-                                        version->len > 0 ? " " : "",
+                                        version->data > 0 ? " " : "",
                                         r->protocol);
        if (!r->the_request)
                goto out;
@@ -541,8 +541,8 @@ int defender_process_request(struct worker *worker, struct defender_request *req
        if (request->headers.data.type != SMP_T_BIN)
                goto misc;
 
-       hdr_ptr = request->headers.data.u.str.str;
-       hdr_end = hdr_ptr + request->headers.data.u.str.len;
+       hdr_ptr = request->headers.data.u.str.area;
+       hdr_end = hdr_ptr + request->headers.data.u.str.data;
 
        while (1) {
                memset(&hdr, 0, sizeof(hdr));
index 271ec15d1ded27c286067354ea678f36adbced6d..b3f67ecd451b630e520248dcca575097553a6403 100644 (file)
@@ -218,28 +218,28 @@ int modsecurity_process(struct worker *worker, struct modsecurity_parameters *pa
        int return_code = -1;
 
        /* Decode uniqueid. */
-       uniqueid = params->uniqueid.data.u.str.str;
-       uniqueid_len = params->uniqueid.data.u.str.len;
+       uniqueid = params->uniqueid.data.u.str.area;
+       uniqueid_len = params->uniqueid.data.u.str.data;
 
        /* Decode method. */
-       meth = params->method.data.u.str.str;
-       meth_len = params->method.data.u.str.len;
+       meth = params->method.data.u.str.area;
+       meth_len = params->method.data.u.str.data;
 
        /* Decode path. */
-       path = params->path.data.u.str.str;
-       path_len = params->path.data.u.str.len;
+       path = params->path.data.u.str.area;
+       path_len = params->path.data.u.str.data;
 
        /* Decode query string. */
-       qs = params->query.data.u.str.str;
-       qs_len = params->query.data.u.str.len;
+       qs = params->query.data.u.str.area;
+       qs_len = params->query.data.u.str.data;
 
        /* Decode version. */
-       vers = params->vers.data.u.str.str;
-       vers_len = params->vers.data.u.str.len;
+       vers = params->vers.data.u.str.area;
+       vers_len = params->vers.data.u.str.data;
 
        /* Decode header binary block. */
-       buf = params->hdrs_bin.data.u.str.str;
-       end = buf + params->hdrs_bin.data.u.str.len;
+       buf = params->hdrs_bin.data.u.str.area;
+       end = buf + params->hdrs_bin.data.u.str.data;
 
        /* Decode each header. */
        hdr_nb = 0;
@@ -289,8 +289,8 @@ int modsecurity_process(struct worker *worker, struct modsecurity_parameters *pa
                return -1;
 
        /* Decode body. */
-       body = params->body.data.u.str.str;
-       body_len = params->body.data.u.str.len;
+       body = params->body.data.u.str.area;
+       body_len = params->body.data.u.str.data;
 
        fail = 1;
 
index a511a594087e597ebb58c7427f68224eed5683f5..b9c1d2066f09e835e06e8604592abdd17c78127b 100644 (file)
@@ -31,9 +31,9 @@
 
 /* describes a chunk of string */
 struct chunk {
-       char *str;      /* beginning of the string itself. Might not be 0-terminated */
-       int size;       /* total size of the buffer, 0 if the *str is read-only */
-       int len;        /* current size of the string from first to last char. <0 = uninit. */
+       char *area;                 /* points to <size> bytes */
+       size_t size;              /* buffer size in bytes */
+       size_t data;              /* amount of data after head including wrapping */
 };
 
 struct pool_head *pool_head_trash;
@@ -66,13 +66,13 @@ static inline void free_trash_chunk(struct chunk *chunk)
 
 static inline void chunk_reset(struct chunk *chk)
 {
-       chk->len  = 0;
+       chk->data  = 0;
 }
 
 static inline void chunk_init(struct chunk *chk, char *str, size_t size)
 {
-       chk->str  = str;
-       chk->len  = 0;
+       chk->area  = str;
+       chk->data  = 0;
        chk->size = size;
 }
 
@@ -83,8 +83,8 @@ static inline int chunk_initlen(struct chunk *chk, char *str, size_t size, int l
        if (len < 0 || (size && len > size))
                return 0;
 
-       chk->str  = str;
-       chk->len  = len;
+       chk->area  = str;
+       chk->data  = len;
        chk->size = size;
 
        return 1;
@@ -93,8 +93,8 @@ static inline int chunk_initlen(struct chunk *chk, char *str, size_t size, int l
 /* this is only for temporary manipulation, the chunk is read-only */
 static inline void chunk_initstr(struct chunk *chk, const char *str)
 {
-       chk->str = (char *)str;
-       chk->len = strlen(str);
+       chk->area = (char *)str;
+       chk->data = strlen(str);
        chk->size = 0;                  /* mark it read-only */
 }
 
@@ -106,8 +106,8 @@ static inline int chunk_memcpy(struct chunk *chk, const char *src, size_t len)
        if (unlikely(len >= chk->size))
                return 0;
 
-       chk->len  = len;
-       memcpy(chk->str, src, len);
+       chk->data  = len;
+       memcpy(chk->area, src, len);
 
        return 1;
 }
@@ -117,11 +117,11 @@ static inline int chunk_memcpy(struct chunk *chk, const char *src, size_t len)
  */
 static inline int chunk_memcat(struct chunk *chk, const char *src, size_t len)
 {
-       if (unlikely(chk->len < 0 || chk->len + len >= chk->size))
+       if (unlikely(chk->data < 0 || chk->data + len >= chk->size))
                return 0;
 
-       memcpy(chk->str + chk->len, src, len);
-       chk->len += len;
+       memcpy(chk->area + chk->data, src, len);
+       chk->data += len;
        return 1;
 }
 
@@ -137,8 +137,8 @@ static inline int chunk_strcpy(struct chunk *chk, const char *str)
        if (unlikely(len >= chk->size))
                return 0;
 
-       chk->len  = len;
-       memcpy(chk->str, str, len + 1);
+       chk->data  = len;
+       memcpy(chk->area, str, len + 1);
 
        return 1;
 }
@@ -152,11 +152,11 @@ static inline int chunk_strcat(struct chunk *chk, const char *str)
 
        len = strlen(str);
 
-       if (unlikely(chk->len < 0 || chk->len + len >= chk->size))
+       if (unlikely(chk->data < 0 || chk->data + len >= chk->size))
                return 0;
 
-       memcpy(chk->str + chk->len, str, len + 1);
-       chk->len += len;
+       memcpy(chk->area + chk->data, str, len + 1);
+       chk->data += len;
        return 1;
 }
 
@@ -165,11 +165,11 @@ static inline int chunk_strcat(struct chunk *chk, const char *str)
  */
 static inline int chunk_strncat(struct chunk *chk, const char *str, int nb)
 {
-       if (unlikely(chk->len < 0 || chk->len + nb >= chk->size))
+       if (unlikely(chk->data < 0 || chk->data + nb >= chk->size))
                return 0;
 
-       memcpy(chk->str + chk->len, str, nb);
-       chk->len += nb;
+       memcpy(chk->area + chk->data, str, nb);
+       chk->data += nb;
        return 1;
 }
 
@@ -187,17 +187,17 @@ static inline int chunk_strncat(struct chunk *chk, const char *str, int nb)
  */
 static inline char *chunk_newstr(struct chunk *chk)
 {
-       if (chk->len < 0 || chk->len + 1 >= chk->size)
+       if (chk->data < 0 || chk->data + 1 >= chk->size)
                return NULL;
 
-       chk->str[chk->len++] = 0;
-       return chk->str + chk->len;
+       chk->area[chk->data++] = 0;
+       return chk->area + chk->data;
 }
 
 static inline void chunk_drop(struct chunk *chk)
 {
-       chk->str  = NULL;
-       chk->len  = -1;
+       chk->area  = NULL;
+       chk->data  = -1;
        chk->size = 0;
 }
 
@@ -206,7 +206,7 @@ static inline void chunk_destroy(struct chunk *chk)
        if (!chk->size)
                return;
 
-       free(chk->str);
+       free(chk->area);
        chunk_drop(chk);
 }
 
@@ -219,28 +219,28 @@ static inline void chunk_destroy(struct chunk *chk)
  */
 static inline char *chunk_dup(struct chunk *dst, const struct chunk *src)
 {
-       if (!dst || !src || src->len < 0 || !src->str)
+       if (!dst || !src || src->data < 0 || !src->area)
                return NULL;
 
        if (dst->size)
-               free(dst->str);
-       dst->len = src->len;
-       dst->size = src->len;
+               free(dst->area);
+       dst->data = src->data;
+       dst->size = src->data;
        if (dst->size < src->size || !src->size)
                dst->size++;
 
-       dst->str = (char *)malloc(dst->size);
-       if (!dst->str) {
-               dst->len = 0;
+       dst->area = (char *)malloc(dst->size);
+       if (!dst->area) {
+               dst->data = 0;
                dst->size = 0;
                return NULL;
        }
 
-       memcpy(dst->str, src->str, dst->len);
-       if (dst->len < dst->size)
-               dst->str[dst->len] = 0;
+       memcpy(dst->area, src->area, dst->data);
+       if (dst->data < dst->size)
+               dst->area[dst->data] = 0;
 
-       return dst->str;
+       return dst->area;
 }
 
 #endif /* _TYPES_CHUNK_H */
index e3015ec11558a27722923df7f10bdd86d5374a5a..dcfdeacca0fc362992fc325764bd772c93bf18d4 100644 (file)
@@ -52,7 +52,7 @@ static inline void action_build_list(struct list *keywords, struct chunk *chk)
        char *end;
        int l;
 
-       p = chk->str;
+       p = chk->area;
        end = p + chk->size - 1;
        list_for_each_entry(kw_list, keywords, list) {
                for (i = 0; kw_list->kw[i].kw != NULL; i++) {
@@ -62,7 +62,7 @@ static inline void action_build_list(struct list *keywords, struct chunk *chk)
                        p += l;
                }
        }
-       if (p > chk->str)
+       if (p > chk->area)
                *(p-2) = '\0';
        else
                *p = '\0';
index d831fcc6bc7884cc063bc73445f29caef6fa9f78..10e3602db097dfa88208603f5728b7840824c42d 100644 (file)
@@ -788,9 +788,9 @@ static inline int ci_putchk(struct channel *chn, struct chunk *chunk)
 {
        int ret;
 
-       ret = ci_putblk(chn, chunk->str, chunk->len);
+       ret = ci_putblk(chn, chunk->area, chunk->data);
        if (ret > 0)
-               chunk->len -= ret;
+               chunk->data -= ret;
        return ret;
 }
 
index 07301608da622e7a234db245777aaeef6625880f..d3b1f439edc5524ff1ed8d4f633be3b035bda00b 100644 (file)
@@ -87,7 +87,7 @@ int http_find_next_header(char *sol, struct hdr_idx *idx,
                           struct hdr_ctx *ctx);
 char *find_hdr_value_end(char *s, const char *e);
 char *extract_cookie_value(char *hdr, const char *hdr_end, char *cookie_name,
-                           size_t cookie_name_l, int list, char **value, int *value_l);
+                           size_t cookie_name_l, int list, char **value, size_t *value_l);
 int http_header_match2(const char *hdr, const char *end, const char *name, int len);
 int http_remove_header2(struct http_msg *msg, struct hdr_idx *idx, struct hdr_ctx *ctx);
 int http_header_add_tail2(struct http_msg *msg, struct hdr_idx *hdr_idx, const char *text, int len);
@@ -104,7 +104,7 @@ void http_capture_bad_message(struct proxy *proxy, struct error_snapshot *es, st
                              enum h1_state state, struct proxy *other_end);
 unsigned int http_get_hdr(const struct http_msg *msg, const char *hname, int hlen,
                          struct hdr_idx *idx, int occ,
-                         struct hdr_ctx *ctx, char **vptr, int *vlen);
+                         struct hdr_ctx *ctx, char **vptr, size_t *vlen);
 char *http_get_path(struct http_txn *txn);
 const char *get_reason(unsigned int status);
 
index 94226d2d5e049648a62261ee0ed19f83b1f68041..6cca99a6a88109d5d7ea6a6238ae17c0cfa00109 100644 (file)
@@ -92,22 +92,22 @@ int smp_is_safe(struct sample *smp)
                /* Fall through */
 
        case SMP_T_STR:
-               if ((smp->data.u.str.len < 0) ||
-                   (smp->data.u.str.size && smp->data.u.str.len >= smp->data.u.str.size))
+               if ((smp->data.u.str.data < 0) ||
+                   (smp->data.u.str.size && smp->data.u.str.data >= smp->data.u.str.size))
                        return 0;
 
-               if (smp->data.u.str.str[smp->data.u.str.len] == 0)
+               if (smp->data.u.str.area[smp->data.u.str.data] == 0)
                        return 1;
 
                if (!smp->data.u.str.size || (smp->flags & SMP_F_CONST))
                        return 0;
 
-               smp->data.u.str.str[smp->data.u.str.len] = 0;
+               smp->data.u.str.area[smp->data.u.str.data] = 0;
                return 1;
 
        case SMP_T_BIN:
-               return (smp->data.u.str.len >= 0) &&
-                      (!smp->data.u.str.size || smp->data.u.str.len <= smp->data.u.str.size);
+               return (smp->data.u.str.data >= 0) &&
+                      (!smp->data.u.str.size || smp->data.u.str.data <= smp->data.u.str.size);
 
        default:
                return 1;
@@ -145,18 +145,18 @@ int smp_is_rw(struct sample *smp)
 
        case SMP_T_STR:
                if (!smp->data.u.str.size ||
-                   smp->data.u.str.len < 0 ||
-                   smp->data.u.str.len >= smp->data.u.str.size)
+                   smp->data.u.str.data < 0 ||
+                   smp->data.u.str.data >= smp->data.u.str.size)
                        return 0;
 
-               if (smp->data.u.str.str[smp->data.u.str.len] != 0)
-                       smp->data.u.str.str[smp->data.u.str.len] = 0;
+               if (smp->data.u.str.area[smp->data.u.str.data] != 0)
+                       smp->data.u.str.area[smp->data.u.str.data] = 0;
                return 1;
 
        case SMP_T_BIN:
                return smp->data.u.str.size &&
-                      smp->data.u.str.len >= 0 &&
-                      smp->data.u.str.len <= smp->data.u.str.size;
+                      smp->data.u.str.data >= 0 &&
+                      smp->data.u.str.data <= smp->data.u.str.size;
 
        default:
                return 1;
index 002cf7d768fec1edd15417b3ef5fcd40b73e58cb..299836bb0fc55e03c24a305a5490395e4b618e1a 100644 (file)
@@ -180,18 +180,20 @@ spoe_encode_data(struct sample *smp, unsigned int *off, char **buf, char *end)
                                *p++ = (smp->data.type == SMP_T_STR)
                                        ? SPOE_DATA_T_STR
                                        : SPOE_DATA_T_BIN;
-                               ret = spoe_encode_frag_buffer(chk->str, chk->len, &p, end);
+                               ret = spoe_encode_frag_buffer(chk->area,
+                                                             chk->data, &p,
+                                                             end);
                                if (ret == -1)
                                        return -1;
                        }
                        else {
                                /* The sample has been fragmented, encode remaining data */
-                               ret = MIN(chk->len - *off, end - p);
-                               memcpy(p, chk->str + *off, ret);
+                               ret = MIN(chk->data - *off, end - p);
+                               memcpy(p, chk->area + *off, ret);
                                p += ret;
                        }
                        /* Now update <*off> */
-                       if (ret + *off != chk->len)
+                       if (ret + *off != chk->data)
                                *off += ret;
                        else
                                *off = 0;
@@ -214,8 +216,8 @@ spoe_encode_data(struct sample *smp, unsigned int *off, char **buf, char *end)
                                case HTTP_METH_CONNECT: m = "CONNECT"; len = 7; break;
 
                                default :
-                                       m   = smp->data.u.meth.str.str;
-                                       len = smp->data.u.meth.str.len;
+                                       m   = smp->data.u.meth.str.area;
+                                       len = smp->data.u.meth.str.data;
                        }
                        if (spoe_encode_buffer(m, len, &p, end) == -1)
                                return -1;
@@ -333,8 +335,8 @@ spoe_decode_data(char **buf, char *end, struct sample *smp)
                        /* All the buffer must be decoded */
                        if (spoe_decode_buffer(&p, end, &str, &sz) == -1)
                                return -1;
-                       smp->data.u.str.str = str;
-                       smp->data.u.str.len = sz;
+                       smp->data.u.str.area = str;
+                       smp->data.u.str.data = sz;
                        smp->data.type = (type == SPOE_DATA_T_STR) ? SMP_T_STR : SMP_T_BIN;
                        break;
        }
index a36333ef5039eb643376df683cc0e029e13997fe..4ad82fe5666e942796f94d33da498ceef89211a6 100644 (file)
--- a/src/51d.c
+++ b/src/51d.c
@@ -160,7 +160,7 @@ static void _51d_lru_free(void *cache_entry)
        if (!ptr)
                return;
 
-       free(ptr->str);
+       free(ptr->area);
        free(ptr);
 }
 
@@ -189,15 +189,15 @@ static void _51d_insert_cache_entry(struct sample *smp, struct lru64 *lru, void*
        if (!cache_entry)
                return;
 
-       cache_entry->str = _51d_malloc(smp->data.u.str.len + 1);
-       if (!cache_entry->str) {
+       cache_entry->area = _51d_malloc(smp->data.u.str.data + 1);
+       if (!cache_entry->area) {
                free(cache_entry);
                return;
        }
 
-       memcpy(cache_entry->str, smp->data.u.str.str, smp->data.u.str.len);
-       cache_entry->str[smp->data.u.str.len] = 0;
-       cache_entry->len = smp->data.u.str.len;
+       memcpy(cache_entry->area, smp->data.u.str.area, smp->data.u.str.data);
+       cache_entry->area[smp->data.u.str.data] = 0;
+       cache_entry->data = smp->data.u.str.data;
        lru64_commit(lru, cache_entry, domain, 0, _51d_lru_free);
 }
 
@@ -206,8 +206,8 @@ static void _51d_insert_cache_entry(struct sample *smp, struct lru64 *lru, void*
 static void _51d_retrieve_cache_entry(struct sample *smp, struct lru64 *lru)
 {
        struct chunk *cache_entry = lru->data;
-       smp->data.u.str.str = cache_entry->str;
-       smp->data.u.str.len = cache_entry->len;
+       smp->data.u.str.area = cache_entry->area;
+       smp->data.u.str.data = cache_entry->data;
 }
 #endif
 
@@ -228,10 +228,9 @@ static void _51d_set_headers(struct sample *smp, fiftyoneDegreesWorkset *ws)
 
        for (i = 0; i < global_51degrees.header_count; i++) {
                ctx.idx = 0;
-               if (http_find_full_header2(
-                       (global_51degrees.header_names + i)->str,
-                       (global_51degrees.header_names + i)->len,
-                       msg->chn->buf->p, idx, &ctx) == 1) {
+               if (http_find_full_header2((global_51degrees.header_names + i)->area,
+                                          (global_51degrees.header_names + i)->data,
+                                          msg->chn->buf->p, idx, &ctx) == 1) {
                        ws->importantHeaders[ws->importantHeadersCount].header = ws->dataSet->httpHeaders + i;
                        ws->importantHeaders[ws->importantHeadersCount].headerValue = ctx.line + ctx.val;
                        ws->importantHeaders[ws->importantHeadersCount].headerValueLength = ctx.vlen;
@@ -256,10 +255,9 @@ static void _51d_set_device_offsets(struct sample *smp)
 
        for (index = 0; index < global_51degrees.header_count; index++) {
                ctx.idx = 0;
-               if (http_find_full_header2(
-                       (global_51degrees.header_names + index)->str,
-                       (global_51degrees.header_names + index)->len,
-                       msg->chn->buf->p, idx, &ctx) == 1) {
+               if (http_find_full_header2((global_51degrees.header_names + index)->area,
+                                          (global_51degrees.header_names + index)->data,
+                                          msg->chn->buf->p, idx, &ctx) == 1) {
                        (offsets->firstOffset + offsets->size)->httpHeaderOffset = *(global_51degrees.header_offsets + index);
                        (offsets->firstOffset + offsets->size)->deviceOffset = fiftyoneDegreesGetDeviceOffset(&global_51degrees.data_set, ctx.line + ctx.val);
                        offsets->size++;
@@ -307,11 +305,11 @@ static void _51d_process_match(const struct arg *args, struct sample *smp)
        const char* property_name;
 
        /* Loop through property names passed to the filter and fetch them from the dataset. */
-       while (args[i].data.str.str) {
+       while (args[i].data.str.area) {
                /* Try to find request property in dataset. */
                found = 0;
 #ifdef FIFTYONEDEGREES_H_PATTERN_INCLUDED
-               if (strcmp("Method", args[i].data.str.str) == 0) {
+               if (strcmp("Method", args[i].data.str.area) == 0) {
                        switch(ws->method) {
                                case EXACT: methodName = "Exact"; break;
                                case NUMERIC: methodName = "Numeric"; break;
@@ -323,18 +321,18 @@ static void _51d_process_match(const struct arg *args, struct sample *smp)
                        chunk_appendf(temp, "%s", methodName);
                        found = 1;
                }
-               else if (strcmp("Difference", args[i].data.str.str) == 0) {
+               else if (strcmp("Difference", args[i].data.str.area) == 0) {
                        chunk_appendf(temp, "%d", ws->difference);
                        found = 1;
                }
-               else if (strcmp("Rank", args[i].data.str.str) == 0) {
+               else if (strcmp("Rank", args[i].data.str.area) == 0) {
                        chunk_appendf(temp, "%d", fiftyoneDegreesGetSignatureRank(ws));
                        found = 1;
                }
                else {
                        for (j = 0; j < ws->dataSet->requiredPropertyCount; j++) {
                                property_name = fiftyoneDegreesGetPropertyName(ws->dataSet, ws->dataSet->requiredProperties[j]);
-                               if (strcmp(property_name, args[i].data.str.str) == 0) {
+                               if (strcmp(property_name, args[i].data.str.area) == 0) {
                                        found = 1;
                                        fiftyoneDegreesSetValues(ws, j);
                                        chunk_appendf(temp, "%s", fiftyoneDegreesGetValueName(ws->dataSet, *ws->values));
@@ -347,7 +345,7 @@ static void _51d_process_match(const struct arg *args, struct sample *smp)
                found = 0;
                for (j = 0; j < requiredPropertiesCount; j++) {
                        property_name = requiredProperties[j];
-                       if (strcmp(property_name, args[i].data.str.str) == 0 &&
+                       if (strcmp(property_name, args[i].data.str.area) == 0 &&
                                fiftyoneDegreesGetValueFromOffsets(&global_51degrees.data_set, deviceOffsets, j, valuesBuffer, 1024) > 0) {
                                found = 1;
                                chunk_appendf(temp, "%s", valuesBuffer);
@@ -363,13 +361,13 @@ static void _51d_process_match(const struct arg *args, struct sample *smp)
                ++i;
        }
 
-       if (temp->len) {
-               --temp->len;
-               temp->str[temp->len] = '\0';
+       if (temp->data) {
+               --temp->data;
+               temp->area[temp->data] = '\0';
        }
 
-       smp->data.u.str.str = temp->str;
-       smp->data.u.str.len = temp->len;
+       smp->data.u.str.area = temp->area;
+       smp->data.u.str.data = temp->data;
 }
 
 static int _51d_fetch(const struct arg *args, struct sample *smp, const char *kw, void *private)
@@ -457,7 +455,7 @@ static int _51d_conv(const struct arg *args, struct sample *smp, void *private)
        if (_51d_lru_tree) {
                unsigned long long seed = _51d_lru_seed ^ (long)args;
 
-               lru = lru64_get(XXH64(smp->data.u.str.str, smp->data.u.str.len, seed),
+               lru = lru64_get(XXH64(smp->data.u.str.area, smp->data.u.str.data, seed),
                                _51d_lru_tree, (void*)args, 0);
                if (lru && lru->domain) {
                        _51d_retrieve_cache_entry(smp, lru);
@@ -475,15 +473,16 @@ static int _51d_conv(const struct arg *args, struct sample *smp, void *private)
        if (!smp_dup(smp))
                return 0;
 
-       smp->data.u.str.str[smp->data.u.str.len] = '\0';
+       smp->data.u.str.area[smp->data.u.str.data] = '\0';
 
        /* Perform detection. */
 #ifdef FIFTYONEDEGREES_H_PATTERN_INCLUDED
-       fiftyoneDegreesMatch(ws, smp->data.u.str.str);
+       fiftyoneDegreesMatch(ws, smp->data.u.str.area);
        _51d_process_match(args, smp, ws);
 #endif
 #ifdef FIFTYONEDEGREES_H_TRIE_INCLUDED
-       global_51degrees.device_offsets.firstOffset->deviceOffset = fiftyoneDegreesGetDeviceOffset(&global_51degrees.data_set, smp->data.u.str.str);
+       global_51degrees.device_offsets.firstOffset->deviceOffset = fiftyoneDegreesGetDeviceOffset(&global_51degrees.data_set,
+                                                                                                  smp->data.u.str.area);
        global_51degrees.device_offsets.size = 1;
        _51d_process_match(args, smp);
 #endif
@@ -507,9 +506,9 @@ void _51d_init_http_headers()
        global_51degrees.header_names = malloc(global_51degrees.header_count * sizeof(struct chunk));
        for (index = 0; index < global_51degrees.header_count; index++) {
                headerName = fiftyoneDegreesGetString(ds, ds->httpHeaders[index].headerNameOffset);
-               (global_51degrees.header_names + index)->str = (char*)&headerName->firstByte;
-               (global_51degrees.header_names + index)->len = headerName->length - 1;
-               (global_51degrees.header_names + index)->size = (global_51degrees.header_names + index)->len;
+               (global_51degrees.header_names + index)->area = (char*)&headerName->firstByte;
+               (global_51degrees.header_names + index)->data = headerName->length - 1;
+               (global_51degrees.header_names + index)->size = (global_51degrees.header_names + index)->data;
        }
 }
 #endif
@@ -526,9 +525,9 @@ void _51d_init_http_headers()
        global_51degrees.header_offsets = malloc(global_51degrees.header_count * sizeof(int32_t));
        for (index = 0; index < global_51degrees.header_count; index++) {
                global_51degrees.header_offsets[index] = fiftyoneDegreesGetHttpHeaderNameOffset(ds, index);
-               global_51degrees.header_names[index].str = (char*)fiftyoneDegreesGetHttpHeaderNamePointer(ds, index);
-               global_51degrees.header_names[index].len = strlen(global_51degrees.header_names[index].str);
-               global_51degrees.header_names[index].size = global_51degrees.header_names[index].len;
+               global_51degrees.header_names->area = (char*)fiftyoneDegreesGetHttpHeaderNamePointer(ds, index);
+               global_51degrees.header_names->data = strlen(global_51degrees.header_names->area);
+               global_51degrees.header_names[index].size = global_51degrees.header_names->data;
        }
 }
 #endif
@@ -615,8 +614,9 @@ static int init_51degrees(void)
                        break;
        }
        if (_51d_dataset_status != DATA_SET_INIT_STATUS_SUCCESS) {
-               if (temp->len)
-                       ha_alert("51Degrees Setup - Error reading 51Degrees data file. %s\n", temp->str);
+               if (temp->data)
+                       ha_alert("51Degrees Setup - Error reading 51Degrees data file. %s\n",
+                                temp->area);
                else
                        ha_alert("51Degrees Setup - Error reading 51Degrees data file.\n");
                return ERR_ALERT | ERR_FATAL;
index f19b2d2014d0df51f2aef111392d4da8fca0c9b2..afb48ad710c7fb67bf6aa05bec3fb3fd525484af 100644 (file)
--- a/src/acl.c
+++ b/src/acl.c
@@ -113,9 +113,9 @@ static struct acl_expr *prune_acl_expr(struct acl_expr *expr)
                if (arg->type == ARGT_STOP)
                        break;
                if (arg->type == ARGT_STR || arg->unresolved) {
-                       free(arg->data.str.str);
-                       arg->data.str.str = NULL;
-                       arg->data.str.len = 0;
+                       free(arg->data.str.area);
+                       arg->data.str.area = NULL;
+                       arg->data.str.data = 0;
                        unresolved |= arg->unresolved;
                        arg->unresolved = 0;
                }
@@ -525,11 +525,12 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
        }
 
        /* Create displayed reference */
-       snprintf(trash.str, trash.size, "acl '%s' file '%s' line %d", expr->kw, file, line);
-       trash.str[trash.size - 1] = '\0';
+       snprintf(trash.area, trash.size, "acl '%s' file '%s' line %d",
+                expr->kw, file, line);
+       trash.area[trash.size - 1] = '\0';
 
        /* Create new patern reference. */
-       ref = pat_ref_newid(unique_id, trash.str, PAT_REF_ACL);
+       ref = pat_ref_newid(unique_id, trash.area, PAT_REF_ACL);
        if (!ref) {
                memprintf(err, "memory error");
                goto out_free_expr;
@@ -1272,7 +1273,8 @@ int acl_find_targets(struct proxy *p)
                                 */
                                if (expr->smp->arg_p->unresolved) {
                                        ha_alert("Internal bug in proxy %s: %sacl %s %s() makes use of unresolved userlist '%s'. Please report this.\n",
-                                                p->id, *acl->name ? "" : "anonymous ", acl->name, expr->kw, expr->smp->arg_p->data.str.str);
+                                                p->id, *acl->name ? "" : "anonymous ", acl->name, expr->kw,
+                                                expr->smp->arg_p->data.str.area);
                                        cfgerr++;
                                        continue;
                                }
index b31858d3b3cade133b8661106f8a3f50988a3e63..8e71dcca25da673cdcb5d8a13918c4175ec9c4aa 100644 (file)
--- a/src/arg.c
+++ b/src/arg.c
@@ -174,9 +174,9 @@ int make_arg_list(const char *in, int len, uint64_t mask, struct arg **argp,
                         * during the parsing. The caller must at one point resolve
                         * them and free the string.
                         */
-                       arg->data.str.str = word;
-                       arg->data.str.len = in - beg;
-                       arg->data.str.size = arg->data.str.len + 1;
+                       arg->data.str.area = word;
+                       arg->data.str.data = in - beg;
+                       arg->data.str.size = arg->data.str.data + 1;
                        word = NULL;
                        break;
 
index a2c689f761878d93f208cd069adbc2b02ebd5d81..3dd3a1de0d97ff096d7a9e5b3240e0e71fcb997d 100644 (file)
@@ -277,7 +277,7 @@ pat_match_auth(struct sample *smp, struct pattern_expr *expr, int fill)
 
        /* Browse the userlist for searching user. */
        for (u = ul->users; u; u = u->next) {
-               if (strcmp(smp->data.u.str.str, u->user) == 0)
+               if (strcmp(smp->data.u.str.area, u->user) == 0)
                        break;
        }
        if (!u)
index b82ecbbf9b8cbd7fa2769ac3818b36779d754b23..e94c4c9b345bbeceb24cc48c9b55968c126d7ef8 100644 (file)
@@ -489,7 +489,7 @@ static struct server *get_server_rch(struct stream *s)
        c_rew(&s->req, rewind);
 
        ret = fetch_rdp_cookie_name(s, &smp, px->hh_name, px->hh_len);
-       len = smp.data.u.str.len;
+       len = smp.data.u.str.data;
 
        c_adv(&s->req, rewind);
 
@@ -503,7 +503,7 @@ static struct server *get_server_rch(struct stream *s)
        /* Found a the hh_name in the headers.
         * we will compute the hash based on this value ctx.val.
         */
-       hash = gen_hash(px, smp.data.u.str.str, len);
+       hash = gen_hash(px, smp.data.u.str.area, len);
 
        if ((px->lbprm.algo & BE_LB_HASH_MOD) == BE_LB_HMOD_AVAL)
                hash = full_hash(hash);
@@ -1013,7 +1013,7 @@ static void assign_tproxy_address(struct stream *s)
        case CO_SRC_TPROXY_DYN:
                if (src->bind_hdr_occ && s->txn) {
                        char *vptr;
-                       int vlen;
+                       size_t vlen;
                        int rewind;
 
                        /* bind to the IP in a header */
@@ -1270,7 +1270,8 @@ int connect_server(struct stream *s)
                        c_adv(&s->req, rewind);
 
                        if (smp_make_safe(smp)) {
-                               ssl_sock_set_servername(srv_conn, smp->data.u.str.str);
+                               ssl_sock_set_servername(srv_conn,
+                                                       smp->data.u.str.area);
                                srv_conn->flags |= CO_FL_PRIVATE;
                        }
                }
@@ -1413,7 +1414,7 @@ int tcp_persist_rdp_cookie(struct stream *s, struct channel *req, int an_bit)
        memset(&smp, 0, sizeof(smp));
 
        ret = fetch_rdp_cookie_name(s, &smp, s->be->rdp_cookie_name, s->be->rdp_cookie_len);
-       if (ret == 0 || (smp.flags & SMP_F_MAY_CHANGE) || smp.data.u.str.len == 0)
+       if (ret == 0 || (smp.flags & SMP_F_MAY_CHANGE) || smp.data.u.str.data == 0)
                goto no_cookie;
 
        /* Considering an rdp cookie detected using acl, str ended with <cr><lf> and should return.
@@ -1421,7 +1422,7 @@ int tcp_persist_rdp_cookie(struct stream *s, struct channel *req, int an_bit)
         * server's IP address in network order, and "port" is the integer corresponding to the
         * server's port in network order. Comments please Emeric.
         */
-       addr = strtoul(smp.data.u.str.str, &p, 10);
+       addr = strtoul(smp.data.u.str.area, &p, 10);
        if (*p != '.')
                goto no_cookie;
        p++;
@@ -1741,13 +1742,13 @@ smp_fetch_be_name(const struct arg *args, struct sample *smp, const char *kw, vo
        if (!smp->strm)
                return 0;
 
-       smp->data.u.str.str = (char *)smp->strm->be->id;
-       if (!smp->data.u.str.str)
+       smp->data.u.str.area = (char *)smp->strm->be->id;
+       if (!smp->data.u.str.area)
                return 0;
 
        smp->data.type = SMP_T_STR;
        smp->flags = SMP_F_CONST;
-       smp->data.u.str.len = strlen(smp->data.u.str.str);
+       smp->data.u.str.data = strlen(smp->data.u.str.area);
 
        return 1;
 }
@@ -1882,7 +1883,7 @@ static int sample_conv_nbsrv(const struct arg *args, struct sample *smp, void *p
        if (!smp_make_safe(smp))
                return 0;
 
-       px = proxy_find_by_name(smp->data.u.str.str, PR_CAP_BE, 0);
+       px = proxy_find_by_name(smp->data.u.str.area, PR_CAP_BE, 0);
        if (!px)
                return 0;
 
index 6e7a87af45eb4b8363dd7a30c4f3c270ae0aca07..4143edc03d23bca3cd7222f14f555a8c8c4350ad 100644 (file)
@@ -349,7 +349,7 @@ int http_calc_maxage(struct stream *s, struct cache *cache)
 
                        chunk_strncat(chk, value, ctx.vlen - 8 + 1);
                        chunk_strncat(chk, "", 1);
-                       maxage = atoi(chk->str);
+                       maxage = atoi(chk->area);
                }
 
                value = directive_value(ctx.line + ctx.val, ctx.vlen, "max-age", 7);
@@ -358,7 +358,7 @@ int http_calc_maxage(struct stream *s, struct cache *cache)
 
                        chunk_strncat(chk, value, ctx.vlen - 7 + 1);
                        chunk_strncat(chk, "", 1);
-                       smaxage = atoi(chk->str);
+                       smaxage = atoi(chk->area);
                }
        }
 
@@ -657,7 +657,7 @@ int sha1_hosturi(struct http_txn *txn)
 
        /* hash everything */
        blk_SHA1_Init(&sha1_ctx);
-       blk_SHA1_Update(&sha1_ctx, trash->str, trash->len);
+       blk_SHA1_Update(&sha1_ctx, trash->area, trash->data);
        blk_SHA1_Final((unsigned char *)txn->cache_hash, &sha1_ctx);
 
        return 1;
index f3c2be49901f6154ef1e48d8ad9d222e5ce84ff6..b44e6fa8806e5db85406dcbf7ff3ff641d36b872 100644 (file)
@@ -1778,10 +1778,10 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
                                        goto out;
                                }
 
-                               memcpy(trash.str, *env, delim - *env);
-                               trash.str[delim - *env] = 0;
+                               memcpy(trash.area, *env, delim - *env);
+                               trash.area[delim - *env] = 0;
 
-                               if (unsetenv(trash.str) != 0) {
+                               if (unsetenv(trash.area) != 0) {
                                        ha_alert("parsing [%s:%d]: '%s' failed to unset variable '%s' : %s.\n", file, linenum, args[0], *env, strerror(errno));
                                        err_code |= ERR_ALERT | ERR_FATAL;
                                        goto out;
index 6db077a3bc35b4bdc9cc8a7ed6a7b5f721f94856..5100c7ec58b5b6637c397bad160344c115ee86b3 100644 (file)
@@ -289,9 +289,9 @@ static void set_server_check_status(struct check *check, short status, const cha
                             (check->health >= check->rise) ? check->fall : check->rise,
                             (check->health >= check->rise) ? (s->uweight ? "UP" : "DRAIN") : "DOWN");
 
-               ha_warning("%s.\n", trash.str);
-               send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str);
-               send_email_alert(s, LOG_INFO, "%s", trash.str);
+               ha_warning("%s.\n", trash.area);
+               send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.area);
+               send_email_alert(s, LOG_INFO, "%s", trash.area);
        }
 }
 
@@ -434,14 +434,16 @@ void __health_adjust(struct server *s, short status)
 
                case HANA_ONERR_FAILCHK:
                /* simulate a failed health check */
-                       set_server_check_status(&s->check, HCHK_STATUS_HANA, trash.str);
+                       set_server_check_status(&s->check, HCHK_STATUS_HANA,
+                                               trash.area);
                        check_notify_failure(&s->check);
                        break;
 
                case HANA_ONERR_MARKDWN:
                /* mark server down */
                        s->check.health = s->check.rise;
-                       set_server_check_status(&s->check, HCHK_STATUS_HANA, trash.str);
+                       set_server_check_status(&s->check, HCHK_STATUS_HANA,
+                                               trash.area);
                        check_notify_failure(&s->check);
                        break;
 
@@ -638,18 +640,21 @@ static void chk_report_conn_err(struct check *check, int errno_bck, int expired)
 
        if (conn && conn->err_code) {
                if (errno && errno != EAGAIN)
-                       chunk_printf(&trash, "%s (%s)%s", conn_err_code_str(conn), strerror(errno), chk->str);
+                       chunk_printf(&trash, "%s (%s)%s", conn_err_code_str(conn), strerror(errno),
+                                    chk->area);
                else
-                       chunk_printf(&trash, "%s%s", conn_err_code_str(conn), chk->str);
-               err_msg = trash.str;
+                       chunk_printf(&trash, "%s%s", conn_err_code_str(conn),
+                                    chk->area);
+               err_msg = trash.area;
        }
        else {
                if (errno && errno != EAGAIN) {
-                       chunk_printf(&trash, "%s%s", strerror(errno), chk->str);
-                       err_msg = trash.str;
+                       chunk_printf(&trash, "%s%s", strerror(errno),
+                                    chk->area);
+                       err_msg = trash.area;
                }
                else {
-                       err_msg = chk->str;
+                       err_msg = chk->area;
                }
        }
 
@@ -1112,14 +1117,15 @@ static void event_srv_chk_r(struct conn_stream *cs)
                                     hs, *msg ? " (" : "",
                                     msg, *msg ? ")" : "");
 
-                       set_server_check_status(check, status, t->str);
+                       set_server_check_status(check, status, t->area);
                }
                else if (err && *err) {
                        /* No status change but we'd like to report something odd.
                         * Just report the current state and copy the message.
                         */
                        chunk_printf(&trash, "agent reports an error : %s", err);
-                       set_server_check_status(check, status/*check->status*/, trash.str);
+                       set_server_check_status(check, status/*check->status*/,
+                                                trash.area);
 
                }
                else if (wrn && *wrn) {
@@ -1127,7 +1133,8 @@ static void event_srv_chk_r(struct conn_stream *cs)
                         * Just report the current state and copy the message.
                         */
                        chunk_printf(&trash, "agent warns : %s", wrn);
-                       set_server_check_status(check, status/*check->status*/, trash.str);
+                       set_server_check_status(check, status/*check->status*/,
+                                                trash.area);
                }
                else
                        set_server_check_status(check, status, NULL);
@@ -1530,7 +1537,8 @@ static int connect_conn_chk(struct task *t)
                }
                else if ((check->type) == PR_O2_HTTP_CHK) {
                        if (s->proxy->options2 & PR_O2_CHK_SNDST)
-                               b_putblk(&check->bo, trash.str, httpchk_build_status_header(s, trash.str, trash.size));
+                               b_putblk(&check->bo, trash.area,
+                                        httpchk_build_status_header(s, trash.area, trash.size));
                        /* prevent HTTP keep-alive when "http-check expect" is used */
                        if (s->proxy->options2 & PR_O2_EXP_TYPE)
                                b_putist(&check->bo, ist("Connection: close\r\n"));
@@ -2729,7 +2737,8 @@ static int tcpcheck_main(struct check *check)
                                comment = tcpcheck_get_step_comment(check, step);
                                if (comment)
                                        chunk_appendf(&trash, " comment: '%s'", comment);
-                               set_server_check_status(check, HCHK_STATUS_SOCKERR, trash.str);
+                               set_server_check_status(check, HCHK_STATUS_SOCKERR,
+                                                       trash.area);
                                check->current_step = NULL;
                                goto out;
                        }
@@ -2814,7 +2823,8 @@ static int tcpcheck_main(struct check *check)
                                comment = tcpcheck_get_step_comment(check, step);
                                if (comment)
                                        chunk_appendf(&trash, " comment: '%s'", comment);
-                               set_server_check_status(check, HCHK_STATUS_L4CON, trash.str);
+                               set_server_check_status(check, HCHK_STATUS_L4CON,
+                                                       trash.area);
                                goto out_end_tcpcheck;
                        case SF_ERR_PRXCOND:
                        case SF_ERR_RESOURCE:
@@ -2824,7 +2834,8 @@ static int tcpcheck_main(struct check *check)
                                comment = tcpcheck_get_step_comment(check, step);
                                if (comment)
                                        chunk_appendf(&trash, " comment: '%s'", comment);
-                               set_server_check_status(check, HCHK_STATUS_SOCKERR, trash.str);
+                               set_server_check_status(check, HCHK_STATUS_SOCKERR,
+                                                       trash.area);
                                goto out_end_tcpcheck;
                        }
 
@@ -2860,7 +2871,8 @@ static int tcpcheck_main(struct check *check)
                                chunk_printf(&trash, "tcp-check send : string too large (%d) for buffer size (%u) at step %d",
                                             check->current_step->string_len, (unsigned int)b_size(&check->bo),
                                             tcpcheck_get_step_id(check));
-                               set_server_check_status(check, HCHK_STATUS_L7RSP, trash.str);
+                               set_server_check_status(check, HCHK_STATUS_L7RSP,
+                                                       trash.area);
                                goto out_end_tcpcheck;
                        }
 
@@ -2930,7 +2942,8 @@ static int tcpcheck_main(struct check *check)
                                comment = tcpcheck_get_step_comment(check, step);
                                if (comment)
                                        chunk_appendf(&trash, " comment: '%s'", comment);
-                               set_server_check_status(check, HCHK_STATUS_L7RSP, trash.str);
+                               set_server_check_status(check, HCHK_STATUS_L7RSP,
+                                                       trash.area);
 
                                goto out_end_tcpcheck;
                        }
@@ -2964,7 +2977,8 @@ static int tcpcheck_main(struct check *check)
                                        comment = tcpcheck_get_step_comment(check, step);
                                        if (comment)
                                                chunk_appendf(&trash, " comment: '%s'", comment);
-                                       set_server_check_status(check, HCHK_STATUS_L7RSP, trash.str);
+                                       set_server_check_status(check, HCHK_STATUS_L7RSP,
+                                                               trash.area);
                                        goto out_end_tcpcheck;
                                }
                                /* matched and was supposed to => OK, next step */
@@ -3019,7 +3033,8 @@ static int tcpcheck_main(struct check *check)
                                        comment = tcpcheck_get_step_comment(check, step);
                                        if (comment)
                                                chunk_appendf(&trash, " comment: '%s'", comment);
-                                       set_server_check_status(check, HCHK_STATUS_L7RSP, trash.str);
+                                       set_server_check_status(check, HCHK_STATUS_L7RSP,
+                                                               trash.area);
                                        goto out_end_tcpcheck;
                                }
                        }
index f1a86d31e2e41c7c5aedfcdc0e2e866bca707679..f655277d51922ab0c5c9e20e968271c4bb7c0638 100644 (file)
@@ -35,7 +35,7 @@ static THREAD_LOCAL char *trash_buf2;
 struct pool_head *pool_head_trash = NULL;
 
 /* this is used to drain data, and as a temporary buffer for sprintf()... */
-THREAD_LOCAL struct chunk trash = { .str = NULL };
+THREAD_LOCAL struct chunk trash = { };
 
 /*
 * Returns a pre-allocated and initialized trash chunk that can be used for any
@@ -68,11 +68,11 @@ struct chunk *get_trash_chunk(void)
  */
 static int alloc_trash_buffers(int bufsize)
 {
-       chunk_init(&trash, my_realloc2(trash.str, bufsize), bufsize);
+       chunk_init(&trash, my_realloc2(trash.area, bufsize), bufsize);
        trash_size = bufsize;
        trash_buf1 = (char *)my_realloc2(trash_buf1, bufsize);
        trash_buf2 = (char *)my_realloc2(trash_buf2, bufsize);
-       return trash.str && trash_buf1 && trash_buf2;
+       return trash.area && trash_buf1 && trash_buf2;
 }
 
 static int init_trash_buffers_per_thread()
@@ -140,19 +140,19 @@ int chunk_printf(struct chunk *chk, const char *fmt, ...)
        va_list argp;
        int ret;
 
-       if (!chk->str || !chk->size)
+       if (!chk->area || !chk->size)
                return 0;
 
        va_start(argp, fmt);
-       ret = vsnprintf(chk->str, chk->size, fmt, argp);
+       ret = vsnprintf(chk->area, chk->size, fmt, argp);
        va_end(argp);
-       chk->len = ret;
+       chk->data = ret;
 
        if (ret >= chk->size)
                ret = -1;
 
-       chk->len = ret;
-       return chk->len;
+       chk->data = ret;
+       return chk->data;
 }
 
 /*
@@ -165,18 +165,19 @@ int chunk_appendf(struct chunk *chk, const char *fmt, ...)
        va_list argp;
        int ret;
 
-       if (chk->len < 0 || !chk->str || !chk->size)
+       if (chk->data < 0 || !chk->area || !chk->size)
                return 0;
 
        va_start(argp, fmt);
-       ret = vsnprintf(chk->str + chk->len, chk->size - chk->len, fmt, argp);
-       if (ret >= chk->size - chk->len)
+       ret = vsnprintf(chk->area + chk->data, chk->size - chk->data, fmt,
+                       argp);
+       if (ret >= chk->size - chk->data)
                /* do not copy anything in case of truncation */
-               chk->str[chk->len] = 0;
+               chk->area[chk->data] = 0;
        else
-               chk->len += ret;
+               chk->data += ret;
        va_end(argp);
-       return chk->len;
+       return chk->data;
 }
 
 /*
@@ -190,37 +191,38 @@ int chunk_htmlencode(struct chunk *dst, struct chunk *src)
        int olen, free;
        char c;
 
-       if (dst->len < 0)
-               return dst->len;
+       if (dst->data < 0)
+               return dst->data;
 
-       olen = dst->len;
+       olen = dst->data;
 
-       for (i = 0; i < src->len; i++) {
-               free = dst->size - dst->len;
+       for (i = 0; i < src->data; i++) {
+               free = dst->size - dst->data;
 
                if (!free) {
-                       dst->len = olen;
-                       return dst->len;
+                       dst->data = olen;
+                       return dst->data;
                }
 
-               c = src->str[i];
+               c = src->area[i];
 
                if (!isascii(c) || !isprint((unsigned char)c) || c == '&' || c == '"' || c == '\'' || c == '<' || c == '>') {
-                       l = snprintf(dst->str + dst->len, free, "&#%u;", (unsigned char)c);
+                       l = snprintf(dst->area + dst->data, free, "&#%u;",
+                                    (unsigned char)c);
 
                        if (free < l) {
-                               dst->len = olen;
-                               return dst->len;
+                               dst->data = olen;
+                               return dst->data;
                        }
 
-                       dst->len += l;
+                       dst->data += l;
                } else {
-                       dst->str[dst->len] = c;
-                       dst->len++;
+                       dst->area[dst->data] = c;
+                       dst->data++;
                }
        }
 
-       return dst->len;
+       return dst->data;
 }
 
 /*
@@ -234,37 +236,38 @@ int chunk_asciiencode(struct chunk *dst, struct chunk *src, char qc)
        int olen, free;
        char c;
 
-       if (dst->len < 0)
-               return dst->len;
+       if (dst->data < 0)
+               return dst->data;
 
-       olen = dst->len;
+       olen = dst->data;
 
-       for (i = 0; i < src->len; i++) {
-               free = dst->size - dst->len;
+       for (i = 0; i < src->data; i++) {
+               free = dst->size - dst->data;
 
                if (!free) {
-                       dst->len = olen;
-                       return dst->len;
+                       dst->data = olen;
+                       return dst->data;
                }
 
-               c = src->str[i];
+               c = src->area[i];
 
                if (!isascii(c) || !isprint((unsigned char)c) || c == '<' || c == '>' || c == qc) {
-                       l = snprintf(dst->str + dst->len, free, "<%02X>", (unsigned char)c);
+                       l = snprintf(dst->area + dst->data, free, "<%02X>",
+                                    (unsigned char)c);
 
                        if (free < l) {
-                               dst->len = olen;
-                               return dst->len;
+                               dst->data = olen;
+                               return dst->data;
                        }
 
-                       dst->len += l;
+                       dst->data += l;
                } else {
-                       dst->str[dst->len] = c;
-                       dst->len++;
+                       dst->area[dst->data] = c;
+                       dst->data++;
                }
        }
 
-       return dst->len;
+       return dst->data;
 }
 
 /* Compares the string in chunk <chk> with the string in <str> which must be
@@ -273,8 +276,8 @@ int chunk_asciiencode(struct chunk *dst, struct chunk *src, char qc)
  */
 int chunk_strcmp(const struct chunk *chk, const char *str)
 {
-       const char *s1 = chk->str;
-       int len = chk->len;
+       const char *s1 = chk->area;
+       int len = chk->data;
        int diff = 0;
 
        do {
@@ -293,8 +296,8 @@ int chunk_strcmp(const struct chunk *chk, const char *str)
  */
 int chunk_strcasecmp(const struct chunk *chk, const char *str)
 {
-       const char *s1 = chk->str;
-       int len = chk->len;
+       const char *s1 = chk->area;
+       int len = chk->data;
        int diff = 0;
 
        do {
index 0bc4722bdb07d5e915c8c128820e67d16b17019f..4440f251642b1400800bdbb551150c087ee26869 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -117,7 +117,7 @@ static char *cli_gen_usage_msg(struct appctx *appctx)
        }
        chunk_init(&out, NULL, 0);
        chunk_dup(&out, tmp);
-       dynamic_usage_msg = out.str;
+       dynamic_usage_msg = out.area;
 
 end:
        if (dynamic_usage_msg) {
@@ -403,8 +403,8 @@ static int cli_parse_request(struct appctx *appctx)
        appctx->st2 = 0;
        memset(&appctx->ctx.cli, 0, sizeof(appctx->ctx.cli));
 
-       p = appctx->chunk->str;
-       end = p + appctx->chunk->len;
+       p = appctx->chunk->area;
+       end = p + appctx->chunk->data;
 
        /*
         * Get the payload start if there is one.
@@ -454,7 +454,7 @@ static int cli_parse_request(struct appctx *appctx)
                i++;
        }
        /* fill unused slots */
-       p = appctx->chunk->str + appctx->chunk->len;
+       p = appctx->chunk->area + appctx->chunk->data;
        for (; i < MAX_STATS_ARGS + 1; i++)
                args[i] = p;
 
@@ -500,7 +500,7 @@ static int cli_output_msg(struct channel *chn, const char *msg, int severity, in
        }
        chunk_appendf(tmp, "%s", msg);
 
-       return ci_putblk(chn, tmp->str, strlen(tmp->str));
+       return ci_putblk(chn, tmp->area, strlen(tmp->area));
 }
 
 /* This I/O handler runs as an applet embedded in a stream interface. It is
@@ -557,7 +557,7 @@ static void cli_io_handler(struct appctx *appctx)
                                }
                        }
 
-                       str = appctx->chunk->str + appctx->chunk->len;
+                       str = appctx->chunk->area + appctx->chunk->data;
 
                        /* ensure we have some output room left in the event we
                         * would want to return some info right after parsing.
@@ -568,7 +568,8 @@ static void cli_io_handler(struct appctx *appctx)
                        }
 
                        /* '- 1' is to ensure a null byte can always be inserted at the end */
-                       reql = co_getline(si_oc(si), str, appctx->chunk->size - appctx->chunk->len - 1);
+                       reql = co_getline(si_oc(si), str,
+                                         appctx->chunk->size - appctx->chunk->data - 1);
                        if (reql <= 0) { /* closed or EOL not found */
                                if (reql == 0)
                                        break;
@@ -607,12 +608,12 @@ static void cli_io_handler(struct appctx *appctx)
                                len--;
 
                        str[len] = '\0';
-                       appctx->chunk->len += len;
+                       appctx->chunk->data += len;
 
                        if (appctx->st1 & APPCTX_CLI_ST1_PAYLOAD) {
-                               appctx->chunk->str[appctx->chunk->len] = '\n';
-                               appctx->chunk->str[appctx->chunk->len + 1] = 0;
-                               appctx->chunk->len++;
+                               appctx->chunk->area[appctx->chunk->data] = '\n';
+                               appctx->chunk->area[appctx->chunk->data + 1] = 0;
+                               appctx->chunk->data++;
                        }
 
                        appctx->st0 = CLI_ST_PROMPT;
@@ -621,8 +622,8 @@ static void cli_io_handler(struct appctx *appctx)
                                /* empty line */
                                if (!len) {
                                        /* remove the last two \n */
-                                       appctx->chunk->len -= 2;
-                                       appctx->chunk->str[appctx->chunk->len] = 0;
+                                       appctx->chunk->data -= 2;
+                                       appctx->chunk->area[appctx->chunk->data] = 0;
 
                                        if (!cli_parse_request(appctx))
                                                cli_gen_usage_msg(appctx);
@@ -641,7 +642,7 @@ static void cli_io_handler(struct appctx *appctx)
                                 * Its location is not remembered here, this is just to switch
                                 * to a gathering mode.
                                 */
-                               if (!strcmp(appctx->chunk->str + appctx->chunk->len - strlen(PAYLOAD_PATTERN), PAYLOAD_PATTERN))
+                               if (!strcmp(appctx->chunk->area + appctx->chunk->data - strlen(PAYLOAD_PATTERN), PAYLOAD_PATTERN))
                                        appctx->st1 |= APPCTX_CLI_ST1_PAYLOAD;
                                else {
                                        /* no payload, the command is complete: parse the request */
@@ -705,7 +706,7 @@ static void cli_io_handler(struct appctx *appctx)
                                         * when entering a payload with interactive mode, change the prompt
                                         * to emphasize that more data can still be sent
                                         */
-                                       if (appctx->chunk->len && appctx->st1 & APPCTX_CLI_ST1_PAYLOAD)
+                                       if (appctx->chunk->data && appctx->st1 & APPCTX_CLI_ST1_PAYLOAD)
                                                prompt = "+ ";
                                        else
                                                prompt = "\n> ";
@@ -1053,7 +1054,7 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx)
                                                                }
                                                        }
                                                        /* replace the latest comma by a newline */
-                                                       trash.str[trash.len-1] = '\n';
+                                                       trash.area[trash.data-1] = '\n';
 
                                                } else {
                                                        chunk_appendf(&trash, "all\n");
index 1ea96ae3daa9608d0b1eb85f7429e9091f711a3a..ca9a8ca2febc784677c6e256fd8bf0929557b6cc 100644 (file)
@@ -409,8 +409,9 @@ int conn_recv_proxy(struct connection *conn, int flag)
                return 0;
 
        do {
-               trash.len = recv(conn->handle.fd, trash.str, trash.size, MSG_PEEK);
-               if (trash.len < 0) {
+               trash.data = recv(conn->handle.fd, trash.area, trash.size,
+                                MSG_PEEK);
+               if (trash.data < 0) {
                        if (errno == EINTR)
                                continue;
                        if (errno == EAGAIN) {
@@ -421,24 +422,24 @@ int conn_recv_proxy(struct connection *conn, int flag)
                }
        } while (0);
 
-       if (!trash.len) {
+       if (!trash.data) {
                /* client shutdown */
                conn->err_code = CO_ER_PRX_EMPTY;
                goto fail;
        }
 
-       if (trash.len < 6)
+       if (trash.data < 6)
                goto missing;
 
-       line = trash.str;
-       end = trash.str + trash.len;
+       line = trash.area;
+       end = trash.area + trash.data;
 
        /* Decode a possible proxy request, fail early if it does not match */
        if (strncmp(line, "PROXY ", 6) != 0)
                goto not_v1;
 
        line += 6;
-       if (trash.len < 9) /* shortest possible line */
+       if (trash.data < 9) /* shortest possible line */
                goto missing;
 
        if (memcmp(line, "TCP4 ", 5) == 0) {
@@ -553,15 +554,15 @@ int conn_recv_proxy(struct connection *conn, int flag)
                goto fail;
        }
 
-       trash.len = line - trash.str;
+       trash.data = line - trash.area;
        goto eat_header;
 
  not_v1:
        /* try PPv2 */
-       if (trash.len < PP2_HEADER_LEN)
+       if (trash.data < PP2_HEADER_LEN)
                goto missing;
 
-       hdr_v2 = (struct proxy_hdr_v2 *)trash.str;
+       hdr_v2 = (struct proxy_hdr_v2 *) trash.area;
 
        if (memcmp(hdr_v2->sig, v2sig, PP2_SIGNATURE_LEN) != 0 ||
            (hdr_v2->ver_cmd & PP2_VERSION_MASK) != PP2_VERSION) {
@@ -569,7 +570,7 @@ int conn_recv_proxy(struct connection *conn, int flag)
                goto fail;
        }
 
-       if (trash.len < PP2_HEADER_LEN + ntohs(hdr_v2->len))
+       if (trash.data < PP2_HEADER_LEN + ntohs(hdr_v2->len))
                goto missing;
 
        switch (hdr_v2->ver_cmd & PP2_CMD_MASK) {
@@ -607,8 +608,8 @@ int conn_recv_proxy(struct connection *conn, int flag)
 
                /* TLV parsing */
                if (tlv_length > 0) {
-                       while (tlv_offset + TLV_HEADER_SIZE <= trash.len) {
-                               const struct tlv *tlv_packet = (struct tlv *) &trash.str[tlv_offset];
+                       while (tlv_offset + TLV_HEADER_SIZE <= trash.data) {
+                               const struct tlv *tlv_packet = (struct tlv *) &trash.area[tlv_offset];
                                const int tlv_len = get_tlv_length(tlv_packet);
                                tlv_offset += tlv_len + TLV_HEADER_SIZE;
 
@@ -617,7 +618,7 @@ int conn_recv_proxy(struct connection *conn, int flag)
                                        void *tlv_crc32c_p = (void *)tlv_packet->value;
                                        uint32_t n_crc32c = ntohl(read_u32(tlv_crc32c_p));
                                        write_u32(tlv_crc32c_p, 0);
-                                       if (hash_crc32c(trash.str, PP2_HEADER_LEN + ntohs(hdr_v2->len)) != n_crc32c)
+                                       if (hash_crc32c(trash.area, PP2_HEADER_LEN + ntohs(hdr_v2->len)) != n_crc32c)
                                                goto bad_header;
                                        break;
                                }
@@ -645,7 +646,7 @@ int conn_recv_proxy(struct connection *conn, int flag)
                goto bad_header; /* not a supported command */
        }
 
-       trash.len = PP2_HEADER_LEN + ntohs(hdr_v2->len);
+       trash.data = PP2_HEADER_LEN + ntohs(hdr_v2->len);
        goto eat_header;
 
  eat_header:
@@ -654,10 +655,10 @@ int conn_recv_proxy(struct connection *conn, int flag)
         * fail.
         */
        do {
-               int len2 = recv(conn->handle.fd, trash.str, trash.len, 0);
+               int len2 = recv(conn->handle.fd, trash.area, trash.data, 0);
                if (len2 < 0 && errno == EINTR)
                        continue;
-               if (len2 != trash.len)
+               if (len2 != trash.data)
                        goto recv_abort;
        } while (0);
 
@@ -722,8 +723,9 @@ int conn_recv_netscaler_cip(struct connection *conn, int flag)
                return 0;
 
        do {
-               trash.len = recv(conn->handle.fd, trash.str, trash.size, MSG_PEEK);
-               if (trash.len < 0) {
+               trash.data = recv(conn->handle.fd, trash.area, trash.size,
+                                MSG_PEEK);
+               if (trash.data < 0) {
                        if (errno == EINTR)
                                continue;
                        if (errno == EAGAIN) {
@@ -734,7 +736,7 @@ int conn_recv_netscaler_cip(struct connection *conn, int flag)
                }
        } while (0);
 
-       if (!trash.len) {
+       if (!trash.data) {
                /* client shutdown */
                conn->err_code = CO_ER_CIP_EMPTY;
                goto fail;
@@ -743,10 +745,10 @@ int conn_recv_netscaler_cip(struct connection *conn, int flag)
        /* Fail if buffer length is not large enough to contain
         * CIP magic, header length or
         * CIP magic, CIP length, CIP type, header length */
-       if (trash.len < 12)
+       if (trash.data < 12)
                goto missing;
 
-       line = trash.str;
+       line = trash.area;
 
        /* Decode a possible NetScaler Client IP request, fail early if
         * it does not match */
@@ -754,12 +756,12 @@ int conn_recv_netscaler_cip(struct connection *conn, int flag)
                goto bad_magic;
 
        /* Legacy CIP protocol */
-       if ((trash.str[8] & 0xD0) == 0x40) {
+       if ((trash.area[8] & 0xD0) == 0x40) {
                hdr_len = ntohl(*(uint32_t *)(line+4));
                line += 8;
        }
        /* Standard CIP protocol */
-       else if (trash.str[8] == 0x00) {
+       else if (trash.area[8] == 0x00) {
                hdr_len = ntohs(*(uint32_t *)(line+10));
                line += 12;
        }
@@ -771,7 +773,7 @@ int conn_recv_netscaler_cip(struct connection *conn, int flag)
 
        /* Fail if buffer length is not large enough to contain
         * a minimal IP header */
-       if (trash.len < 20)
+       if (trash.data < 20)
                goto missing;
 
        /* Get IP version from the first four bits */
@@ -783,7 +785,7 @@ int conn_recv_netscaler_cip(struct connection *conn, int flag)
 
                hdr_ip4 = (struct ip *)line;
 
-               if (trash.len < 40 || trash.len < hdr_len) {
+               if (trash.data < 40 || trash.data < hdr_len) {
                        /* Fail if buffer length is not large enough to contain
                         * IPv4 header, TCP header */
                        goto missing;
@@ -813,7 +815,7 @@ int conn_recv_netscaler_cip(struct connection *conn, int flag)
 
                hdr_ip6 = (struct ip6_hdr *)line;
 
-               if (trash.len < 60 || trash.len < hdr_len) {
+               if (trash.data < 60 || trash.data < hdr_len) {
                        /* Fail if buffer length is not large enough to contain
                         * IPv6 header, TCP header */
                        goto missing;
@@ -844,17 +846,17 @@ int conn_recv_netscaler_cip(struct connection *conn, int flag)
        }
 
        line += hdr_len;
-       trash.len = line - trash.str;
+       trash.data = line - trash.area;
 
        /* remove the NetScaler Client IP header from the request. For this
         * we re-read the exact line at once. If we don't get the exact same
         * result, we fail.
         */
        do {
-               int len2 = recv(conn->handle.fd, trash.str, trash.len, 0);
+               int len2 = recv(conn->handle.fd, trash.area, trash.data, 0);
                if (len2 < 0 && errno == EINTR)
                        continue;
-               if (len2 != trash.len)
+               if (len2 != trash.data)
                        goto recv_abort;
        } while (0);
 
@@ -1096,13 +1098,17 @@ int make_proxy_line_v2(char *buf, int buf_len, struct server *srv, struct connec
                        if (srv->pp_opts & SRV_PP_V2_SSL_CN) {
                                struct chunk *cn_trash = get_trash_chunk();
                                if (ssl_sock_get_remote_common_name(remote, cn_trash) > 0) {
-                                       ssl_tlv_len += make_tlv(&buf[ret+ssl_tlv_len], (buf_len - ret - ssl_tlv_len), PP2_SUBTYPE_SSL_CN, cn_trash->len, cn_trash->str);
+                                       ssl_tlv_len += make_tlv(&buf[ret+ssl_tlv_len], (buf_len - ret - ssl_tlv_len), PP2_SUBTYPE_SSL_CN,
+                                                               cn_trash->data,
+                                                               cn_trash->area);
                                }
                        }
                        if (srv->pp_opts & SRV_PP_V2_SSL_KEY_ALG) {
                                struct chunk *pkey_trash = get_trash_chunk();
                                if (ssl_sock_get_pkey_algo(remote, pkey_trash) > 0) {
-                                       ssl_tlv_len += make_tlv(&buf[ret+ssl_tlv_len], (buf_len - ret - ssl_tlv_len), PP2_SUBTYPE_SSL_KEY_ALG, pkey_trash->len, pkey_trash->str);
+                                       ssl_tlv_len += make_tlv(&buf[ret+ssl_tlv_len], (buf_len - ret - ssl_tlv_len), PP2_SUBTYPE_SSL_KEY_ALG,
+                                                               pkey_trash->data,
+                                                               pkey_trash->area);
                                }
                        }
                        if (srv->pp_opts & SRV_PP_V2_SSL_SIG_ALG) {
index 685a79d196ae509b903ff0d85a21bbb3d63dcced..b21159ce420c88e50d4753b3edcca89b52e76ebe 100644 (file)
--- a/src/da.c
+++ b/src/da.c
@@ -193,10 +193,11 @@ static int da_haproxy(const struct arg *args, struct sample *smp, da_deviceinfo_
        tmp = get_trash_chunk();
        chunk_reset(tmp);
 
-       propname = (const char *)args[0].data.str.str;
+       propname = (const char *) args[0].data.str.area;
        i = 0;
 
-       for (; propname != 0; i ++, propname = (const char *)args[i].data.str.str) {
+       for (; propname != 0; i ++,
+            propname = (const char *) args[i].data.str.area) {
                status = da_atlas_getpropid(&global_deviceatlas.atlas,
                        propname, &prop);
                if (status != DA_OK) {
@@ -241,13 +242,13 @@ static int da_haproxy(const struct arg *args, struct sample *smp, da_deviceinfo_
 
        da_close(devinfo);
 
-       if (tmp->len) {
-               --tmp->len;
-               tmp->str[tmp->len] = 0;
+       if (tmp->data) {
+               --tmp->data;
+               tmp->area[tmp->data] = 0;
        }
 
-       smp->data.u.str.str = tmp->str;
-       smp->data.u.str.len = tmp->len;
+       smp->data.u.str.area = tmp->area;
+       smp->data.u.str.data = tmp->data;
 
        return 1;
 }
@@ -260,12 +261,12 @@ static int da_haproxy_conv(const struct arg *args, struct sample *smp, void *pri
        char useragentbuf[1024] = { 0 };
        int i;
 
-       if (global_deviceatlas.daset == 0 || smp->data.u.str.len == 0) {
+       if (global_deviceatlas.daset == 0 || smp->data.u.str.data == 0) {
                return 1;
        }
 
-       i = smp->data.u.str.len > sizeof(useragentbuf) ? sizeof(useragentbuf) : smp->data.u.str.len;
-       memcpy(useragentbuf, smp->data.u.str.str, i - 1);
+       i = smp->data.u.str.data > sizeof(useragentbuf) ? sizeof(useragentbuf) : smp->data.u.str.data;
+       memcpy(useragentbuf, smp->data.u.str.area, i - 1);
        useragentbuf[i - 1] = 0;
 
        useragent = (const char *)useragentbuf;
index 77bf5c00410027da102009961f60d427f9665633..985ed0f3379bae28c5e6ffa7a835de042caac665 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -87,7 +87,8 @@ struct dns_srvrq *new_dns_srvrq(struct server *srv, char *fqdn)
        int fqdn_len, hostname_dn_len;
 
        fqdn_len = strlen(fqdn);
-       hostname_dn_len = dns_str_to_dn_label(fqdn, fqdn_len + 1, trash.str, trash.size);
+       hostname_dn_len = dns_str_to_dn_label(fqdn, fqdn_len + 1, trash.area,
+                                             trash.size);
        if (hostname_dn_len == -1) {
                ha_alert("config : %s '%s', server '%s': failed to parse FQDN '%s'\n",
                         proxy_type_str(px), px->id, srv->id, fqdn);
@@ -102,7 +103,7 @@ struct dns_srvrq *new_dns_srvrq(struct server *srv, char *fqdn)
        srvrq->obj_type        = OBJ_TYPE_SRVRQ;
        srvrq->proxy           = px;
        srvrq->name            = strdup(fqdn);
-       srvrq->hostname_dn     = strdup(trash.str);
+       srvrq->hostname_dn     = strdup(trash.area);
        srvrq->hostname_dn_len = hostname_dn_len;
        if (!srvrq->name || !srvrq->hostname_dn) {
                ha_alert("config : %s '%s', server '%s': out of memory\n",
@@ -1678,15 +1679,15 @@ static void dns_resolve_send(struct dgram_conn *dgram)
                if (res->nb_queries == resolvers->nb_nameservers)
                        continue;
 
-               trash.len = dns_build_query(res->query_id, res->query_type,
+               trash.data = dns_build_query(res->query_id, res->query_type,
                                            resolvers->accepted_payload_size,
                                            res->hostname_dn, res->hostname_dn_len,
-                                           trash.str, trash.size);
-               if (trash.len == -1)
+                                           trash.area, trash.size);
+               if (trash.data == -1)
                        goto snd_error;
 
-               ret = send(fd, trash.str, trash.len, 0);
-               if (ret != trash.len)
+               ret = send(fd, trash.area, trash.data, 0);
+               if (ret != trash.data)
                        goto snd_error;
 
                ns->counters.sent++;
index 86d0866b259686f21487b64c44b163b85e6a7ce2..bf8f81ae5641d49eb465756dbcaaaf030948b05a 100644 (file)
@@ -565,12 +565,14 @@ select_compression_response_header(struct comp_state *st, struct stream *s, stru
         * header.
         */
        if (st->comp_algo->cfg_name_len != 8 || memcmp(st->comp_algo->cfg_name, "identity", 8) != 0) {
-               trash.len = 18;
-               memcpy(trash.str, "Content-Encoding: ", trash.len);
-               memcpy(trash.str + trash.len, st->comp_algo->ua_name, st->comp_algo->ua_name_len);
-               trash.len += st->comp_algo->ua_name_len;
-               trash.str[trash.len] = '\0';
-               http_header_add_tail2(&txn->rsp, &txn->hdr_idx, trash.str, trash.len);
+               trash.data = 18;
+               memcpy(trash.area, "Content-Encoding: ", trash.data);
+               memcpy(trash.area + trash.data, st->comp_algo->ua_name,
+                      st->comp_algo->ua_name_len);
+               trash.data += st->comp_algo->ua_name_len;
+               trash.area[trash.data] = '\0';
+               http_header_add_tail2(&txn->rsp, &txn->hdr_idx, trash.area,
+                                     trash.data);
        }
        msg->flags |= HTTP_MSGF_COMPRESSING;
        return 1;
@@ -977,8 +979,8 @@ smp_fetch_res_comp_algo(const struct arg *args, struct sample *smp,
 
                smp->data.type = SMP_T_STR;
                smp->flags = SMP_F_CONST;
-               smp->data.u.str.str = st->comp_algo->cfg_name;
-               smp->data.u.str.len = st->comp_algo->cfg_name_len;
+               smp->data.u.str.area = st->comp_algo->cfg_name;
+               smp->data.u.str.data = st->comp_algo->cfg_name_len;
                return 1;
        }
        return 0;
index b0f25faf0054b023f10ed87aca2d5616102ab11a..06125e208ddf9fd046c366788b562ca5fa433ea6 100644 (file)
@@ -437,20 +437,20 @@ spoe_prepare_hahello_frame(struct appctx *appctx, char *frame, size_t size)
        *p++ = SPOE_DATA_T_STR;
        chk = get_trash_chunk();
        if (agent != NULL && (agent->flags & SPOE_FL_PIPELINING)) {
-               memcpy(chk->str, "pipelining", 10);
-               chk->len += 10;
+               memcpy(chk->area, "pipelining", 10);
+               chk->data += 10;
        }
        if (agent != NULL && (agent->flags & SPOE_FL_ASYNC)) {
-               if (chk->len) chk->str[chk->len++] = ',';
-               memcpy(chk->str+chk->len, "async", 5);
-               chk->len += 5;
+               if (chk->data) chk->area[chk->data++] = ',';
+               memcpy(chk->area+chk->data, "async", 5);
+               chk->data += 5;
        }
        if (agent != NULL && (agent->flags & SPOE_FL_RCV_FRAGMENTATION)) {
-               if (chk->len) chk->str[chk->len++] = ',';
-               memcpy(chk->str+chk->len, "fragmentation", 13);
-               chk->len += 5;
+               if (chk->data) chk->area[chk->data++] = ',';
+               memcpy(chk->area+chk->data, "fragmentation", 13);
+               chk->data += 5;
        }
-       if (spoe_encode_buffer(chk->str, chk->len, &p, end) == -1)
+       if (spoe_encode_buffer(chk->area, chk->data, &p, end) == -1)
                goto too_big;
 
        /* (optionnal) "engine-id" K/V item, if present */
@@ -1361,7 +1361,7 @@ spoe_handle_connect_appctx(struct appctx *appctx)
 
        /* 4 bytes are reserved at the beginning of <buf> to store the frame
         * length. */
-       buf = trash.str; frame = buf+4;
+       buf = trash.area; frame = buf+4;
        ret = spoe_prepare_hahello_frame(appctx, frame,
                                         SPOE_APPCTX(appctx)->max_frame_size);
        if (ret > 1)
@@ -1414,7 +1414,7 @@ spoe_handle_connecting_appctx(struct appctx *appctx)
                goto exit;
        }
 
-       frame = trash.str; trash.len = 0;
+       frame = trash.area; trash.data = 0;
        ret = spoe_recv_frame(appctx, frame,
                              SPOE_APPCTX(appctx)->max_frame_size);
        if (ret > 1) {
@@ -1422,7 +1422,7 @@ spoe_handle_connecting_appctx(struct appctx *appctx)
                        appctx->st0 = SPOE_APPCTX_ST_DISCONNECTING;
                        goto next;
                }
-               trash.len = ret + 4;
+               trash.data = ret + 4;
                ret = spoe_handle_agenthello_frame(appctx, frame, ret);
        }
 
@@ -1450,8 +1450,8 @@ spoe_handle_connecting_appctx(struct appctx *appctx)
 
   next:
        /* Do not forget to remove processed frame from the output buffer */
-       if (trash.len)
-               co_skip(si_oc(si), trash.len);
+       if (trash.data)
+               co_skip(si_oc(si), trash.data);
 
        SPOE_APPCTX(appctx)->task->expire =
                tick_add_ifset(now_ms, agent->timeout.idle);
@@ -1474,7 +1474,7 @@ spoe_handle_sending_frame_appctx(struct appctx *appctx, int *skip)
 
        /* 4 bytes are reserved at the beginning of <buf> to store the frame
         * length. */
-       buf = trash.str; frame = buf+4;
+       buf = trash.area; frame = buf+4;
 
        if (appctx->st0 == SPOE_APPCTX_ST_SENDING_FRAG_NOTIFY) {
                ctx = SPOE_APPCTX(appctx)->frag_ctx.ctx;
@@ -1592,7 +1592,7 @@ spoe_handle_receiving_frame_appctx(struct appctx *appctx, int *skip)
        char *frame;
        int   ret;
 
-       frame = trash.str; trash.len = 0;
+       frame = trash.area; trash.data = 0;
        ret = spoe_recv_frame(appctx, frame,
                              SPOE_APPCTX(appctx)->max_frame_size);
        if (ret > 1) {
@@ -1601,7 +1601,7 @@ spoe_handle_receiving_frame_appctx(struct appctx *appctx, int *skip)
                        ret = -1;
                        goto end;
                }
-               trash.len = ret + 4;
+               trash.data = ret + 4;
                ret = spoe_handle_agentack_frame(appctx, &ctx, frame, ret);
        }
        switch (ret) {
@@ -1640,8 +1640,8 @@ spoe_handle_receiving_frame_appctx(struct appctx *appctx, int *skip)
        }
 
        /* Do not forget to remove processed frame from the output buffer */
-       if (trash.len)
-               co_skip(si_oc(appctx->owner), trash.len);
+       if (trash.data)
+               co_skip(si_oc(appctx->owner), trash.data);
   end:
        return ret;
 }
@@ -1756,7 +1756,7 @@ spoe_handle_disconnect_appctx(struct appctx *appctx)
 
        /* 4 bytes are reserved at the beginning of <buf> to store the frame
         * length. */
-       buf = trash.str; frame = buf+4;
+       buf = trash.area; frame = buf+4;
        ret = spoe_prepare_hadiscon_frame(appctx, frame,
                                          SPOE_APPCTX(appctx)->max_frame_size);
        if (ret > 1)
@@ -1810,11 +1810,11 @@ spoe_handle_disconnecting_appctx(struct appctx *appctx)
                goto exit;
        }
 
-       frame = trash.str; trash.len = 0;
+       frame = trash.area; trash.data = 0;
        ret = spoe_recv_frame(appctx, frame,
                              SPOE_APPCTX(appctx)->max_frame_size);
        if (ret > 1) {
-               trash.len = ret + 4;
+               trash.data = ret + 4;
                ret = spoe_handle_agentdiscon_frame(appctx, frame, ret);
        }
 
@@ -1846,8 +1846,8 @@ spoe_handle_disconnecting_appctx(struct appctx *appctx)
 
   next:
        /* Do not forget to remove processed frame from the output buffer */
-       if (trash.len)
-               co_skip(si_oc(appctx->owner), trash.len);
+       if (trash.data)
+               co_skip(si_oc(appctx->owner), trash.data);
 
        return 0;
   stop:
@@ -4141,12 +4141,12 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
        if (curagent->var_on_error) {
                struct arg arg;
 
-               trash.len = snprintf(trash.str, trash.size, "txn.%s.%s",
+               trash.data = snprintf(trash.area, trash.size, "txn.%s.%s",
                                     curagent->var_pfx, curagent->var_on_error);
 
                arg.type = ARGT_STR;
-               arg.data.str.str = trash.str;
-               arg.data.str.len = trash.len;
+               arg.data.str.area = trash.area;
+               arg.data.str.data = trash.data;
                if (!vars_check_arg(&arg, err)) {
                        memprintf(err, "SPOE agent '%s': failed to register variable %s.%s (%s)",
                                  curagent->id, curagent->var_pfx, curagent->var_on_error, *err);
@@ -4157,12 +4157,12 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
        if (curagent->var_t_process) {
                struct arg arg;
 
-               trash.len = snprintf(trash.str, trash.size, "txn.%s.%s",
+               trash.data = snprintf(trash.area, trash.size, "txn.%s.%s",
                                     curagent->var_pfx, curagent->var_t_process);
 
                arg.type = ARGT_STR;
-               arg.data.str.str = trash.str;
-               arg.data.str.len = trash.len;
+               arg.data.str.area = trash.area;
+               arg.data.str.data = trash.data;
                if (!vars_check_arg(&arg, err)) {
                        memprintf(err, "SPOE agent '%s': failed to register variable %s.%s (%s)",
                                  curagent->id, curagent->var_pfx, curagent->var_t_process, *err);
@@ -4173,12 +4173,12 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
        if (curagent->var_t_total) {
                struct arg arg;
 
-               trash.len = snprintf(trash.str, trash.size, "txn.%s.%s",
+               trash.data = snprintf(trash.area, trash.size, "txn.%s.%s",
                                     curagent->var_pfx, curagent->var_t_total);
 
                arg.type = ARGT_STR;
-               arg.data.str.str = trash.str;
-               arg.data.str.len = trash.len;
+               arg.data.str.area = trash.area;
+               arg.data.str.data = trash.data;
                if (!vars_check_arg(&arg, err)) {
                        memprintf(err, "SPOE agent '%s': failed to register variable %s.%s (%s)",
                                  curagent->id, curagent->var_pfx, curagent->var_t_process, *err);
@@ -4378,12 +4378,12 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
        list_for_each_entry_safe(vph, vphback, &curvars, list) {
                struct arg arg;
 
-               trash.len = snprintf(trash.str, trash.size, "proc.%s.%s",
+               trash.data = snprintf(trash.area, trash.size, "proc.%s.%s",
                                     curagent->var_pfx, vph->name);
 
                arg.type = ARGT_STR;
-               arg.data.str.str = trash.str;
-               arg.data.str.len = trash.len;
+               arg.data.str.area = trash.area;
+               arg.data.str.data = trash.data;
                if (!vars_check_arg(&arg, err)) {
                        memprintf(err, "SPOE agent '%s': failed to register variable %s.%s (%s)",
                                  curagent->id, curagent->var_pfx, vph->name, *err);
index 361499dbaf92b6065e0e63d5da165a5f2b24c6ea..65c696601f9dc5b5976e984638a6d997cc4afc3e 100644 (file)
@@ -124,7 +124,7 @@ int frontend_accept(struct stream *s)
                        break;
                }
 
-               shut_your_big_mouth_gcc(write(1, trash.str, trash.len));
+               shut_your_big_mouth_gcc(write(1, trash.area, trash.data));
        }
 
        if (fe->mode == PR_MODE_HTTP)
@@ -184,13 +184,13 @@ smp_fetch_fe_id(const struct arg *args, struct sample *smp, const char *kw, void
 static int
 smp_fetch_fe_name(const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
-       smp->data.u.str.str = (char *)smp->sess->fe->id;
-       if (!smp->data.u.str.str)
+       smp->data.u.str.area = (char *)smp->sess->fe->id;
+       if (!smp->data.u.str.area)
                return 0;
 
        smp->data.type = SMP_T_STR;
        smp->flags = SMP_F_CONST;
-       smp->data.u.str.len = strlen(smp->data.u.str.str);
+       smp->data.u.str.data = strlen(smp->data.u.str.area);
        return 1;
 }
 
@@ -200,13 +200,13 @@ smp_fetch_fe_defbe(const struct arg *args, struct sample *smp, const char *kw, v
 {
        if (!smp->sess->fe->defbe.be)
                return 0;
-       smp->data.u.str.str = (char *)smp->sess->fe->defbe.be->id;
-       if (!smp->data.u.str.str)
+       smp->data.u.str.area = (char *)smp->sess->fe->defbe.be->id;
+       if (!smp->data.u.str.area)
                return 0;
 
        smp->data.type = SMP_T_STR;
        smp->flags = SMP_F_CONST;
-       smp->data.u.str.len = strlen(smp->data.u.str.str);
+       smp->data.u.str.data = strlen(smp->data.u.str.area);
        return 1;
 }
 
index 768034adae1fbf63a9b8e129bc882aac0e3488fc..e0e8791f07babfdfb4d0d38ff43191063ccbf1aa 100644 (file)
@@ -852,8 +852,8 @@ static void sig_dump_state(struct sig_handler *sh)
                                     p->id, s->id,
                                     (s->cur_state != SRV_ST_STOPPED) ? "UP" : "DOWN",
                                     s->cur_sess, s->nbpend, s->counters.cum_sess);
-                       ha_warning("%s\n", trash.str);
-                       send_log(p, LOG_NOTICE, "%s\n", trash.str);
+                       ha_warning("%s\n", trash.area);
+                       send_log(p, LOG_NOTICE, "%s\n", trash.area);
                        s = s->next;
                }
 
@@ -876,8 +876,8 @@ static void sig_dump_state(struct sig_handler *sh)
                                     p->id, p->srv_act, p->srv_bck,
                                     p->feconn, p->beconn, p->totpend, p->nbpend, p->fe_counters.cum_conn, p->be_counters.cum_conn);
                }
-               ha_warning("%s\n", trash.str);
-               send_log(p, LOG_NOTICE, "%s\n", trash.str);
+               ha_warning("%s\n", trash.area);
+               send_log(p, LOG_NOTICE, "%s\n", trash.area);
 
                p = p->next;
        }
index 32cb66d133cbd78a7abeaeb8ce40448bd05b2c54..9e43593b8ecbfcb3d4a315b41745873bf95b299e 100644 (file)
@@ -340,7 +340,7 @@ __LJMP static const char *hlua_traceback(lua_State *L)
                        chunk_appendf(msg, " ...");
        }
 
-       return msg->str;
+       return msg->area;
 }
 
 
@@ -386,7 +386,7 @@ static int hlua_arg2lua(lua_State *L, const struct arg *arg)
                break;
 
        case ARGT_STR:
-               lua_pushlstring(L, arg->data.str.str, arg->data.str.len);
+               lua_pushlstring(L, arg->data.str.area, arg->data.str.data);
                break;
 
        case ARGT_IPV4:
@@ -423,7 +423,7 @@ static int hlua_lua2arg(lua_State *L, int ud, struct arg *arg)
 
        case LUA_TSTRING:
                arg->type = ARGT_STR;
-               arg->data.str.str = (char *)lua_tolstring(L, ud, (size_t *)&arg->data.str.len);
+               arg->data.str.area = (char *)lua_tolstring(L, ud, (size_t *)&arg->data.str.data);
                break;
 
        case LUA_TUSERDATA:
@@ -453,7 +453,7 @@ static int hlua_smp2lua(lua_State *L, struct sample *smp)
 
        case SMP_T_BIN:
        case SMP_T_STR:
-               lua_pushlstring(L, smp->data.u.str.str, smp->data.u.str.len);
+               lua_pushlstring(L, smp->data.u.str.area, smp->data.u.str.data);
                break;
 
        case SMP_T_METH:
@@ -467,7 +467,7 @@ static int hlua_smp2lua(lua_State *L, struct sample *smp)
                case HTTP_METH_TRACE:   lua_pushstring(L, "TRACE");   break;
                case HTTP_METH_CONNECT: lua_pushstring(L, "CONNECT"); break;
                case HTTP_METH_OTHER:
-                       lua_pushlstring(L, smp->data.u.meth.str.str, smp->data.u.meth.str.len);
+                       lua_pushlstring(L, smp->data.u.meth.str.area, smp->data.u.meth.str.data);
                        break;
                default:
                        lua_pushnil(L);
@@ -480,7 +480,7 @@ static int hlua_smp2lua(lua_State *L, struct sample *smp)
        case SMP_T_ADDR: /* This type is never used to qualify a sample. */
                if (sample_casts[smp->data.type][SMP_T_STR] &&
                    sample_casts[smp->data.type][SMP_T_STR](smp))
-                       lua_pushlstring(L, smp->data.u.str.str, smp->data.u.str.len);
+                       lua_pushlstring(L, smp->data.u.str.area, smp->data.u.str.data);
                else
                        lua_pushnil(L);
                break;
@@ -501,7 +501,7 @@ static int hlua_smp2lua_str(lua_State *L, struct sample *smp)
 
        case SMP_T_BIN:
        case SMP_T_STR:
-               lua_pushlstring(L, smp->data.u.str.str, smp->data.u.str.len);
+               lua_pushlstring(L, smp->data.u.str.area, smp->data.u.str.data);
                break;
 
        case SMP_T_METH:
@@ -515,7 +515,7 @@ static int hlua_smp2lua_str(lua_State *L, struct sample *smp)
                case HTTP_METH_TRACE:   lua_pushstring(L, "TRACE");   break;
                case HTTP_METH_CONNECT: lua_pushstring(L, "CONNECT"); break;
                case HTTP_METH_OTHER:
-                       lua_pushlstring(L, smp->data.u.meth.str.str, smp->data.u.meth.str.len);
+                       lua_pushlstring(L, smp->data.u.meth.str.area, smp->data.u.meth.str.data);
                        break;
                default:
                        lua_pushstring(L, "");
@@ -530,7 +530,7 @@ static int hlua_smp2lua_str(lua_State *L, struct sample *smp)
        case SMP_T_ADDR: /* This type is never used to qualify a sample. */
                if (sample_casts[smp->data.type][SMP_T_STR] &&
                    sample_casts[smp->data.type][SMP_T_STR](smp))
-                       lua_pushlstring(L, smp->data.u.str.str, smp->data.u.str.len);
+                       lua_pushlstring(L, smp->data.u.str.area, smp->data.u.str.data);
                else
                        lua_pushstring(L, "");
                break;
@@ -563,7 +563,7 @@ static int hlua_lua2smp(lua_State *L, int ud, struct sample *smp)
        case LUA_TSTRING:
                smp->data.type = SMP_T_STR;
                smp->flags |= SMP_F_CONST;
-               smp->data.u.str.str = (char *)lua_tolstring(L, ud, (size_t *)&smp->data.u.str.len);
+               smp->data.u.str.area = (char *)lua_tolstring(L, ud, (size_t *)&smp->data.u.str.data);
                break;
 
        case LUA_TUSERDATA:
@@ -684,9 +684,10 @@ __LJMP int hlua_lua2arg_check(lua_State *L, int first, struct arg *argp,
                case ARGT_FE:
                        if (argp[idx].type != ARGT_STR)
                                WILL_LJMP(luaL_argerror(L, first + idx, "string expected"));
-                       memcpy(trash.str, argp[idx].data.str.str, argp[idx].data.str.len);
-                       trash.str[argp[idx].data.str.len] = 0;
-                       argp[idx].data.prx = proxy_fe_by_name(trash.str);
+                       memcpy(trash.area, argp[idx].data.str.area,
+                              argp[idx].data.str.data);
+                       trash.area[argp[idx].data.str.data] = 0;
+                       argp[idx].data.prx = proxy_fe_by_name(trash.area);
                        if (!argp[idx].data.prx)
                                WILL_LJMP(luaL_argerror(L, first + idx, "frontend doesn't exist"));
                        argp[idx].type = ARGT_FE;
@@ -695,9 +696,10 @@ __LJMP int hlua_lua2arg_check(lua_State *L, int first, struct arg *argp,
                case ARGT_BE:
                        if (argp[idx].type != ARGT_STR)
                                WILL_LJMP(luaL_argerror(L, first + idx, "string expected"));
-                       memcpy(trash.str, argp[idx].data.str.str, argp[idx].data.str.len);
-                       trash.str[argp[idx].data.str.len] = 0;
-                       argp[idx].data.prx = proxy_be_by_name(trash.str);
+                       memcpy(trash.area, argp[idx].data.str.area,
+                              argp[idx].data.str.data);
+                       trash.area[argp[idx].data.str.data] = 0;
+                       argp[idx].data.prx = proxy_be_by_name(trash.area);
                        if (!argp[idx].data.prx)
                                WILL_LJMP(luaL_argerror(L, first + idx, "backend doesn't exist"));
                        argp[idx].type = ARGT_BE;
@@ -706,9 +708,10 @@ __LJMP int hlua_lua2arg_check(lua_State *L, int first, struct arg *argp,
                case ARGT_TAB:
                        if (argp[idx].type != ARGT_STR)
                                WILL_LJMP(luaL_argerror(L, first + idx, "string expected"));
-                       memcpy(trash.str, argp[idx].data.str.str, argp[idx].data.str.len);
-                       trash.str[argp[idx].data.str.len] = 0;
-                       argp[idx].data.prx = proxy_tbl_by_name(trash.str);
+                       memcpy(trash.area, argp[idx].data.str.area,
+                              argp[idx].data.str.data);
+                       trash.area[argp[idx].data.str.data] = 0;
+                       argp[idx].data.prx = proxy_tbl_by_name(trash.area);
                        if (!argp[idx].data.prx)
                                WILL_LJMP(luaL_argerror(L, first + idx, "table doesn't exist"));
                        argp[idx].type = ARGT_TAB;
@@ -717,18 +720,19 @@ __LJMP int hlua_lua2arg_check(lua_State *L, int first, struct arg *argp,
                case ARGT_SRV:
                        if (argp[idx].type != ARGT_STR)
                                WILL_LJMP(luaL_argerror(L, first + idx, "string expected"));
-                       memcpy(trash.str, argp[idx].data.str.str, argp[idx].data.str.len);
-                       trash.str[argp[idx].data.str.len] = 0;
-                       sname = strrchr(trash.str, '/');
+                       memcpy(trash.area, argp[idx].data.str.area,
+                              argp[idx].data.str.data);
+                       trash.area[argp[idx].data.str.data] = 0;
+                       sname = strrchr(trash.area, '/');
                        if (sname) {
                                *sname++ = '\0';
-                               pname = trash.str;
+                               pname = trash.area;
                                px = proxy_be_by_name(pname);
                                if (!px)
                                        WILL_LJMP(luaL_argerror(L, first + idx, "backend doesn't exist"));
                        }
                        else {
-                               sname = trash.str;
+                               sname = trash.area;
                                px = p;
                        }
                        argp[idx].data.srv = findserver(px, sname);
@@ -738,33 +742,37 @@ __LJMP int hlua_lua2arg_check(lua_State *L, int first, struct arg *argp,
                        break;
 
                case ARGT_IPV4:
-                       memcpy(trash.str, argp[idx].data.str.str, argp[idx].data.str.len);
-                       trash.str[argp[idx].data.str.len] = 0;
-                       if (inet_pton(AF_INET, trash.str, &argp[idx].data.ipv4))
+                       memcpy(trash.area, argp[idx].data.str.area,
+                              argp[idx].data.str.data);
+                       trash.area[argp[idx].data.str.data] = 0;
+                       if (inet_pton(AF_INET, trash.area, &argp[idx].data.ipv4))
                                WILL_LJMP(luaL_argerror(L, first + idx, "invalid IPv4 address"));
                        argp[idx].type = ARGT_IPV4;
                        break;
 
                case ARGT_MSK4:
-                       memcpy(trash.str, argp[idx].data.str.str, argp[idx].data.str.len);
-                       trash.str[argp[idx].data.str.len] = 0;
-                       if (!str2mask(trash.str, &argp[idx].data.ipv4))
+                       memcpy(trash.area, argp[idx].data.str.area,
+                              argp[idx].data.str.data);
+                       trash.area[argp[idx].data.str.data] = 0;
+                       if (!str2mask(trash.area, &argp[idx].data.ipv4))
                                WILL_LJMP(luaL_argerror(L, first + idx, "invalid IPv4 mask"));
                        argp[idx].type = ARGT_MSK4;
                        break;
 
                case ARGT_IPV6:
-                       memcpy(trash.str, argp[idx].data.str.str, argp[idx].data.str.len);
-                       trash.str[argp[idx].data.str.len] = 0;
-                       if (inet_pton(AF_INET6, trash.str, &argp[idx].data.ipv6))
+                       memcpy(trash.area, argp[idx].data.str.area,
+                              argp[idx].data.str.data);
+                       trash.area[argp[idx].data.str.data] = 0;
+                       if (inet_pton(AF_INET6, trash.area, &argp[idx].data.ipv6))
                                WILL_LJMP(luaL_argerror(L, first + idx, "invalid IPv6 address"));
                        argp[idx].type = ARGT_IPV6;
                        break;
 
                case ARGT_MSK6:
-                       memcpy(trash.str, argp[idx].data.str.str, argp[idx].data.str.len);
-                       trash.str[argp[idx].data.str.len] = 0;
-                       if (!str2mask6(trash.str, &argp[idx].data.ipv6))
+                       memcpy(trash.area, argp[idx].data.str.area,
+                              argp[idx].data.str.data);
+                       trash.area[argp[idx].data.str.data] = 0;
+                       if (!str2mask6(trash.area, &argp[idx].data.ipv6))
                                WILL_LJMP(luaL_argerror(L, first + idx, "invalid IPv6 mask"));
                        argp[idx].type = ARGT_MSK6;
                        break;
@@ -817,9 +825,9 @@ static inline void hlua_sendlog(struct proxy *px, int level, const char *msg)
        char *p;
 
        /* Cleanup the log message. */
-       p = trash.str;
+       p = trash.area;
        for (; *msg != '\0'; msg++, p++) {
-               if (p >= trash.str + trash.size - 1) {
+               if (p >= trash.area + trash.size - 1) {
                        /* Break the message if exceed the buffer size. */
                        *(p-4) = ' ';
                        *(p-3) = '.';
@@ -834,12 +842,12 @@ static inline void hlua_sendlog(struct proxy *px, int level, const char *msg)
        }
        *p = '\0';
 
-       send_log(px, level, "%s\n", trash.str);
+       send_log(px, level, "%s\n", trash.area);
        if (!(global.mode & MODE_QUIET) || (global.mode & (MODE_VERBOSE | MODE_STARTING))) {
                get_localtime(date.tv_sec, &tm);
                fprintf(stderr, "[%s] %03d/%02d%02d%02d (%d) : %s\n",
                        log_levels[level], tm.tm_yday, tm.tm_hour, tm.tm_min, tm.tm_sec,
-                       (int)getpid(), trash.str);
+                       (int)getpid(), trash.area);
                fflush(stderr);
        }
 }
@@ -1479,7 +1487,7 @@ __LJMP static int hlua_map_new(struct lua_State *L)
 
        /* fill fake args. */
        args[0].type = ARGT_STR;
-       args[0].data.str.str = (char *)fn;
+       args[0].data.str.area = (char *)fn;
        args[1].type = ARGT_STOP;
 
        /* load the map. */
@@ -1522,7 +1530,7 @@ __LJMP static inline int _hlua_map_lookup(struct lua_State *L, int str)
        else {
                smp.data.type = SMP_T_STR;
                smp.flags = SMP_F_CONST;
-               smp.data.u.str.str = (char *)MAY_LJMP(luaL_checklstring(L, 2, (size_t *)&smp.data.u.str.len));
+               smp.data.u.str.area = (char *)MAY_LJMP(luaL_checklstring(L, 2, (size_t *)&smp.data.u.str.data));
        }
 
        pat = pattern_exec_match(&desc->pat, &smp, 1);
@@ -1535,7 +1543,7 @@ __LJMP static inline int _hlua_map_lookup(struct lua_State *L, int str)
        }
 
        /* The Lua pattern must return a string, so we can't check the returned type */
-       lua_pushlstring(L, pat->data->u.str.str, pat->data->u.str.len);
+       lua_pushlstring(L, pat->data->u.str.area, pat->data->u.str.data);
        return 1;
 }
 
@@ -3041,7 +3049,7 @@ __LJMP static int hlua_channel_send_yield(lua_State *L, int status, lua_KContext
         * detects a non contiguous buffer and realign it.
         */
        if (ci_space_for_replace(chn) < max)
-               channel_slow_realign(chn, trash.str);
+               channel_slow_realign(chn, trash.area);
 
        /* Copy input data in the buffer. */
        max = b_rep_blk(&chn->buf, ci_head(chn), ci_head(chn), str + l, max);
@@ -3279,7 +3287,7 @@ __LJMP static int hlua_run_sample_fetch(lua_State *L)
                hlua_lua2arg(L, i + 2, &args[i]);
        }
        args[i].type = ARGT_STOP;
-       args[i].data.str.str = NULL;
+       args[i].data.str.area = NULL;
 
        /* Check arguments. */
        MAY_LJMP(hlua_lua2arg_check(L, 2, args, f->arg_mask, hsmp->p));
@@ -3385,7 +3393,7 @@ __LJMP static int hlua_run_sample_conv(lua_State *L)
                hlua_lua2arg(L, i + 3, &args[i]);
        }
        args[i].type = ARGT_STOP;
-       args[i].data.str.str = NULL;
+       args[i].data.str.area = NULL;
 
        /* Check arguments. */
        MAY_LJMP(hlua_lua2arg_check(L, 3, args, conv->arg_mask, hsmp->p));
@@ -4533,16 +4541,17 @@ __LJMP static int hlua_applet_http_start_response(lua_State *L)
                        value = lua_tolstring(L, -1, &value_len);
 
                        /* Catenate a new header. */
-                       if (tmp->len + name_len + 2 + value_len + 2 < tmp->size) {
-                               memcpy(tmp->str + tmp->len, name, name_len);
-                               tmp->len += name_len;
-                               tmp->str[tmp->len++] = ':';
-                               tmp->str[tmp->len++] = ' ';
-
-                               memcpy(tmp->str + tmp->len, value, value_len);
-                               tmp->len += value_len;
-                               tmp->str[tmp->len++] = '\r';
-                               tmp->str[tmp->len++] = '\n';
+                       if (tmp->data + name_len + 2 + value_len + 2 < tmp->size) {
+                               memcpy(tmp->area + tmp->data, name, name_len);
+                               tmp->data += name_len;
+                               tmp->area[tmp->data++] = ':';
+                               tmp->area[tmp->data++] = ' ';
+
+                               memcpy(tmp->area + tmp->data, value,
+                                      value_len);
+                               tmp->data += value_len;
+                               tmp->area[tmp->data++] = '\r';
+                               tmp->area[tmp->data++] = '\n';
                        }
 
                        /* Protocol checks. */
@@ -4591,7 +4600,7 @@ __LJMP static int hlua_applet_http_start_response(lua_State *L)
        lua_pop(L, 2);
 
        /* Push the headers block. */
-       lua_pushlstring(L, tmp->str, tmp->len);
+       lua_pushlstring(L, tmp->area, tmp->data);
 
        return MAY_LJMP(hlua_applet_http_start_response_yield(L, 0, 0));
 }
@@ -4705,7 +4714,7 @@ __LJMP static int hlua_http_get_headers(lua_State *L, struct hlua_txn *htxn, str
                 * the size of one buffer and the input data contains in one
                 * buffer.
                 */
-               out = trash.str;
+               out = trash.area;
                for (in=hn; in<hn+hnl; in++, out++)
                        *out = tolower(*in);
                *out = '\0';
@@ -4715,7 +4724,7 @@ __LJMP static int hlua_http_get_headers(lua_State *L, struct hlua_txn *htxn, str
                 * push the key in the stack, the function lua_gettable()
                 * perform the lookup.
                 */
-               lua_pushlstring(L, trash.str, hnl);
+               lua_pushlstring(L, trash.area, hnl);
                lua_gettable(L, -2);
                type = lua_type(L, -1);
 
@@ -4723,7 +4732,7 @@ __LJMP static int hlua_http_get_headers(lua_State *L, struct hlua_txn *htxn, str
                case LUA_TNIL:
                        /* Table not found, create it. */
                        lua_pop(L, 1); /* remove the nil value. */
-                       lua_pushlstring(L, trash.str, hnl);  /* push the header name as key. */
+                       lua_pushlstring(L, trash.area, hnl);  /* push the header name as key. */
                        lua_newtable(L); /* create and push empty table. */
                        lua_pushlstring(L, hv, hvl); /* push header value. */
                        lua_rawseti(L, -2, 0); /* index header value (pop it). */
@@ -4889,12 +4898,12 @@ __LJMP static inline int hlua_http_add_hdr(lua_State *L, struct hlua_txn *htxn,
                return 0;
 
        /* Check length. */
-       trash.len = value_len + name_len + 2;
-       if (trash.len > trash.size)
+       trash.data = value_len + name_len + 2;
+       if (trash.data > trash.size)
                return 0;
 
        /* Creates the header string. */
-       p = trash.str;
+       p = trash.area;
        memcpy(p, name, name_len);
        p += name_len;
        *p = ':';
@@ -4904,7 +4913,7 @@ __LJMP static inline int hlua_http_add_hdr(lua_State *L, struct hlua_txn *htxn,
        memcpy(p, value, value_len);
 
        lua_pushboolean(L, http_header_add_tail2(msg, &htxn->s->txn->hdr_idx,
-                                                trash.str, trash.len) != 0);
+                                                trash.area, trash.data) != 0);
 
        return 0;
 }
@@ -5006,11 +5015,12 @@ static int hlua_http_req_set_query(lua_State *L)
 
        /* Add the mark question as prefix. */
        chunk_reset(&trash);
-       trash.str[trash.len++] = '?';
-       memcpy(trash.str + trash.len, name, name_len);
-       trash.len += name_len;
+       trash.area[trash.data++] = '?';
+       memcpy(trash.area + trash.data, name, name_len);
+       trash.data += name_len;
 
-       lua_pushboolean(L, http_replace_req_line(2, trash.str, trash.len, htxn->p, htxn->s) != -1);
+       lua_pushboolean(L,
+                       http_replace_req_line(2, trash.area, trash.data, htxn->p, htxn->s) != -1);
        return 1;
 }
 
@@ -5837,7 +5847,7 @@ static int hlua_sample_fetch_wrapper(const struct arg *arg_p, struct sample *smp
        struct hlua_function *fcn = private;
        struct stream *stream = smp->strm;
        const char *error;
-       const struct chunk msg = { .len = 0 };
+       const struct chunk msg = { };
 
        if (!stream)
                return 0;
@@ -6106,7 +6116,7 @@ static enum act_return hlua_action(struct act_rule *rule, struct proxy *px,
        unsigned int analyzer;
        int dir;
        const char *error;
-       const struct chunk msg = { .len = 0 };
+       const struct chunk msg = { };
 
        switch (rule->from) {
        case ACT_F_TCP_REQ_CNT: analyzer = AN_REQ_INSPECT_FE     ; dir = SMP_OPT_DIR_REQ; break;
@@ -7654,8 +7664,8 @@ void hlua_init(void)
        for (i=0; i<PAT_MATCH_NUM; i++)
                hlua_class_const_int(gL.T, pat_match_names[i], i);
        for (i=0; i<PAT_MATCH_NUM; i++) {
-               snprintf(trash.str, trash.size, "_%s", pat_match_names[i]);
-               hlua_class_const_int(gL.T, trash.str, i);
+               snprintf(trash.area, trash.size, "_%s", pat_match_names[i]);
+               hlua_class_const_int(gL.T, trash.area, i);
        }
 
        /* register constructor. */
@@ -7747,14 +7757,14 @@ void hlua_init(void)
                /* gL.Tua doesn't support '.' and '-' in the function names, replace it
                 * by an underscore.
                 */
-               strncpy(trash.str, sf->kw, trash.size);
-               trash.str[trash.size - 1] = '\0';
-               for (p = trash.str; *p; p++)
+               strncpy(trash.area, sf->kw, trash.size);
+               trash.area[trash.size - 1] = '\0';
+               for (p = trash.area; *p; p++)
                        if (*p == '.' || *p == '-' || *p == '+')
                                *p = '_';
 
                /* Register the function. */
-               lua_pushstring(gL.T, trash.str);
+               lua_pushstring(gL.T, trash.area);
                lua_pushlightuserdata(gL.T, sf);
                lua_pushcclosure(gL.T, hlua_run_sample_fetch, 1);
                lua_rawset(gL.T, -3);
@@ -7792,14 +7802,14 @@ void hlua_init(void)
                /* gL.Tua doesn't support '.' and '-' in the function names, replace it
                 * by an underscore.
                 */
-               strncpy(trash.str, sc->kw, trash.size);
-               trash.str[trash.size - 1] = '\0';
-               for (p = trash.str; *p; p++)
+               strncpy(trash.area, sc->kw, trash.size);
+               trash.area[trash.size - 1] = '\0';
+               for (p = trash.area; *p; p++)
                        if (*p == '.' || *p == '-' || *p == '+')
                                *p = '_';
 
                /* Register the function. */
-               lua_pushstring(gL.T, trash.str);
+               lua_pushstring(gL.T, trash.area);
                lua_pushlightuserdata(gL.T, sc);
                lua_pushcclosure(gL.T, hlua_run_sample_conv, 1);
                lua_rawset(gL.T, -3);
index 83153c5cdb78eebb81b4a22c626287d3f854e981..bc32401e77be6436439bd3fc919c1b9fb1c80c1c 100644 (file)
@@ -1204,9 +1204,9 @@ static int hlua_regex_exec(struct lua_State *L)
                lua_pushboolean(L, 0);
                return 1;
        }
-       memcpy(tmp->str, str, len);
+       memcpy(tmp->area, str, len);
 
-       lua_pushboolean(L, regex_exec2(regex, tmp->str, len));
+       lua_pushboolean(L, regex_exec2(regex, tmp->area, len));
 
        return 1;
 }
@@ -1232,9 +1232,9 @@ static int hlua_regex_match(struct lua_State *L)
                lua_pushboolean(L, 0);
                return 1;
        }
-       memcpy(tmp->str, str, len);
+       memcpy(tmp->area, str, len);
 
-       ret = regex_exec_match2(regex, tmp->str, len, 20, pmatch, 0);
+       ret = regex_exec_match2(regex, tmp->area, len, 20, pmatch, 0);
        lua_pushboolean(L, ret);
        lua_newtable(L);
        if (ret) {
index 7c3605b684b6ebe4297d86409d1c55391d4436c0..7c4147be0a4c729cfc47b237614965cb32a1ec36 100644 (file)
@@ -126,12 +126,12 @@ static inline struct ist hpack_alloc_string(struct chunk *store, int idx, struct
        if (unlikely(!out.ptr))
                return out;
 
-       if (unlikely(store->len + out.len > store->size)) {
+       if (unlikely(store->data + out.len > store->size)) {
                out.ptr = NULL;
                return out;
        }
 
-       store->len += out.len;
+       store->data += out.len;
        memcpy(out.ptr, in.ptr, out.len);
        return out;
 }
@@ -277,7 +277,8 @@ int hpack_decode_frame(struct hpack_dht *dht, const uint8_t *raw, uint32_t len,
                                        goto leave;
                                }
 
-                               nlen = huff_dec((const uint8_t *)name.ptr, name.len, ntrash, tmp->size - tmp->len);
+                               nlen = huff_dec((const uint8_t *)name.ptr, name.len, ntrash,
+                                               tmp->size - tmp->data);
                                if (nlen == (uint32_t)-1) {
                                        hpack_debug_printf("2: can't decode huffman.\n");
                                        ret = -HPACK_ERR_HUFFMAN;
@@ -285,7 +286,7 @@ int hpack_decode_frame(struct hpack_dht *dht, const uint8_t *raw, uint32_t len,
                                }
                                hpack_debug_printf(" [name huff %d->%d] ", (int)name.len, (int)nlen);
 
-                               tmp->len += nlen; // make room for the value
+                               tmp->data += nlen; // make room for the value
                                name = ist2(ntrash, nlen);
                        }
 
@@ -317,7 +318,8 @@ int hpack_decode_frame(struct hpack_dht *dht, const uint8_t *raw, uint32_t len,
                                        goto leave;
                                }
 
-                               vlen = huff_dec((const uint8_t *)value.ptr, value.len, vtrash, tmp->size - tmp->len);
+                               vlen = huff_dec((const uint8_t *)value.ptr, value.len, vtrash,
+                                               tmp->size - tmp->data);
                                if (vlen == (uint32_t)-1) {
                                        hpack_debug_printf("3: can't decode huffman.\n");
                                        ret = -HPACK_ERR_HUFFMAN;
@@ -325,7 +327,7 @@ int hpack_decode_frame(struct hpack_dht *dht, const uint8_t *raw, uint32_t len,
                                }
                                hpack_debug_printf(" [value huff %d->%d] ", (int)value.len, (int)vlen);
 
-                               tmp->len += vlen; // make room for the value
+                               tmp->data += vlen; // make room for the value
                                value = ist2(vtrash, vlen);
                        }
 
@@ -386,15 +388,17 @@ int hpack_decode_frame(struct hpack_dht *dht, const uint8_t *raw, uint32_t len,
                                        goto leave;
                                }
 
-                               vlen = huff_dec((const uint8_t *)value.ptr, value.len, vtrash, tmp->size - tmp->len);
+                               vlen = huff_dec((const uint8_t *)value.ptr, value.len, vtrash,
+                                               tmp->size - tmp->data);
                                if (vlen == (uint32_t)-1) {
                                        hpack_debug_printf("##ERR@%d## can't decode huffman : ilen=%d osize=%d\n",
-                                                          __LINE__, (int)value.len, (int)(tmp->size - tmp->len));
+                                                          __LINE__, (int)value.len,
+                                                          (int)(tmp->size - tmp->data));
                                        hpack_debug_hexdump(stderr, "[HUFFMAN] ", value.ptr, 0, value.len);
                                        ret = -HPACK_ERR_HUFFMAN;
                                        goto leave;
                                }
-                               tmp->len += vlen; // make room for the value
+                               tmp->data += vlen; // make room for the value
                                value = ist2(vtrash, vlen);
                        }
 
@@ -436,10 +440,11 @@ int hpack_decode_frame(struct hpack_dht *dht, const uint8_t *raw, uint32_t len,
                }
 
                hpack_debug_printf("\e[1;34m%s\e[0m: ",
-                                  name.ptr ? istpad(trash.str, name).ptr : h2_phdr_to_str(name.len));
+                                  name.ptr ? istpad(trash.area, name).ptr : h2_phdr_to_str(name.len));
 
                hpack_debug_printf("\e[1;35m%s\e[0m [mustidx=%d, used=%d] [n=(%p,%d) v=(%p,%d)]\n",
-                                  istpad(trash.str, value).ptr, must_index, dht->used,
+                                  istpad(trash.area, value).ptr, must_index,
+                                  dht->used,
                                   name.ptr, (int)name.len, value.ptr, (int)value.len);
        }
 
index d1f68c582937157339acadc243597635e88ea3ed..c6bfce7640ccf98812a3bd86776c6658129e31a3 100644 (file)
@@ -78,7 +78,7 @@ static inline int hpack_encode_len(char *out, int pos, int len)
  */
 int hpack_encode_header(struct chunk *out, const struct ist n, const struct ist v)
 {
-       int len = out->len;
+       int len = out->data;
        int size = out->size;
 
        if (len >= size)
@@ -89,28 +89,28 @@ int hpack_encode_header(struct chunk *out, const struct ist n, const struct ist
         * compiler factor out the common sizes.
         */
        if (isteq(n, ist("date")))
-               out->str[len++] = 0x61; // literal with indexing -- name="date" (idx 33)
+               out->area[len++] = 0x61; // literal with indexing -- name="date" (idx 33)
        else if (isteq(n, ist("etag")))
-               out->str[len++] = 0x62; // literal with indexing -- name="etag" (idx 34)
+               out->area[len++] = 0x62; // literal with indexing -- name="etag" (idx 34)
        else if (isteq(n, ist("server")))
-               out->str[len++] = 0x76; // literal with indexing -- name="server" (idx 54)
+               out->area[len++] = 0x76; // literal with indexing -- name="server" (idx 54)
        else if (isteq(n, ist("location")))
-               out->str[len++] = 0x6e; // literal with indexing -- name="location" (idx 46)
+               out->area[len++] = 0x6e; // literal with indexing -- name="location" (idx 46)
        else if (isteq(n, ist("content-type")))
-               out->str[len++] = 0x5f; // literal with indexing -- name="content-type" (idx 31)
+               out->area[len++] = 0x5f; // literal with indexing -- name="content-type" (idx 31)
        else if (isteq(n, ist("last-modified")))
-               out->str[len++] = 0x6c; // literal with indexing -- name="last-modified" (idx 44)
+               out->area[len++] = 0x6c; // literal with indexing -- name="last-modified" (idx 44)
        else if (isteq(n, ist("accept-ranges")))
-               out->str[len++] = 0x51; // literal with indexing -- name="accept-ranges" (idx 17)
+               out->area[len++] = 0x51; // literal with indexing -- name="accept-ranges" (idx 17)
        else if (isteq(n, ist("cache-control")))
-               out->str[len++] = 0x58; // literal with indexing -- name="cache-control" (idx 24)
+               out->area[len++] = 0x58; // literal with indexing -- name="cache-control" (idx 24)
        else if (isteq(n, ist("content-length")))
-               out->str[len++] = 0x5c; // literal with indexing -- name="content-length" (idx 28)
+               out->area[len++] = 0x5c; // literal with indexing -- name="content-length" (idx 28)
        else if (len_to_bytes(n.len) && len + len_to_bytes(n.len) + n.len <= size) {
-               out->str[len++] = 0x00;      /* literal without indexing -- new name */
+               out->area[len++] = 0x00;      /* literal without indexing -- new name */
 
-               len = hpack_encode_len(out->str, len, n.len);
-               memcpy(out->str + len, n.ptr, n.len);
+               len = hpack_encode_len(out->area, len, n.len);
+               memcpy(out->area + len, n.ptr, n.len);
                len += n.len;
        }
        else {
@@ -124,10 +124,10 @@ int hpack_encode_header(struct chunk *out, const struct ist n, const struct ist
                return 0;
        }
 
-       len = hpack_encode_len(out->str, len, v.len);
-       memcpy(out->str + len, v.ptr, v.len);
+       len = hpack_encode_len(out->area, len, v.len);
+       memcpy(out->area + len, v.ptr, v.len);
        len += v.len;
 
-       out->len = len;
+       out->data = len;
        return 1;
 }
index b2d4367f4d00a2bed07b2a30d8c6c62b144b1155..899266c2f414479bc919b4599d5d690e88c3e458 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -57,15 +57,15 @@ static const struct log_fmt log_formats[LOG_FORMATS] = {
        [LOG_FORMAT_RFC3164] = {
                .name = "rfc3164",
                .pid = {
-                       .sep1 = { .str = "[",   .len = 1 },
-                       .sep2 = { .str = "]: ", .len = 3 }
+                       .sep1 = { .area = "[",   .data = 1 },
+                       .sep2 = { .area = "]: ", .data = 3 }
                }
        },
        [LOG_FORMAT_RFC5424] = {
                .name = "rfc5424",
                .pid = {
-                       .sep1 = { .str = " ",   .len = 1 },
-                       .sep2 = { .str = " - ", .len = 3 }
+                       .sep1 = { .area = " ",   .data = 1 },
+                       .sep2 = { .area = " - ", .data = 3 }
                }
        }
 };
@@ -1013,8 +1013,8 @@ static char *lf_encode_chunk(char *start, char *stop,
 
        if (node->options & LOG_OPT_ESC) {
                if (start < stop) {
-                       str = chunk->str;
-                       end = chunk->str + chunk->len;
+                       str = chunk->area;
+                       end = chunk->area + chunk->data;
 
                        stop--; /* reserve one byte for the final '\0' */
                        while (start < stop && str < end) {
@@ -1158,7 +1158,7 @@ static char *update_log_hdr(const time_t time)
 {
        static THREAD_LOCAL long tvsec;
        static THREAD_LOCAL char *dataptr = NULL; /* backup of last end of header, NULL first time */
-       static THREAD_LOCAL struct chunk host = { NULL, 0, 0 };
+       static THREAD_LOCAL struct chunk host = { };
        static THREAD_LOCAL int sep = 0;
 
        if (unlikely(time != tvsec || dataptr == NULL)) {
@@ -1169,17 +1169,17 @@ static char *update_log_hdr(const time_t time)
                tvsec = time;
                get_localtime(tvsec, &tm);
 
-               if (unlikely(global.log_send_hostname != host.str)) {
-                       host.str = global.log_send_hostname;
-                       host.len = host.str ? strlen(host.str) : 0;
-                       sep = host.len ? 1 : 0;
+               if (unlikely(global.log_send_hostname != host.area)) {
+                       host.area = global.log_send_hostname;
+                       host.data = host.area ? strlen(host.area) : 0;
+                       sep = host.data ? 1 : 0;
                }
 
                hdr_len = snprintf(logheader, global.max_syslog_len,
                                   "<<<<>%s %2d %02d:%02d:%02d %.*s%*s",
                                   monthname[tm.tm_mon],
                                   tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,
-                                  host.len, host.str, sep, "");
+                                  (int)host.data, host.area, sep, "");
                /* WARNING: depending upon implementations, snprintf may return
                 * either -1 or the number of bytes that would be needed to store
                 * the total message. In both cases, we must adjust it.
@@ -1297,7 +1297,7 @@ void __send_log(struct proxy *p, int level, char *message, size_t size, char *sd
                if (!LIST_ISEMPTY(&p->logsrvs)) {
                        logsrvs = &p->logsrvs;
                }
-               if (p->log_tag.str) {
+               if (p->log_tag.area) {
                        tag = &p->log_tag;
                }
        }
@@ -1401,7 +1401,7 @@ void __send_log(struct proxy *p, int level, char *message, size_t size, char *sd
                maxlen = logsrv->maxlen - hdr_max;
 
                /* tag */
-               tag_max = tag->len;
+               tag_max = tag->data;
                if (unlikely(tag_max >= maxlen)) {
                        tag_max = maxlen - 1;
                        sd_max = 0;
@@ -1411,18 +1411,18 @@ void __send_log(struct proxy *p, int level, char *message, size_t size, char *sd
                maxlen -= tag_max;
 
                /* first pid separator */
-               pid_sep1_max = log_formats[logsrv->format].pid.sep1.len;
+               pid_sep1_max = log_formats[logsrv->format].pid.sep1.data;
                if (unlikely(pid_sep1_max >= maxlen)) {
                        pid_sep1_max = maxlen - 1;
                        sd_max = 0;
                        goto send;
                }
 
-               pid_sep1 = log_formats[logsrv->format].pid.sep1.str;
+               pid_sep1 = log_formats[logsrv->format].pid.sep1.area;
                maxlen -= pid_sep1_max;
 
                /* pid */
-               pid_max = pid.len;
+               pid_max = pid.data;
                if (unlikely(pid_max >= maxlen)) {
                        pid_max = maxlen - 1;
                        sd_max = 0;
@@ -1432,14 +1432,14 @@ void __send_log(struct proxy *p, int level, char *message, size_t size, char *sd
                maxlen -= pid_max;
 
                /* second pid separator */
-               pid_sep2_max = log_formats[logsrv->format].pid.sep2.len;
+               pid_sep2_max = log_formats[logsrv->format].pid.sep2.data;
                if (unlikely(pid_sep2_max >= maxlen)) {
                        pid_sep2_max = maxlen - 1;
                        sd_max = 0;
                        goto send;
                }
 
-               pid_sep2 = log_formats[logsrv->format].pid.sep2.str;
+               pid_sep2 = log_formats[logsrv->format].pid.sep2.area;
                maxlen -= pid_sep2_max;
 
                /* structured-data */
@@ -1452,11 +1452,11 @@ void __send_log(struct proxy *p, int level, char *message, size_t size, char *sd
 send:
                iovec[0].iov_base = hdr_ptr;
                iovec[0].iov_len  = hdr_max;
-               iovec[1].iov_base = tag->str;
+               iovec[1].iov_base = tag->area;
                iovec[1].iov_len  = tag_max;
                iovec[2].iov_base = pid_sep1;
                iovec[2].iov_len  = pid_sep1_max;
-               iovec[3].iov_base = pid.str;
+               iovec[3].iov_base = pid.area;
                iovec[3].iov_len  = pid_max;
                iovec[4].iov_base = pid_sep2;
                iovec[4].iov_len  = pid_sep2_max;
@@ -1606,7 +1606,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
                struct connection *conn;
                const char *src = NULL;
                struct sample *key;
-               const struct chunk empty = { NULL, 0, 0 };
+               const struct chunk empty = { };
 
                switch (tmp->type) {
                        case LOG_FMT_SEPARATOR:
@@ -1635,7 +1635,11 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
                                        ret = lf_encode_chunk(tmplog, dst + maxsize,
                                                              '%', http_encode_map, key ? &key->data.u.str : &empty, tmp);
                                else
-                                       ret = lf_text_len(tmplog, key ? key->data.u.str.str : NULL, key ? key->data.u.str.len : 0, dst + maxsize - tmplog, tmp);
+                                       ret = lf_text_len(tmplog,
+                                                         key ? key->data.u.str.area : NULL,
+                                                         key ? key->data.u.str.data : 0,
+                                                         dst + maxsize - tmplog,
+                                                         tmp);
                                if (ret == 0)
                                        goto out;
                                tmplog = ret;
@@ -2278,11 +2282,11 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
                                        spc++;
 
                                if (!txn || !txn->uri || nspaces == 0) {
-                                       chunk.str = "<BADREQ>";
-                                       chunk.len = strlen("<BADREQ>");
+                                       chunk.area = "<BADREQ>";
+                                       chunk.data = strlen("<BADREQ>");
                                } else {
-                                       chunk.str = uri;
-                                       chunk.len = spc - uri;
+                                       chunk.area = uri;
+                                       chunk.data = spc - uri;
                                }
 
                                ret = lf_encode_chunk(tmplog, dst + maxsize, '#', url_encode_map, &chunk, tmp);
@@ -2301,8 +2305,8 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
                                        LOGCHAR('"');
 
                                if (!txn || !txn->uri) {
-                                       chunk.str = "<BADREQ>";
-                                       chunk.len = strlen("<BADREQ>");
+                                       chunk.area = "<BADREQ>";
+                                       chunk.data = strlen("<BADREQ>");
                                } else {
                                        uri = txn->uri;
                                        end = uri + strlen(uri);
@@ -2315,8 +2319,8 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
                                        while (uri < end && !HTTP_IS_SPHT(*uri))
                                                uri++;
 
-                                       chunk.str = qmark;
-                                       chunk.len = uri - qmark;
+                                       chunk.area = qmark;
+                                       chunk.data = uri - qmark;
                                }
 
                                ret = lf_encode_chunk(tmplog, dst + maxsize, '#', url_encode_map, &chunk, tmp);
@@ -2352,11 +2356,11 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
                                        spc++;
 
                                if (!txn || !txn->uri || nspaces == 0) {
-                                       chunk.str = "<BADREQ>";
-                                       chunk.len = strlen("<BADREQ>");
+                                       chunk.area = "<BADREQ>";
+                                       chunk.data = strlen("<BADREQ>");
                                } else {
-                                       chunk.str = uri;
-                                       chunk.len = spc - uri;
+                                       chunk.area = uri;
+                                       chunk.data = spc - uri;
                                }
 
                                ret = lf_encode_chunk(tmplog, dst + maxsize, '#', url_encode_map, &chunk, tmp);
@@ -2382,11 +2386,11 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
                                        spc++;
 
                                if (spc == end) { // odd case, we have txn->uri, but we only got a verb
-                                       chunk.str = "<BADREQ>";
-                                       chunk.len = strlen("<BADREQ>");
+                                       chunk.area = "<BADREQ>";
+                                       chunk.data = strlen("<BADREQ>");
                                } else {
-                                       chunk.str = uri;
-                                       chunk.len = spc - uri;
+                                       chunk.area = uri;
+                                       chunk.data = spc - uri;
                                }
 
                                ret = lf_encode_chunk(tmplog, dst + maxsize, '#', url_encode_map, &chunk, tmp);
@@ -2424,14 +2428,14 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
                                        uri++;
 
                                if (!txn || !txn->uri || nspaces == 0) {
-                                       chunk.str = "<BADREQ>";
-                                       chunk.len = strlen("<BADREQ>");
+                                       chunk.area = "<BADREQ>";
+                                       chunk.data = strlen("<BADREQ>");
                                } else if (uri == end) {
-                                       chunk.str = "HTTP/0.9";
-                                       chunk.len = strlen("HTTP/0.9");
+                                       chunk.area = "HTTP/0.9";
+                                       chunk.data = strlen("HTTP/0.9");
                                } else {
-                                       chunk.str = uri;
-                                       chunk.len = end - uri;
+                                       chunk.area = uri;
+                                       chunk.data = end - uri;
                                }
 
                                ret = lf_encode_chunk(tmplog, dst + maxsize, '#', url_encode_map, &chunk, tmp);
index 0f1b75476024bbbc15e3ab1dd757f7afd7bfde81..64f2388d552186fffccaab1687e15920dace4c2c 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -57,9 +57,9 @@ int map_parse_ip(const char *text, struct sample_data *data)
  */
 int map_parse_str(const char *text, struct sample_data *data)
 {
-       data->u.str.str = (char *)text;
-       data->u.str.len = strlen(text);
-       data->u.str.size = data->u.str.len + 1;
+       data->u.str.area = (char *)text;
+       data->u.str.data = strlen(text);
+       data->u.str.size = data->u.str.data + 1;
        data->type = SMP_T_STR;
        return 1;
 }
@@ -138,7 +138,7 @@ int sample_load_map(struct arg *arg, struct sample_conv *conv,
        }
 
        /* Load map. */
-       if (!pattern_read_from_file(&desc->pat, PAT_REF_MAP, arg[0].data.str.str, PAT_MF_NO_DNS,
+       if (!pattern_read_from_file(&desc->pat, PAT_REF_MAP, arg[0].data.str.area, PAT_MF_NO_DNS,
                                    1, err, file, line))
                return 0;
 
@@ -147,8 +147,9 @@ int sample_load_map(struct arg *arg, struct sample_conv *conv,
         */
        if (desc->conv->out_type == SMP_T_ADDR) {
                struct sample_data data;
-               if (!map_parse_ip(arg[1].data.str.str, &data)) {
-                       memprintf(err, "map: cannot parse default ip <%s>.", arg[1].data.str.str);
+               if (!map_parse_ip(arg[1].data.str.area, &data)) {
+                       memprintf(err, "map: cannot parse default ip <%s>.",
+                                 arg[1].data.str.area);
                        return 0;
                }
                if (data.type == SMP_T_IPV4) {
@@ -185,10 +186,11 @@ static int sample_conv_map(const struct arg *arg_p, struct sample *smp, void *pr
                        /* In the regm case, merge the sample with the input. */
                        if ((long)private == PAT_MATCH_REGM) {
                                str = get_trash_chunk();
-                               str->len = exp_replace(str->str, str->size, smp->data.u.str.str,
-                                                      pat->data->u.str.str,
+                               str->data = exp_replace(str->area, str->size,
+                                                      smp->data.u.str.area,
+                                                      pat->data->u.str.area,
                                                       (regmatch_t *)smp->ctx.a[0]);
-                               if (str->len == -1)
+                               if (str->data == -1)
                                        return 0;
                                smp->data.u.str = *str;
                                return 1;
@@ -463,8 +465,8 @@ static int cli_io_handler_map_lookup(struct appctx *appctx)
                        /* execute pattern matching */
                        sample.data.type = SMP_T_STR;
                        sample.flags = SMP_F_CONST;
-                       sample.data.u.str.len = appctx->ctx.map.chunk.len;
-                       sample.data.u.str.str = appctx->ctx.map.chunk.str;
+                       sample.data.u.str.data = appctx->ctx.map.chunk.data;
+                       sample.data.u.str.area = appctx->ctx.map.chunk.area;
 
                        if (appctx->ctx.map.expr->pat_head->match &&
                            sample_convert(&sample, appctx->ctx.map.expr->pat_head->expect_type))
@@ -560,8 +562,8 @@ static int cli_io_handler_map_lookup(struct appctx *appctx)
 
 static void cli_release_mlook(struct appctx *appctx)
 {
-       free(appctx->ctx.map.chunk.str);
-       appctx->ctx.map.chunk.str = NULL;
+       free(appctx->ctx.map.chunk.area);
+       appctx->ctx.map.chunk.area = NULL;
 }
 
 
@@ -607,10 +609,10 @@ static int cli_parse_get_map(char **args, char *payload, struct appctx *appctx,
                 * it may be used over multiple iterations. It's released
                 * at the end and upon abort anyway.
                 */
-               appctx->ctx.map.chunk.len = strlen(args[3]);
-               appctx->ctx.map.chunk.size = appctx->ctx.map.chunk.len + 1;
-               appctx->ctx.map.chunk.str = strdup(args[3]);
-               if (!appctx->ctx.map.chunk.str) {
+               appctx->ctx.map.chunk.data = strlen(args[3]);
+               appctx->ctx.map.chunk.size = appctx->ctx.map.chunk.data + 1;
+               appctx->ctx.map.chunk.area = strdup(args[3]);
+               if (!appctx->ctx.map.chunk.area) {
                        appctx->ctx.cli.severity = LOG_ERR;
                        appctx->ctx.cli.msg = "Out of memory error.\n";
                        appctx->st0 = CLI_ST_PRINT;
index 2d1a5e73166a0d3147552d6add04500f9167858d..9feadd1705602beffe3bc39edfb8f1c325e37e77 100644 (file)
@@ -394,7 +394,7 @@ void dump_pools_to_trash()
 void dump_pools(void)
 {
        dump_pools_to_trash();
-       qfprintf(stderr, "%s", trash.str);
+       qfprintf(stderr, "%s", trash.area);
 }
 
 /* This function returns the total number of failed pool allocations */
index 35c78654f2132ec7674e98ff816d5fbb4f1f67c9..92f5090193077ec269a99830a057cd2d3ce05e5f 100644 (file)
@@ -727,8 +727,8 @@ static int h2c_snd_settings(struct h2c *h2c)
                chunk_memcat(&buf, str, 6);
        }
 
-       h2_set_frame_size(buf.str, buf.len - 9);
-       ret = b_istput(res, ist2(buf.str, buf.len));
+       h2_set_frame_size(buf.area, buf.data - 9);
+       ret = b_istput(res, ist2(buf.area, buf.data));
        if (unlikely(ret <= 0)) {
                if (!ret) {
                        h2c->flags |= H2_CF_MUX_MFULL;
@@ -2643,9 +2643,9 @@ static int h2_frt_decode_headers(struct h2s *h2s, struct buffer *buf, int count,
                        h2c_error(h2c, H2_ERR_INTERNAL_ERROR);
                        goto fail;
                }
-               memcpy(copy->str, b_head(&h2c->dbuf), wrap);
-               memcpy(copy->str + wrap, b_orig(&h2c->dbuf), h2c->dfl - wrap);
-               hdrs = (uint8_t *)copy->str;
+               memcpy(copy->area, b_head(&h2c->dbuf), wrap);
+               memcpy(copy->area + wrap, b_orig(&h2c->dbuf), h2c->dfl - wrap);
+               hdrs = (uint8_t *) copy->area;
        }
 
        /* The padlen is the first byte before data, and the padding appears
@@ -2699,7 +2699,7 @@ static int h2_frt_decode_headers(struct h2s *h2s, struct buffer *buf, int count,
                /* it doesn't fit and the buffer is fragmented,
                 * so let's defragment it and try again.
                 */
-               b_slow_realign(buf, trash.str, 0);
+               b_slow_realign(buf, trash.area, 0);
        }
 
        try = b_contig_space(buf);
@@ -2994,14 +2994,14 @@ static size_t h2s_frt_make_resp_headers(struct h2s *h2s, const struct buffer *bu
        chunk_reset(&outbuf);
 
        while (1) {
-               outbuf.str  = b_tail(&h2c->mbuf);
+               outbuf.area  = b_tail(&h2c->mbuf);
                outbuf.size = b_contig_space(&h2c->mbuf);
-               outbuf.len = 0;
+               outbuf.data = 0;
 
                if (outbuf.size >= 9 || !b_space_wraps(&h2c->mbuf))
                        break;
        realign_again:
-               b_slow_realign(&h2c->mbuf, trash.str, b_data(&h2c->mbuf));
+               b_slow_realign(&h2c->mbuf, trash.area, b_data(&h2c->mbuf));
        }
 
        if (outbuf.size < 9) {
@@ -3012,28 +3012,28 @@ static size_t h2s_frt_make_resp_headers(struct h2s *h2s, const struct buffer *bu
        }
 
        /* len: 0x000000 (fill later), type: 1(HEADERS), flags: ENDH=4 */
-       memcpy(outbuf.str, "\x00\x00\x00\x01\x04", 5);
-       write_n32(outbuf.str + 5, h2s->id); // 4 bytes
-       outbuf.len = 9;
+       memcpy(outbuf.area, "\x00\x00\x00\x01\x04", 5);
+       write_n32(outbuf.area + 5, h2s->id); // 4 bytes
+       outbuf.data = 9;
 
        /* encode status, which necessarily is the first one */
-       if (outbuf.len < outbuf.size && h1m->status == 200)
-               outbuf.str[outbuf.len++] = 0x88; // indexed field : idx[08]=(":status", "200")
-       else if (outbuf.len < outbuf.size && h1m->status == 304)
-               outbuf.str[outbuf.len++] = 0x8b; // indexed field : idx[11]=(":status", "304")
+       if (outbuf.data < outbuf.size && h1m->status == 200)
+               outbuf.area[outbuf.data++] = 0x88; // indexed field : idx[08]=(":status", "200")
+       else if (outbuf.data < outbuf.size && h1m->status == 304)
+               outbuf.area[outbuf.data++] = 0x8b; // indexed field : idx[11]=(":status", "304")
        else if (unlikely(list[0].v.len != 3)) {
                /* this is an unparsable response */
                h2s_error(h2s, H2_ERR_INTERNAL_ERROR);
                ret = 0;
                goto end;
        }
-       else if (unlikely(outbuf.len + 2 + 3 <= outbuf.size)) {
+       else if (unlikely(outbuf.data + 2 + 3 <= outbuf.size)) {
                /* basic encoding of the status code */
-               outbuf.str[outbuf.len++] = 0x48; // indexed name -- name=":status" (idx 8)
-               outbuf.str[outbuf.len++] = 0x03; // 3 bytes status
-               outbuf.str[outbuf.len++] = list[0].v.ptr[0];
-               outbuf.str[outbuf.len++] = list[0].v.ptr[1];
-               outbuf.str[outbuf.len++] = list[0].v.ptr[2];
+               outbuf.area[outbuf.data++] = 0x48; // indexed name -- name=":status" (idx 8)
+               outbuf.area[outbuf.data++] = 0x03; // 3 bytes status
+               outbuf.area[outbuf.data++] = list[0].v.ptr[0];
+               outbuf.area[outbuf.data++] = list[0].v.ptr[1];
+               outbuf.area[outbuf.data++] = list[0].v.ptr[2];
        }
        else {
                if (b_space_wraps(&h2c->mbuf))
@@ -3075,16 +3075,16 @@ static size_t h2s_frt_make_resp_headers(struct h2s *h2s, const struct buffer *bu
                es_now = 1;
 
        /* update the frame's size */
-       h2_set_frame_size(outbuf.str, outbuf.len - 9);
+       h2_set_frame_size(outbuf.area, outbuf.data - 9);
 
        if (es_now)
-               outbuf.str[4] |= H2_F_HEADERS_END_STREAM;
+               outbuf.area[4] |= H2_F_HEADERS_END_STREAM;
 
        /* consume incoming H1 response */
        max -= ret;
 
        /* commit the H2 response */
-       b_add(&h2c->mbuf, outbuf.len);
+       b_add(&h2c->mbuf, outbuf.data);
        h2s->flags |= H2_SF_HEADERS_SENT;
 
        /* for now we don't implemented CONTINUATION, so we wait for a
@@ -3151,14 +3151,14 @@ static size_t h2s_frt_make_resp_data(struct h2s *h2s, const struct buffer *buf,
        chunk_reset(&outbuf);
 
        while (1) {
-               outbuf.str  = b_tail(&h2c->mbuf);
+               outbuf.area  = b_tail(&h2c->mbuf);
                outbuf.size = b_contig_space(&h2c->mbuf);
-               outbuf.len = 0;
+               outbuf.data = 0;
 
                if (outbuf.size >= 9 || !b_space_wraps(&h2c->mbuf))
                        break;
        realign_again:
-               b_slow_realign(&h2c->mbuf, trash.str, b_data(&h2c->mbuf));
+               b_slow_realign(&h2c->mbuf, trash.area, b_data(&h2c->mbuf));
        }
 
        if (outbuf.size < 9) {
@@ -3168,9 +3168,9 @@ static size_t h2s_frt_make_resp_data(struct h2s *h2s, const struct buffer *buf,
        }
 
        /* len: 0x000000 (fill later), type: 0(DATA), flags: none=0 */
-       memcpy(outbuf.str, "\x00\x00\x00\x00\x00", 5);
-       write_n32(outbuf.str + 5, h2s->id); // 4 bytes
-       outbuf.len = 9;
+       memcpy(outbuf.area, "\x00\x00\x00\x00\x00", 5);
+       write_n32(outbuf.area + 5, h2s->id); // 4 bytes
+       outbuf.data = 9;
 
        switch (h1m->flags & (H1_MF_CLEN|H1_MF_CHNK)) {
        case 0:           /* no content length, read till SHUTW */
@@ -3301,9 +3301,9 @@ static size_t h2s_frt_make_resp_data(struct h2s *h2s, const struct buffer *buf,
        }
 
        /* now let's copy this this into the output buffer */
-       memcpy(outbuf.str + 9, blk1, len1);
+       memcpy(outbuf.area + 9, blk1, len1);
        if (len2)
-               memcpy(outbuf.str + 9 + len1, blk2, len2);
+               memcpy(outbuf.area + 9 + len1, blk2, len2);
 
  send_empty:
        /* we may need to add END_STREAM */
@@ -3323,10 +3323,10 @@ static size_t h2s_frt_make_resp_data(struct h2s *h2s, const struct buffer *buf,
                es_now = 1;
 
        /* update the frame's size */
-       h2_set_frame_size(outbuf.str, size);
+       h2_set_frame_size(outbuf.area, size);
 
        if (es_now)
-               outbuf.str[4] |= H2_F_DATA_END_STREAM;
+               outbuf.area[4] |= H2_F_DATA_END_STREAM;
 
        /* commit the H2 response */
        b_add(&h2c->mbuf, size + 9);
index c8cec16eb82f264d429de86d149a82b1aae81e7e..93d92480ddaa8e3969cc927e1905f915a76ea317 100644 (file)
@@ -26,7 +26,7 @@ static int open_named_namespace(const char *ns_name)
 {
        if (chunk_printf(&trash, "/var/run/netns/%s", ns_name) < 0)
                return -1;
-       return open(trash.str, O_RDONLY);
+       return open(trash.area, O_RDONLY);
 }
 
 static int default_namespace = -1;
@@ -35,7 +35,7 @@ static int init_default_namespace()
 {
        if (chunk_printf(&trash, "/proc/%d/ns/net", getpid()) < 0)
                return -1;
-       default_namespace = open(trash.str, O_RDONLY);
+       default_namespace = open(trash.area, O_RDONLY);
        return default_namespace;
 }
 
index 35c1c7e8036a27bd725a503b779fd30184dfcab7..2975afacbd54bdf4ddf0f22083162cc6e7a1aa5c 100644 (file)
@@ -226,7 +226,7 @@ int pat_parse_bin(const char *text, struct pattern *pattern, int mflags, char **
        pattern->type = SMP_T_BIN;
        trash = get_trash_chunk();
        pattern->len = trash->size;
-       pattern->ptr.str = trash->str;
+       pattern->ptr.str = trash->area;
        return !!parse_binary(text, &pattern->ptr.str, &pattern->len, err);
 }
 
@@ -463,12 +463,12 @@ struct pattern *pat_match_str(struct sample *smp, struct pattern_expr *expr, int
        /* Lookup a string in the expression's pattern tree. */
        if (!eb_is_empty(&expr->pattern_tree)) {
                /* we may have to force a trailing zero on the test pattern */
-               prev = smp->data.u.str.str[smp->data.u.str.len];
+               prev = smp->data.u.str.area[smp->data.u.str.data];
                if (prev)
-                       smp->data.u.str.str[smp->data.u.str.len] = '\0';
-               node = ebst_lookup(&expr->pattern_tree, smp->data.u.str.str);
+                       smp->data.u.str.area[smp->data.u.str.data] = '\0';
+               node = ebst_lookup(&expr->pattern_tree, smp->data.u.str.area);
                if (prev)
-                       smp->data.u.str.str[smp->data.u.str.len] = prev;
+                       smp->data.u.str.area[smp->data.u.str.data] = prev;
 
                if (node) {
                        if (fill) {
@@ -488,7 +488,7 @@ struct pattern *pat_match_str(struct sample *smp, struct pattern_expr *expr, int
                unsigned long long seed = pat_lru_seed ^ (long)expr;
 
                HA_SPIN_LOCK(PATLRU_LOCK, &pat_lru_tree_lock);
-               lru = lru64_get(XXH64(smp->data.u.str.str, smp->data.u.str.len, seed),
+               lru = lru64_get(XXH64(smp->data.u.str.area, smp->data.u.str.data, seed),
                                pat_lru_tree, expr, expr->revision);
                if (!lru) {
                        HA_SPIN_UNLOCK(PATLRU_LOCK, &pat_lru_tree_lock);
@@ -504,12 +504,12 @@ struct pattern *pat_match_str(struct sample *smp, struct pattern_expr *expr, int
        list_for_each_entry(lst, &expr->patterns, list) {
                pattern = &lst->pat;
 
-               if (pattern->len != smp->data.u.str.len)
+               if (pattern->len != smp->data.u.str.data)
                        continue;
 
                icase = expr->mflags & PAT_MF_IGNORE_CASE;
-               if ((icase && strncasecmp(pattern->ptr.str, smp->data.u.str.str, smp->data.u.str.len) == 0) ||
-                   (!icase && strncmp(pattern->ptr.str, smp->data.u.str.str, smp->data.u.str.len) == 0)) {
+               if ((icase && strncasecmp(pattern->ptr.str, smp->data.u.str.area, smp->data.u.str.data) == 0) ||
+                   (!icase && strncmp(pattern->ptr.str, smp->data.u.str.area, smp->data.u.str.data) == 0)) {
                        ret = pattern;
                        break;
                }
@@ -535,7 +535,7 @@ struct pattern *pat_match_bin(struct sample *smp, struct pattern_expr *expr, int
                unsigned long long seed = pat_lru_seed ^ (long)expr;
 
                HA_SPIN_LOCK(PATLRU_LOCK, &pat_lru_tree_lock);
-               lru = lru64_get(XXH64(smp->data.u.str.str, smp->data.u.str.len, seed),
+               lru = lru64_get(XXH64(smp->data.u.str.area, smp->data.u.str.data, seed),
                                pat_lru_tree, expr, expr->revision);
                if (!lru) {
                        HA_SPIN_UNLOCK(PATLRU_LOCK, &pat_lru_tree_lock);
@@ -550,10 +550,10 @@ struct pattern *pat_match_bin(struct sample *smp, struct pattern_expr *expr, int
        list_for_each_entry(lst, &expr->patterns, list) {
                pattern = &lst->pat;
 
-               if (pattern->len != smp->data.u.str.len)
+               if (pattern->len != smp->data.u.str.data)
                        continue;
 
-               if (memcmp(pattern->ptr.str, smp->data.u.str.str, smp->data.u.str.len) == 0) {
+               if (memcmp(pattern->ptr.str, smp->data.u.str.area, smp->data.u.str.data) == 0) {
                        ret = pattern;
                        break;
                }
@@ -580,7 +580,7 @@ struct pattern *pat_match_regm(struct sample *smp, struct pattern_expr *expr, in
        list_for_each_entry(lst, &expr->patterns, list) {
                pattern = &lst->pat;
 
-               if (regex_exec_match2(pattern->ptr.reg, smp->data.u.str.str, smp->data.u.str.len,
+               if (regex_exec_match2(pattern->ptr.reg, smp->data.u.str.area, smp->data.u.str.data,
                                      MAX_MATCH, pmatch, 0)) {
                        ret = pattern;
                        smp->ctx.a[0] = pmatch;
@@ -605,7 +605,7 @@ struct pattern *pat_match_reg(struct sample *smp, struct pattern_expr *expr, int
                unsigned long long seed = pat_lru_seed ^ (long)expr;
 
                HA_SPIN_LOCK(PATLRU_LOCK, &pat_lru_tree_lock);
-               lru = lru64_get(XXH64(smp->data.u.str.str, smp->data.u.str.len, seed),
+               lru = lru64_get(XXH64(smp->data.u.str.area, smp->data.u.str.data, seed),
                                pat_lru_tree, expr, expr->revision);
                if (!lru) {
                        HA_SPIN_UNLOCK(PATLRU_LOCK, &pat_lru_tree_lock);
@@ -620,7 +620,7 @@ struct pattern *pat_match_reg(struct sample *smp, struct pattern_expr *expr, int
        list_for_each_entry(lst, &expr->patterns, list) {
                pattern = &lst->pat;
 
-               if (regex_exec2(pattern->ptr.reg, smp->data.u.str.str, smp->data.u.str.len)) {
+               if (regex_exec2(pattern->ptr.reg, smp->data.u.str.area, smp->data.u.str.data)) {
                        ret = pattern;
                        break;
                }
@@ -649,12 +649,13 @@ struct pattern *pat_match_beg(struct sample *smp, struct pattern_expr *expr, int
        /* Lookup a string in the expression's pattern tree. */
        if (!eb_is_empty(&expr->pattern_tree)) {
                /* we may have to force a trailing zero on the test pattern */
-               prev = smp->data.u.str.str[smp->data.u.str.len];
+               prev = smp->data.u.str.area[smp->data.u.str.data];
                if (prev)
-                       smp->data.u.str.str[smp->data.u.str.len] = '\0';
-               node = ebmb_lookup_longest(&expr->pattern_tree, smp->data.u.str.str);
+                       smp->data.u.str.area[smp->data.u.str.data] = '\0';
+               node = ebmb_lookup_longest(&expr->pattern_tree,
+                                          smp->data.u.str.area);
                if (prev)
-                       smp->data.u.str.str[smp->data.u.str.len] = prev;
+                       smp->data.u.str.area[smp->data.u.str.data] = prev;
 
                if (node) {
                        if (fill) {
@@ -674,7 +675,7 @@ struct pattern *pat_match_beg(struct sample *smp, struct pattern_expr *expr, int
                unsigned long long seed = pat_lru_seed ^ (long)expr;
 
                HA_SPIN_LOCK(PATLRU_LOCK, &pat_lru_tree_lock);
-               lru = lru64_get(XXH64(smp->data.u.str.str, smp->data.u.str.len, seed),
+               lru = lru64_get(XXH64(smp->data.u.str.area, smp->data.u.str.data, seed),
                                pat_lru_tree, expr, expr->revision);
                if (!lru) {
                        HA_SPIN_UNLOCK(PATLRU_LOCK, &pat_lru_tree_lock);
@@ -689,12 +690,12 @@ struct pattern *pat_match_beg(struct sample *smp, struct pattern_expr *expr, int
        list_for_each_entry(lst, &expr->patterns, list) {
                pattern = &lst->pat;
 
-               if (pattern->len > smp->data.u.str.len)
+               if (pattern->len > smp->data.u.str.data)
                        continue;
 
                icase = expr->mflags & PAT_MF_IGNORE_CASE;
-               if ((icase && strncasecmp(pattern->ptr.str, smp->data.u.str.str, pattern->len) != 0) ||
-                   (!icase && strncmp(pattern->ptr.str, smp->data.u.str.str, pattern->len) != 0))
+               if ((icase && strncasecmp(pattern->ptr.str, smp->data.u.str.area, pattern->len) != 0) ||
+                   (!icase && strncmp(pattern->ptr.str, smp->data.u.str.area, pattern->len) != 0))
                        continue;
 
                ret = pattern;
@@ -722,7 +723,7 @@ struct pattern *pat_match_end(struct sample *smp, struct pattern_expr *expr, int
                unsigned long long seed = pat_lru_seed ^ (long)expr;
 
                HA_SPIN_LOCK(PATLRU_LOCK, &pat_lru_tree_lock);
-               lru = lru64_get(XXH64(smp->data.u.str.str, smp->data.u.str.len, seed),
+               lru = lru64_get(XXH64(smp->data.u.str.area, smp->data.u.str.data, seed),
                                pat_lru_tree, expr, expr->revision);
                if (!lru) {
                        HA_SPIN_UNLOCK(PATLRU_LOCK, &pat_lru_tree_lock);
@@ -737,12 +738,12 @@ struct pattern *pat_match_end(struct sample *smp, struct pattern_expr *expr, int
        list_for_each_entry(lst, &expr->patterns, list) {
                pattern = &lst->pat;
 
-               if (pattern->len > smp->data.u.str.len)
+               if (pattern->len > smp->data.u.str.data)
                        continue;
 
                icase = expr->mflags & PAT_MF_IGNORE_CASE;
-               if ((icase && strncasecmp(pattern->ptr.str, smp->data.u.str.str + smp->data.u.str.len - pattern->len, pattern->len) != 0) ||
-                   (!icase && strncmp(pattern->ptr.str, smp->data.u.str.str + smp->data.u.str.len - pattern->len, pattern->len) != 0))
+               if ((icase && strncasecmp(pattern->ptr.str, smp->data.u.str.area + smp->data.u.str.data - pattern->len, pattern->len) != 0) ||
+                   (!icase && strncmp(pattern->ptr.str, smp->data.u.str.area + smp->data.u.str.data - pattern->len, pattern->len) != 0))
                        continue;
 
                ret = pattern;
@@ -774,7 +775,7 @@ struct pattern *pat_match_sub(struct sample *smp, struct pattern_expr *expr, int
                unsigned long long seed = pat_lru_seed ^ (long)expr;
 
                HA_SPIN_LOCK(PATLRU_LOCK, &pat_lru_tree_lock);
-               lru = lru64_get(XXH64(smp->data.u.str.str, smp->data.u.str.len, seed),
+               lru = lru64_get(XXH64(smp->data.u.str.area, smp->data.u.str.data, seed),
                                pat_lru_tree, expr, expr->revision);
                if (!lru) {
                        HA_SPIN_UNLOCK(PATLRU_LOCK, &pat_lru_tree_lock);
@@ -789,13 +790,13 @@ struct pattern *pat_match_sub(struct sample *smp, struct pattern_expr *expr, int
        list_for_each_entry(lst, &expr->patterns, list) {
                pattern = &lst->pat;
 
-               if (pattern->len > smp->data.u.str.len)
+               if (pattern->len > smp->data.u.str.data)
                        continue;
 
-               end = smp->data.u.str.str + smp->data.u.str.len - pattern->len;
+               end = smp->data.u.str.area + smp->data.u.str.data - pattern->len;
                icase = expr->mflags & PAT_MF_IGNORE_CASE;
                if (icase) {
-                       for (c = smp->data.u.str.str; c <= end; c++) {
+                       for (c = smp->data.u.str.area; c <= end; c++) {
                                if (tolower(*c) != tolower(*pattern->ptr.str))
                                        continue;
                                if (strncasecmp(pattern->ptr.str, c, pattern->len) == 0) {
@@ -804,7 +805,7 @@ struct pattern *pat_match_sub(struct sample *smp, struct pattern_expr *expr, int
                                }
                        }
                } else {
-                       for (c = smp->data.u.str.str; c <= end; c++) {
+                       for (c = smp->data.u.str.area; c <= end; c++) {
                                if (*c != *pattern->ptr.str)
                                        continue;
                                if (strncmp(pattern->ptr.str, c, pattern->len) == 0) {
@@ -847,13 +848,13 @@ static int match_word(struct sample *smp, struct pattern *pattern, int mflags, u
        while (pl > 0 && is_delimiter(ps[pl - 1], delimiters))
                pl--;
 
-       if (pl > smp->data.u.str.len)
+       if (pl > smp->data.u.str.data)
                return PAT_NOMATCH;
 
        may_match = 1;
        icase = mflags & PAT_MF_IGNORE_CASE;
-       end = smp->data.u.str.str + smp->data.u.str.len - pl;
-       for (c = smp->data.u.str.str; c <= end; c++) {
+       end = smp->data.u.str.area + smp->data.u.str.data - pl;
+       for (c = smp->data.u.str.area; c <= end; c++) {
                if (is_delimiter(*c, delimiters)) {
                        may_match = 1;
                        continue;
@@ -935,8 +936,8 @@ struct pattern *pat_match_len(struct sample *smp, struct pattern_expr *expr, int
 
        list_for_each_entry(lst, &expr->patterns, list) {
                pattern = &lst->pat;
-               if ((!pattern->val.range.min_set || pattern->val.range.min <= smp->data.u.str.len) &&
-                   (!pattern->val.range.max_set || smp->data.u.str.len <= pattern->val.range.max))
+               if ((!pattern->val.range.min_set || pattern->val.range.min <= smp->data.u.str.data) &&
+                   (!pattern->val.range.max_set || smp->data.u.str.data <= pattern->val.range.max))
                        return pattern;
        }
        return NULL;
@@ -2332,9 +2333,9 @@ int pat_ref_read_from_file_smp(struct pat_ref *ref, const char *filename, char *
         * followed by one value per line. The start spaces, separator spaces
         * and and spaces are stripped. Each can contain comment started by '#'
         */
-       while (fgets(trash.str, trash.size, file) != NULL) {
+       while (fgets(trash.area, trash.size, file) != NULL) {
                line++;
-               c = trash.str;
+               c = trash.area;
 
                /* ignore lines beginning with a dash */
                if (*c == '#')
@@ -2409,9 +2410,9 @@ int pat_ref_read_from_file(struct pat_ref *ref, const char *filename, char **err
         * line. If the line contains spaces, they will be part of the pattern.
         * The pattern stops at the first CR, LF or EOF encountered.
         */
-       while (fgets(trash.str, trash.size, file) != NULL) {
+       while (fgets(trash.area, trash.size, file) != NULL) {
                line++;
-               c = trash.str;
+               c = trash.area;
 
                /* ignore lines beginning with a dash */
                if (*c == '#')
@@ -2462,7 +2463,7 @@ int pattern_read_from_file(struct pattern_head *head, unsigned int refflags,
                             "pattern loaded from file '%s' used by %s at file '%s' line %d",
                             filename, refflags & PAT_REF_MAP ? "map" : "acl", file, line);
 
-               ref = pat_ref_new(filename, trash.str, refflags);
+               ref = pat_ref_new(filename, trash.area, refflags);
                if (!ref) {
                        memprintf(err, "out of memory");
                        return 0;
@@ -2509,7 +2510,7 @@ int pattern_read_from_file(struct pattern_head *head, unsigned int refflags,
                chunk_appendf(&trash, ", by %s at file '%s' line %d",
                              refflags & PAT_REF_MAP ? "map" : "acl", file, line);
                free(ref->display);
-               ref->display = strdup(trash.str);
+               ref->display = strdup(trash.area);
                if (!ref->display) {
                        memprintf(err, "out of memory");
                        return 0;
@@ -2596,11 +2597,13 @@ struct pattern *pattern_exec_match(struct pattern_head *head, struct sample *smp
                                        case SMP_T_STR:
                                                static_sample_data.type = SMP_T_STR;
                                                static_sample_data.u.str = *get_trash_chunk();
-                                               static_sample_data.u.str.len = pat->data->u.str.len;
-                                               if (static_sample_data.u.str.len >= static_sample_data.u.str.size)
-                                                       static_sample_data.u.str.len = static_sample_data.u.str.size - 1;
-                                               memcpy(static_sample_data.u.str.str, pat->data->u.str.str, static_sample_data.u.str.len);
-                                               static_sample_data.u.str.str[static_sample_data.u.str.len] = 0;
+                                               static_sample_data.u.str.data = pat->data->u.str.data;
+                                               if (static_sample_data.u.str.data >= static_sample_data.u.str.size)
+                                                       static_sample_data.u.str.data = static_sample_data.u.str.size - 1;
+                                               memcpy(static_sample_data.u.str.area,
+                                                      pat->data->u.str.area,
+                                                      static_sample_data.u.str.data);
+                                               static_sample_data.u.str.area[static_sample_data.u.str.data] = 0;
                                        case SMP_T_IPV4:
                                        case SMP_T_IPV6:
                                        case SMP_T_SINT:
index cf5b8838baf5e3e4132bb04fd21300d3724be247..054168a51286b7cf864e13f4686049dbb8ca9efe 100644 (file)
@@ -630,8 +630,8 @@ smp_fetch_ssl_hello_sni(const struct arg *args, struct sample *smp, const char *
 
                        if (name_type == 0) { /* hostname */
                                smp->data.type = SMP_T_STR;
-                               smp->data.u.str.str = (char *)data + 9;
-                               smp->data.u.str.len = name_len;
+                               smp->data.u.str.area = (char *)data + 9;
+                               smp->data.u.str.data = name_len;
                                smp->flags = SMP_F_VOLATILE | SMP_F_CONST;
                                return 1;
                        }
@@ -714,8 +714,8 @@ fetch_rdp_cookie_name(struct stream *s, struct sample *smp, const char *cname, i
        }
 
        /* data points to cookie value */
-       smp->data.u.str.str = (char *)data;
-       smp->data.u.str.len = 0;
+       smp->data.u.str.area = (char *)data;
+       smp->data.u.str.data = 0;
 
        while (bleft > 0 && *data != '\r') {
                data++;
@@ -728,7 +728,7 @@ fetch_rdp_cookie_name(struct stream *s, struct sample *smp, const char *cname, i
        if (data[0] != '\r' || data[1] != '\n')
                goto not_cookie;
 
-       smp->data.u.str.len = (char *)data - smp->data.u.str.str;
+       smp->data.u.str.data = (char *)data - smp->data.u.str.area;
        smp->flags = SMP_F_VOLATILE | SMP_F_CONST;
        return 1;
 
@@ -750,7 +750,9 @@ smp_fetch_rdp_cookie(const struct arg *args, struct sample *smp, const char *kw,
        if (!smp->strm)
                return 0;
 
-       return fetch_rdp_cookie_name(smp->strm, smp, args ? args->data.str.str : NULL, args ? args->data.str.len : 0);
+       return fetch_rdp_cookie_name(smp->strm, smp,
+                                    args ? args->data.str.area : NULL,
+                                    args ? args->data.str.data : 0);
 }
 
 /* returns either 1 or 0 depending on whether an RDP cookie is found or not */
@@ -890,12 +892,13 @@ int val_payload_lv(struct arg *arg, char **err_msg)
                return 0;
        }
 
-       if (arg[2].type == ARGT_STR && arg[2].data.str.len > 0) {
-               if (arg[2].data.str.str[0] == '+' || arg[2].data.str.str[0] == '-')
+       if (arg[2].type == ARGT_STR && arg[2].data.str.data > 0) {
+               if (arg[2].data.str.area[0] == '+' || arg[2].data.str.area[0] == '-')
                        relative = 1;
-               str = arg[2].data.str.str;
+               str = arg[2].data.str.area;
                arg[2].type = ARGT_SINT;
-               arg[2].data.sint = read_int64(&str, str + arg[2].data.str.len);
+               arg[2].data.sint = read_int64(&str,
+                                             str + arg[2].data.str.data);
                if (*str != '\0') {
                        memprintf(err_msg, "payload offset2 is not a number");
                        return 0;
@@ -1087,7 +1090,7 @@ int val_distcc(struct arg *arg, char **err_msg)
 {
        unsigned int token;
 
-       if (arg[0].data.str.len != 4) {
+       if (arg[0].data.str.data != 4) {
                memprintf(err_msg, "token name must be exactly 4 characters");
                return 0;
        }
@@ -1095,8 +1098,8 @@ int val_distcc(struct arg *arg, char **err_msg)
        /* convert the token name to an unsigned int (one byte per character,
         * big endian format).
         */
-       token = (arg[0].data.str.str[0] << 24) + (arg[0].data.str.str[1] << 16) +
-               (arg[0].data.str.str[2] << 8) + (arg[0].data.str.str[3] << 0);
+       token = (arg[0].data.str.area[0] << 24) + (arg[0].data.str.area[1] << 16) +
+               (arg[0].data.str.area[2] << 8) + (arg[0].data.str.area[3] << 0);
 
        arg[0].type      = ARGT_SINT;
        arg[0].data.sint = token;
index 6e549f024258dca88306fe03c4e0797c06afff06..08a29a6a76a515154f504436862f1efd8beccdc4 100644 (file)
@@ -413,7 +413,7 @@ static int peer_prepare_switchmsg(struct shared_table *st, char *msg, size_t siz
        intencode(st->table->key_size, &cursor);
 
        chunk = get_trash_chunk();
-       chunkp = chunkq = chunk->str;
+       chunkp = chunkq = chunk->area;
        /* encode available known data types in table */
        for (data_type = 0 ; data_type < STKTABLE_DATA_TYPES ; data_type++) {
                if (st->table->data_ofs[data_type]) {
@@ -437,9 +437,9 @@ static int peer_prepare_switchmsg(struct shared_table *st, char *msg, size_t siz
        intencode(st->table->expire, &cursor);
 
        if (chunkq > chunkp) {
-               chunk->len = chunkq - chunkp;
-               memcpy(cursor, chunk->str, chunk->len);
-               cursor += chunk->len;
+               chunk->data = chunkq - chunkp;
+               memcpy(cursor, chunk->area, chunk->data);
+               cursor += chunk->data;
        }
 
        /* Compute datalen */
@@ -588,31 +588,32 @@ switchstate:
                                appctx->st0 = PEER_SESS_ST_GETVERSION;
                                /* fall through */
                        case PEER_SESS_ST_GETVERSION:
-                               reql = co_getline(si_oc(si), trash.str, trash.size);
+                               reql = co_getline(si_oc(si), trash.area,
+                                                 trash.size);
                                if (reql <= 0) { /* closed or EOL not found */
                                        if (reql == 0)
                                                goto out;
                                        appctx->st0 = PEER_SESS_ST_END;
                                        goto switchstate;
                                }
-                               if (trash.str[reql-1] != '\n') {
+                               if (trash.area[reql-1] != '\n') {
                                        appctx->st0 = PEER_SESS_ST_END;
                                        goto switchstate;
                                }
-                               else if (reql > 1 && (trash.str[reql-2] == '\r'))
-                                       trash.str[reql-2] = 0;
+                               else if (reql > 1 && (trash.area[reql-2] == '\r'))
+                                       trash.area[reql-2] = 0;
                                else
-                                       trash.str[reql-1] = 0;
+                                       trash.area[reql-1] = 0;
 
                                co_skip(si_oc(si), reql);
 
                                /* test protocol */
-                               if (strncmp(PEER_SESSION_PROTO_NAME " ", trash.str, proto_len + 1) != 0) {
+                               if (strncmp(PEER_SESSION_PROTO_NAME " ", trash.area, proto_len + 1) != 0) {
                                        appctx->st0 = PEER_SESS_ST_EXIT;
                                        appctx->st1 = PEER_SESS_SC_ERRPROTO;
                                        goto switchstate;
                                }
-                               if (peer_get_version(trash.str + proto_len + 1, &maj_ver, &min_ver) == -1 ||
+                               if (peer_get_version(trash.area + proto_len + 1, &maj_ver, &min_ver) == -1 ||
                                    maj_ver != PEER_MAJOR_VER || min_ver > PEER_MINOR_VER) {
                                        appctx->st0 = PEER_SESS_ST_EXIT;
                                        appctx->st1 = PEER_SESS_SC_ERRVERSION;
@@ -622,26 +623,27 @@ switchstate:
                                appctx->st0 = PEER_SESS_ST_GETHOST;
                                /* fall through */
                        case PEER_SESS_ST_GETHOST:
-                               reql = co_getline(si_oc(si), trash.str, trash.size);
+                               reql = co_getline(si_oc(si), trash.area,
+                                                 trash.size);
                                if (reql <= 0) { /* closed or EOL not found */
                                        if (reql == 0)
                                                goto out;
                                        appctx->st0 = PEER_SESS_ST_END;
                                        goto switchstate;
                                }
-                               if (trash.str[reql-1] != '\n') {
+                               if (trash.area[reql-1] != '\n') {
                                        appctx->st0 = PEER_SESS_ST_END;
                                        goto switchstate;
                                }
-                               else if (reql > 1 && (trash.str[reql-2] == '\r'))
-                                       trash.str[reql-2] = 0;
+                               else if (reql > 1 && (trash.area[reql-2] == '\r'))
+                                       trash.area[reql-2] = 0;
                                else
-                                       trash.str[reql-1] = 0;
+                                       trash.area[reql-1] = 0;
 
                                co_skip(si_oc(si), reql);
 
                                /* test hostname match */
-                               if (strcmp(localpeer, trash.str) != 0) {
+                               if (strcmp(localpeer, trash.area) != 0) {
                                        appctx->st0 = PEER_SESS_ST_EXIT;
                                        appctx->st1 = PEER_SESS_SC_ERRHOST;
                                        goto switchstate;
@@ -651,27 +653,28 @@ switchstate:
                                /* fall through */
                        case PEER_SESS_ST_GETPEER: {
                                char *p;
-                               reql = co_getline(si_oc(si), trash.str, trash.size);
+                               reql = co_getline(si_oc(si), trash.area,
+                                                 trash.size);
                                if (reql <= 0) { /* closed or EOL not found */
                                        if (reql == 0)
                                                goto out;
                                        appctx->st0 = PEER_SESS_ST_END;
                                        goto switchstate;
                                }
-                               if (trash.str[reql-1] != '\n') {
+                               if (trash.area[reql-1] != '\n') {
                                        /* Incomplete line, we quit */
                                        appctx->st0 = PEER_SESS_ST_END;
                                        goto switchstate;
                                }
-                               else if (reql > 1 && (trash.str[reql-2] == '\r'))
-                                       trash.str[reql-2] = 0;
+                               else if (reql > 1 && (trash.area[reql-2] == '\r'))
+                                       trash.area[reql-2] = 0;
                                else
-                                       trash.str[reql-1] = 0;
+                                       trash.area[reql-1] = 0;
 
                                co_skip(si_oc(si), reql);
 
                                /* parse line "<peer name> <pid> <relative_pid>" */
-                               p = strchr(trash.str, ' ');
+                               p = strchr(trash.area, ' ');
                                if (!p) {
                                        appctx->st0 = PEER_SESS_ST_EXIT;
                                        appctx->st1 = PEER_SESS_SC_ERRPROTO;
@@ -681,7 +684,7 @@ switchstate:
 
                                /* lookup known peer */
                                for (curpeer = curpeers->remote; curpeer; curpeer = curpeer->next) {
-                                       if (strcmp(curpeer->id, trash.str) == 0)
+                                       if (strcmp(curpeer->id, trash.area) == 0)
                                                break;
                                }
 
@@ -732,8 +735,10 @@ switchstate:
                                                goto switchstate;
                                        }
                                }
-                               repl = snprintf(trash.str, trash.size, "%d\n", PEER_SESS_SC_SUCCESSCODE);
-                               repl = ci_putblk(si_ic(si), trash.str, repl);
+                               repl = snprintf(trash.area, trash.size,
+                                               "%d\n",
+                                               PEER_SESS_SC_SUCCESSCODE);
+                               repl = ci_putblk(si_ic(si), trash.area, repl);
                                if (repl <= 0) {
                                        if (repl == -1)
                                                goto full;
@@ -795,7 +800,7 @@ switchstate:
                                }
 
                                /* Send headers */
-                               repl = snprintf(trash.str, trash.size,
+                               repl = snprintf(trash.area, trash.size,
                                                PEER_SESSION_PROTO_NAME " %u.%u\n%s\n%s %d %d\n",
                                                PEER_MAJOR_VER,
                                                (curpeer->flags & PEER_F_DWNGRD) ? PEER_DWNGRD_MINOR_VER : PEER_MINOR_VER,
@@ -809,7 +814,7 @@ switchstate:
                                        goto switchstate;
                                }
 
-                               repl = ci_putblk(si_ic(si), trash.str, repl);
+                               repl = ci_putblk(si_ic(si), trash.area, repl);
                                if (repl <= 0) {
                                        if (repl == -1)
                                                goto full;
@@ -836,27 +841,28 @@ switchstate:
                                if (si_ic(si)->flags & CF_WRITE_PARTIAL)
                                        curpeer->statuscode = PEER_SESS_SC_CONNECTEDCODE;
 
-                               reql = co_getline(si_oc(si), trash.str, trash.size);
+                               reql = co_getline(si_oc(si), trash.area,
+                                                 trash.size);
                                if (reql <= 0) { /* closed or EOL not found */
                                        if (reql == 0)
                                                goto out;
                                        appctx->st0 = PEER_SESS_ST_END;
                                        goto switchstate;
                                }
-                               if (trash.str[reql-1] != '\n') {
+                               if (trash.area[reql-1] != '\n') {
                                        /* Incomplete line, we quit */
                                        appctx->st0 = PEER_SESS_ST_END;
                                        goto switchstate;
                                }
-                               else if (reql > 1 && (trash.str[reql-2] == '\r'))
-                                       trash.str[reql-2] = 0;
+                               else if (reql > 1 && (trash.area[reql-2] == '\r'))
+                                       trash.area[reql-2] = 0;
                                else
-                                       trash.str[reql-1] = 0;
+                                       trash.area[reql-1] = 0;
 
                                co_skip(si_oc(si), reql);
 
                                /* Register status code */
-                               curpeer->statuscode = atoi(trash.str);
+                               curpeer->statuscode = atoi(trash.area);
 
                                /* Awake main task */
                                task_wakeup(curpeers->sync_task, TASK_WOKEN_MSG);
@@ -906,8 +912,8 @@ switchstate:
                        case PEER_SESS_ST_WAITMSG: {
                                struct stksess *ts, *newts = NULL;
                                uint32_t msg_len = 0;
-                               char *msg_cur = trash.str;
-                               char *msg_end = trash.str;
+                               char *msg_cur = trash.area;
+                               char *msg_end = trash.area;
                                unsigned char msg_head[7];
                                int totl = 0;
 
@@ -978,7 +984,10 @@ switchstate:
                                                        goto switchstate;
                                                }
 
-                                               reql = co_getblk(si_oc(si), trash.str, msg_len, totl);
+                                               reql = co_getblk(si_oc(si),
+                                                                trash.area,
+                                                                msg_len,
+                                                                totl);
                                                if (reql <= 0) /* closed */
                                                        goto incomplete;
                                                totl += reql;
@@ -1443,7 +1452,9 @@ incomplete:
                                                if (st->last_get != st->last_acked) {
                                                        int msglen;
 
-                                                       msglen = peer_prepare_ackmsg(st, trash.str, trash.size);
+                                                       msglen = peer_prepare_ackmsg(st,
+                                                                                    trash.area,
+                                                                                    trash.size);
                                                        if (!msglen) {
                                                                /* internal error: message does not fit in trash */
                                                                appctx->st0 = PEER_SESS_ST_END;
@@ -1451,7 +1462,9 @@ incomplete:
                                                        }
 
                                                        /* message to buffer */
-                                                       repl = ci_putblk(si_ic(si), trash.str, msglen);
+                                                       repl = ci_putblk(si_ic(si),
+                                                                        trash.area,
+                                                                        msglen);
                                                        if (repl <= 0) {
                                                                /* no more write possible */
                                                                if (repl == -1) {
@@ -1473,7 +1486,9 @@ incomplete:
                                                                if (st != curpeer->last_local_table) {
                                                                        int msglen;
 
-                                                                       msglen = peer_prepare_switchmsg(st, trash.str, trash.size);
+                                                                       msglen = peer_prepare_switchmsg(st,
+                                                                                                       trash.area,
+                                                                                                       trash.size);
                                                                        if (!msglen) {
                                                                                HA_SPIN_UNLOCK(STK_TABLE_LOCK, &st->table->lock);
                                                                                /* internal error: message does not fit in trash */
@@ -1482,7 +1497,9 @@ incomplete:
                                                                        }
 
                                                                        /* message to buffer */
-                                                                       repl = ci_putblk(si_ic(si), trash.str, msglen);
+                                                                       repl = ci_putblk(si_ic(si),
+                                                                                        trash.area,
+                                                                                        msglen);
                                                                        if (repl <= 0) {
                                                                                HA_SPIN_UNLOCK(STK_TABLE_LOCK, &st->table->lock);
                                                                                /* no more write possible */
@@ -1522,7 +1539,11 @@ incomplete:
                                                                        ts->ref_cnt++;
                                                                        HA_SPIN_UNLOCK(STK_TABLE_LOCK, &st->table->lock);
 
-                                                                       msglen = peer_prepare_updatemsg(ts, st, updateid, trash.str, trash.size, new_pushed, 0);
+                                                                       msglen = peer_prepare_updatemsg(ts, st, updateid,
+                                                                                                       trash.area,
+                                                                                                       trash.size,
+                                                                                                       new_pushed,
+                                                                                                       0);
                                                                        if (!msglen) {
                                                                                /* internal error: message does not fit in trash */
                                                                                HA_SPIN_LOCK(STK_TABLE_LOCK, &st->table->lock);
@@ -1533,7 +1554,9 @@ incomplete:
                                                                        }
 
                                                                        /* message to buffer */
-                                                                       repl = ci_putblk(si_ic(si), trash.str, msglen);
+                                                                       repl = ci_putblk(si_ic(si),
+                                                                                        trash.area,
+                                                                                        msglen);
                                                                        if (repl <= 0) {
                                                                                /* no more write possible */
                                                                                HA_SPIN_LOCK(STK_TABLE_LOCK, &st->table->lock);
@@ -1565,7 +1588,9 @@ incomplete:
                                                                if (st != curpeer->last_local_table) {
                                                                        int msglen;
 
-                                                                       msglen = peer_prepare_switchmsg(st, trash.str, trash.size);
+                                                                       msglen = peer_prepare_switchmsg(st,
+                                                                                                       trash.area,
+                                                                                                       trash.size);
                                                                        if (!msglen) {
                                                                                /* internal error: message does not fit in trash */
                                                                                appctx->st0 = PEER_SESS_ST_END;
@@ -1573,7 +1598,9 @@ incomplete:
                                                                        }
 
                                                                        /* message to buffer */
-                                                                       repl = ci_putblk(si_ic(si), trash.str, msglen);
+                                                                       repl = ci_putblk(si_ic(si),
+                                                                                        trash.area,
+                                                                                        msglen);
                                                                        if (repl <= 0) {
                                                                                /* no more write possible */
                                                                                if (repl == -1) {
@@ -1610,7 +1637,11 @@ incomplete:
                                                                        HA_SPIN_UNLOCK(STK_TABLE_LOCK, &st->table->lock);
 
                                                                        use_timed = !(curpeer->flags & PEER_F_DWNGRD);
-                                                                       msglen = peer_prepare_updatemsg(ts, st, updateid, trash.str, trash.size, new_pushed, use_timed);
+                                                                       msglen = peer_prepare_updatemsg(ts, st, updateid,
+                                                                                                       trash.area,
+                                                                                                       trash.size,
+                                                                                                       new_pushed,
+                                                                                                       use_timed);
                                                                        if (!msglen) {
                                                                                /* internal error: message does not fit in trash */
                                                                                HA_SPIN_LOCK(STK_TABLE_LOCK, &st->table->lock);
@@ -1621,7 +1652,9 @@ incomplete:
                                                                        }
 
                                                                        /* message to buffer */
-                                                                       repl = ci_putblk(si_ic(si), trash.str, msglen);
+                                                                       repl = ci_putblk(si_ic(si),
+                                                                                        trash.area,
+                                                                                        msglen);
                                                                        if (repl <= 0) {
                                                                                /* no more write possible */
                                                                                HA_SPIN_LOCK(STK_TABLE_LOCK, &st->table->lock);
@@ -1649,7 +1682,9 @@ incomplete:
                                                                if (st != curpeer->last_local_table) {
                                                                        int msglen;
 
-                                                                       msglen = peer_prepare_switchmsg(st, trash.str, trash.size);
+                                                                       msglen = peer_prepare_switchmsg(st,
+                                                                                                       trash.area,
+                                                                                                       trash.size);
                                                                        if (!msglen) {
                                                                                /* internal error: message does not fit in trash */
                                                                                appctx->st0 = PEER_SESS_ST_END;
@@ -1657,7 +1692,9 @@ incomplete:
                                                                        }
 
                                                                        /* message to buffer */
-                                                                       repl = ci_putblk(si_ic(si), trash.str, msglen);
+                                                                       repl = ci_putblk(si_ic(si),
+                                                                                        trash.area,
+                                                                                        msglen);
                                                                        if (repl <= 0) {
                                                                                /* no more write possible */
                                                                                if (repl == -1) {
@@ -1693,7 +1730,11 @@ incomplete:
                                                                        HA_SPIN_UNLOCK(STK_TABLE_LOCK, &st->table->lock);
 
                                                                        use_timed = !(curpeer->flags & PEER_F_DWNGRD);
-                                                                       msglen = peer_prepare_updatemsg(ts, st, updateid, trash.str, trash.size, new_pushed, use_timed);
+                                                                       msglen = peer_prepare_updatemsg(ts, st, updateid,
+                                                                                                       trash.area,
+                                                                                                       trash.size,
+                                                                                                       new_pushed,
+                                                                                                       use_timed);
                                                                        if (!msglen) {
                                                                                /* internal error: message does not fit in trash */
                                                                                HA_SPIN_LOCK(STK_TABLE_LOCK, &st->table->lock);
@@ -1704,7 +1745,9 @@ incomplete:
                                                                        }
 
                                                                        /* message to buffer */
-                                                                       repl = ci_putblk(si_ic(si), trash.str, msglen);
+                                                                       repl = ci_putblk(si_ic(si),
+                                                                                        trash.area,
+                                                                                        msglen);
                                                                        if (repl <= 0) {
                                                                                /* no more write possible */
                                                                                HA_SPIN_LOCK(STK_TABLE_LOCK, &st->table->lock);
@@ -1777,8 +1820,9 @@ incomplete:
                                goto out;
                        }
                        case PEER_SESS_ST_EXIT:
-                               repl = snprintf(trash.str, trash.size, "%d\n", appctx->st1);
-                               if (ci_putblk(si_ic(si), trash.str, repl) == -1)
+                               repl = snprintf(trash.area, trash.size,
+                                               "%d\n", appctx->st1);
+                               if (ci_putblk(si_ic(si), trash.area, repl) == -1)
                                        goto full;
                                appctx->st0 = PEER_SESS_ST_END;
                                goto switchstate;
index 1d798e68f53b17aff1b8a5aaa1bd2f773b8bfb34..ea10b91ed27e0aec573177178ab5565be9618425 100644 (file)
@@ -79,8 +79,8 @@ const char HTTP_100[] =
        "HTTP/1.1 100 Continue\r\n\r\n";
 
 const struct chunk http_100_chunk = {
-       .str = (char *)&HTTP_100,
-       .len = sizeof(HTTP_100)-1
+       .area = (char *)&HTTP_100,
+       .data = sizeof(HTTP_100)-1
 };
 
 /* Warning: no "connection" header is provided with the 3xx messages below */
@@ -422,8 +422,8 @@ void init_proto_http()
                        abort();
                }
 
-               http_err_chunks[msg].str = (char *)http_err_msgs[msg];
-               http_err_chunks[msg].len = strlen(http_err_msgs[msg]);
+               http_err_chunks[msg].area = (char *)http_err_msgs[msg];
+               http_err_chunks[msg].data = strlen(http_err_msgs[msg]);
        }
 
        /* initialize the log header encoding map : '{|}"#' should be encoded with
@@ -927,7 +927,7 @@ static void http_server_error(struct stream *s, struct stream_interface *si,
        channel_auto_close(si_ic(si));
        channel_auto_read(si_ic(si));
        if (msg)
-               co_inject(si_ic(si), msg->str, msg->len);
+               co_inject(si_ic(si), msg->area, msg->data);
        if (!(s->flags & SF_ERR_MASK))
                s->flags |= err;
        if (!(s->flags & SF_FINST_MASK))
@@ -942,9 +942,9 @@ struct chunk *http_error_message(struct stream *s)
 {
        const int msgnum = http_get_status_idx(s->txn->status);
 
-       if (s->be->errmsg[msgnum].str)
+       if (s->be->errmsg[msgnum].area)
                return &s->be->errmsg[msgnum];
-       else if (strm_fe(s)->errmsg[msgnum].str)
+       else if (strm_fe(s)->errmsg[msgnum].area)
                return &strm_fe(s)->errmsg[msgnum];
        else
                return &http_err_chunks[msgnum];
@@ -1081,19 +1081,19 @@ void http_perform_server_redirect(struct stream *s, struct stream_interface *si)
        int len, rewind;
 
        /* 1: create the response header */
-       trash.len = strlen(HTTP_302);
-       memcpy(trash.str, HTTP_302, trash.len);
+       trash.data = strlen(HTTP_302);
+       memcpy(trash.area, HTTP_302, trash.data);
 
        srv = objt_server(s->target);
 
        /* 2: add the server's prefix */
-       if (trash.len + srv->rdr_len > trash.size)
+       if (trash.data + srv->rdr_len > trash.size)
                return;
 
        /* special prefix "/" means don't change URL */
        if (srv->rdr_len != 1 || *srv->rdr_pfx != '/') {
-               memcpy(trash.str + trash.len, srv->rdr_pfx, srv->rdr_len);
-               trash.len += srv->rdr_len;
+               memcpy(trash.area + trash.data, srv->rdr_pfx, srv->rdr_len);
+               trash.data += srv->rdr_len;
        }
 
        /* 3: add the request URI. Since it was already forwarded, we need
@@ -1110,18 +1110,20 @@ void http_perform_server_redirect(struct stream *s, struct stream_interface *si)
        if (!path)
                return;
 
-       if (trash.len + len > trash.size - 4) /* 4 for CRLF-CRLF */
+       if (trash.data + len > trash.size - 4) /* 4 for CRLF-CRLF */
                return;
 
-       memcpy(trash.str + trash.len, path, len);
-       trash.len += len;
+       memcpy(trash.area + trash.data, path, len);
+       trash.data += len;
 
        if (unlikely(txn->flags & TX_USE_PX_CONN)) {
-               memcpy(trash.str + trash.len, "\r\nProxy-Connection: close\r\n\r\n", 29);
-               trash.len += 29;
+               memcpy(trash.area + trash.data,
+                      "\r\nProxy-Connection: close\r\n\r\n", 29);
+               trash.data += 29;
        } else {
-               memcpy(trash.str + trash.len, "\r\nConnection: close\r\n\r\n", 23);
-               trash.len += 23;
+               memcpy(trash.area + trash.data,
+                      "\r\nConnection: close\r\n\r\n", 23);
+               trash.data += 23;
        }
 
        /* prepare to return without error. */
@@ -1301,24 +1303,25 @@ get_http_auth(struct stream *s)
 
        chunk_initlen(&txn->auth.method_data, p + 1, 0, ctx.vlen - len - 1);
 
-       if (!strncasecmp("Basic", auth_method.str, auth_method.len)) {
+       if (!strncasecmp("Basic", auth_method.area, auth_method.data)) {
                struct chunk *http_auth = get_trash_chunk();
 
-               len = base64dec(txn->auth.method_data.str, txn->auth.method_data.len,
-                               http_auth->str, global.tune.bufsize - 1);
+               len = base64dec(txn->auth.method_data.area,
+                               txn->auth.method_data.data,
+                               http_auth->area, global.tune.bufsize - 1);
 
                if (len < 0)
                        return 0;
 
 
-               http_auth->str[len] = '\0';
+               http_auth->area[len] = '\0';
 
-               p = strchr(http_auth->str, ':');
+               p = strchr(http_auth->area, ':');
 
                if (!p)
                        return 0;
 
-               txn->auth.user = http_auth->str;
+               txn->auth.user = http_auth->area;
                *p = '\0';
                txn->auth.pass = p+1;
 
@@ -1644,7 +1647,7 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
                        }
                        if (unlikely(ci_tail(req) < c_ptr(req, msg->next) ||
                                     ci_tail(req) > b_wrap(&req->buf) - global.tune.maxrewrite))
-                               channel_slow_realign(req, trash.str);
+                               channel_slow_realign(req, trash.area);
                }
 
                if (likely(msg->next < ci_data(req))) /* some unparsed data are available */
@@ -2425,11 +2428,13 @@ int http_transform_header_str(struct stream* s, struct http_msg *msg,
                if (!regex_exec_match2(re, val, val_end-val, MAX_MATCH, pmatch, 0))
                        continue;
 
-               output->len = exp_replace(output->str, output->size, val, str, pmatch);
-               if (output->len == -1)
+               output->data = exp_replace(output->area, output->size, val,
+                                         str, pmatch);
+               if (output->data == -1)
                        return -1;
 
-               delta = b_rep_blk(&msg->chn->buf, val, val_end, output->str, output->len);
+               delta = b_rep_blk(&msg->chn->buf, val, val_end, output->area,
+                                 output->data);
 
                hdr->len += delta;
                http_msg_move_end(msg, delta);
@@ -2453,11 +2458,12 @@ static int http_transform_header(struct stream* s, struct http_msg *msg,
        if (!replace)
                goto leave;
 
-       replace->len = build_logline(s, replace->str, replace->size, fmt);
-       if (replace->len >= replace->size - 1)
+       replace->data = build_logline(s, replace->area, replace->size, fmt);
+       if (replace->data >= replace->size - 1)
                goto leave;
 
-       ret = http_transform_header_str(s, msg, name, name_len, replace->str, re, action);
+       ret = http_transform_header_str(s, msg, name, name_len, replace->area,
+                                       re, action);
 
   leave:
        free_trash_chunk(replace);
@@ -2608,11 +2614,14 @@ resume_execution:
                                return HTTP_RULE_RES_BADREQ;
 
                        len = rule->arg.hdr_add.name_len + 2,
-                       len += build_logline(s, replace->str + len, replace->size - len, &rule->arg.hdr_add.fmt);
-                       memcpy(replace->str, rule->arg.hdr_add.name, rule->arg.hdr_add.name_len);
-                       replace->str[rule->arg.hdr_add.name_len] = ':';
-                       replace->str[rule->arg.hdr_add.name_len + 1] = ' ';
-                       replace->len = len;
+                       len += build_logline(s, replace->area + len,
+                                            replace->size - len,
+                                            &rule->arg.hdr_add.fmt);
+                       memcpy(replace->area, rule->arg.hdr_add.name,
+                              rule->arg.hdr_add.name_len);
+                       replace->area[rule->arg.hdr_add.name_len] = ':';
+                       replace->area[rule->arg.hdr_add.name_len + 1] = ' ';
+                       replace->data = len;
 
                        if (rule->action == ACT_HTTP_SET_HDR) {
                                /* remove all occurrences of the header */
@@ -2623,12 +2632,13 @@ resume_execution:
                                }
                        }
 
-                       if (http_header_add_tail2(&txn->req, &txn->hdr_idx, replace->str, replace->len) < 0) {
+                       if (http_header_add_tail2(&txn->req, &txn->hdr_idx, replace->area, replace->data) < 0) {
                                static unsigned char rate_limit = 0;
 
                                if ((rate_limit++ & 255) == 0) {
-                                       replace->str[rule->arg.hdr_add.name_len] = 0;
-                                       send_log(px, LOG_WARNING, "Proxy %s failed to add or set the request header '%s' for request #%u. You might need to increase tune.maxrewrite.", px->id, replace->str, s->uniq_id);
+                                       replace->area[rule->arg.hdr_add.name_len] = 0;
+                                       send_log(px, LOG_WARNING, "Proxy %s failed to add or set the request header '%s' for request #%u. You might need to increase tune.maxrewrite.", px->id,
+                                                replace->area, s->uniq_id);
                                }
 
                                HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_rewrites, 1);
@@ -2658,13 +2668,14 @@ resume_execution:
                                return HTTP_RULE_RES_BADREQ;
 
                        /* collect key */
-                       key->len = build_logline(s, key->str, key->size, &rule->arg.map.key);
-                       key->str[key->len] = '\0';
+                       key->data = build_logline(s, key->area, key->size,
+                                                &rule->arg.map.key);
+                       key->area[key->data] = '\0';
 
                        /* perform update */
                        /* returned code: 1=ok, 0=ko */
                        HA_SPIN_LOCK(PATREF_LOCK, &ref->lock);
-                       pat_ref_delete(ref, key->str);
+                       pat_ref_delete(ref, key->area);
                        HA_SPIN_UNLOCK(PATREF_LOCK, &ref->lock);
 
                        free_trash_chunk(key);
@@ -2686,14 +2697,15 @@ resume_execution:
                                return HTTP_RULE_RES_BADREQ;
 
                        /* collect key */
-                       key->len = build_logline(s, key->str, key->size, &rule->arg.map.key);
-                       key->str[key->len] = '\0';
+                       key->data = build_logline(s, key->area, key->size,
+                                                &rule->arg.map.key);
+                       key->area[key->data] = '\0';
 
                        /* perform update */
                        /* add entry only if it does not already exist */
                        HA_SPIN_LOCK(PATREF_LOCK, &ref->lock);
-                       if (pat_ref_find_elt(ref, key->str) == NULL)
-                               pat_ref_add(ref, key->str, NULL, NULL);
+                       if (pat_ref_find_elt(ref, key->area) == NULL)
+                               pat_ref_add(ref, key->area, NULL, NULL);
                        HA_SPIN_UNLOCK(PATREF_LOCK, &ref->lock);
 
                        free_trash_chunk(key);
@@ -2722,20 +2734,23 @@ resume_execution:
                        }
 
                        /* collect key */
-                       key->len = build_logline(s, key->str, key->size, &rule->arg.map.key);
-                       key->str[key->len] = '\0';
+                       key->data = build_logline(s, key->area, key->size,
+                                                &rule->arg.map.key);
+                       key->area[key->data] = '\0';
 
                        /* collect value */
-                       value->len = build_logline(s, value->str, value->size, &rule->arg.map.value);
-                       value->str[value->len] = '\0';
+                       value->data = build_logline(s, value->area,
+                                                  value->size,
+                                                  &rule->arg.map.value);
+                       value->area[value->data] = '\0';
 
                        /* perform update */
-                       if (pat_ref_find_elt(ref, key->str) != NULL)
+                       if (pat_ref_find_elt(ref, key->area) != NULL)
                                /* update entry if it exists */
-                               pat_ref_set(ref, key->str, value->str, NULL);
+                               pat_ref_set(ref, key->area, value->area, NULL);
                        else
                                /* insert a new entry */
-                               pat_ref_add(ref, key->str, value->str, NULL);
+                               pat_ref_add(ref, key->area, value->area, NULL);
 
                        free_trash_chunk(key);
                        free_trash_chunk(value);
@@ -2921,12 +2936,15 @@ resume_execution:
                                return HTTP_RULE_RES_BADREQ;
 
                        chunk_printf(replace, "%s: ", rule->arg.hdr_add.name);
-                       memcpy(replace->str, rule->arg.hdr_add.name, rule->arg.hdr_add.name_len);
-                       replace->len = rule->arg.hdr_add.name_len;
-                       replace->str[replace->len++] = ':';
-                       replace->str[replace->len++] = ' ';
-                       replace->len += build_logline(s, replace->str + replace->len, replace->size - replace->len,
-                                                     &rule->arg.hdr_add.fmt);
+                       memcpy(replace->area, rule->arg.hdr_add.name,
+                              rule->arg.hdr_add.name_len);
+                       replace->data = rule->arg.hdr_add.name_len;
+                       replace->area[replace->data++] = ':';
+                       replace->area[replace->data++] = ' ';
+                       replace->data += build_logline(s,
+                                                     replace->area + replace->data,
+                                                     replace->size - replace->data,
+                                                     &rule->arg.hdr_add.fmt);
 
                        if (rule->action == ACT_HTTP_SET_HDR) {
                                /* remove all occurrences of the header */
@@ -2937,12 +2955,13 @@ resume_execution:
                                }
                        }
 
-                       if (http_header_add_tail2(&txn->rsp, &txn->hdr_idx, replace->str, replace->len) < 0) {
+                       if (http_header_add_tail2(&txn->rsp, &txn->hdr_idx, replace->area, replace->data) < 0) {
                                static unsigned char rate_limit = 0;
 
                                if ((rate_limit++ & 255) == 0) {
-                                       replace->str[rule->arg.hdr_add.name_len] = 0;
-                                       send_log(px, LOG_WARNING, "Proxy %s failed to add or set the response header '%s' for request #%u. You might need to increase tune.maxrewrite.", px->id, replace->str, s->uniq_id);
+                                       replace->area[rule->arg.hdr_add.name_len] = 0;
+                                       send_log(px, LOG_WARNING, "Proxy %s failed to add or set the response header '%s' for request #%u. You might need to increase tune.maxrewrite.", px->id,
+                                                replace->area, s->uniq_id);
                                }
 
                                HA_ATOMIC_ADD(&sess->fe->fe_counters.failed_rewrites, 1);
@@ -2974,13 +2993,14 @@ resume_execution:
                                return HTTP_RULE_RES_BADREQ;
 
                        /* collect key */
-                       key->len = build_logline(s, key->str, key->size, &rule->arg.map.key);
-                       key->str[key->len] = '\0';
+                       key->data = build_logline(s, key->area, key->size,
+                                                &rule->arg.map.key);
+                       key->area[key->data] = '\0';
 
                        /* perform update */
                        /* returned code: 1=ok, 0=ko */
                        HA_SPIN_LOCK(PATREF_LOCK, &ref->lock);
-                       pat_ref_delete(ref, key->str);
+                       pat_ref_delete(ref, key->area);
                        HA_SPIN_UNLOCK(PATREF_LOCK, &ref->lock);
 
                        free_trash_chunk(key);
@@ -3002,13 +3022,14 @@ resume_execution:
                                return HTTP_RULE_RES_BADREQ;
 
                        /* collect key */
-                       key->len = build_logline(s, key->str, key->size, &rule->arg.map.key);
-                       key->str[key->len] = '\0';
+                       key->data = build_logline(s, key->area, key->size,
+                                                &rule->arg.map.key);
+                       key->area[key->data] = '\0';
 
                        /* perform update */
                        /* check if the entry already exists */
-                       if (pat_ref_find_elt(ref, key->str) == NULL)
-                               pat_ref_add(ref, key->str, NULL, NULL);
+                       if (pat_ref_find_elt(ref, key->area) == NULL)
+                               pat_ref_add(ref, key->area, NULL, NULL);
 
                        free_trash_chunk(key);
                        break;
@@ -3036,21 +3057,24 @@ resume_execution:
                        }
 
                        /* collect key */
-                       key->len = build_logline(s, key->str, key->size, &rule->arg.map.key);
-                       key->str[key->len] = '\0';
+                       key->data = build_logline(s, key->area, key->size,
+                                                &rule->arg.map.key);
+                       key->area[key->data] = '\0';
 
                        /* collect value */
-                       value->len = build_logline(s, value->str, value->size, &rule->arg.map.value);
-                       value->str[value->len] = '\0';
+                       value->data = build_logline(s, value->area,
+                                                  value->size,
+                                                  &rule->arg.map.value);
+                       value->area[value->data] = '\0';
 
                        /* perform update */
                        HA_SPIN_LOCK(PATREF_LOCK, &ref->lock);
-                       if (pat_ref_find_elt(ref, key->str) != NULL)
+                       if (pat_ref_find_elt(ref, key->area) != NULL)
                                /* update entry if it exists */
-                               pat_ref_set(ref, key->str, value->str, NULL);
+                               pat_ref_set(ref, key->area, value->area, NULL);
                        else
                                /* insert a new entry */
-                               pat_ref_add(ref, key->str, value->str, NULL);
+                               pat_ref_add(ref, key->area, value->area, NULL);
                        HA_SPIN_UNLOCK(PATREF_LOCK, &ref->lock);
                        free_trash_chunk(key);
                        free_trash_chunk(value);
@@ -3228,40 +3252,44 @@ static int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s
 
                if (rule->rdr_str) { /* this is an old "redirect" rule */
                        /* check if we can add scheme + "://" + host + path */
-                       if (chunk->len + rule->rdr_len + 3 + hostlen + pathlen > chunk->size - 4)
+                       if (chunk->data + rule->rdr_len + 3 + hostlen + pathlen > chunk->size - 4)
                                goto leave;
 
                        /* add scheme */
-                       memcpy(chunk->str + chunk->len, rule->rdr_str, rule->rdr_len);
-                       chunk->len += rule->rdr_len;
+                       memcpy(chunk->area + chunk->data, rule->rdr_str,
+                              rule->rdr_len);
+                       chunk->data += rule->rdr_len;
                }
                else {
                        /* add scheme with executing log format */
-                       chunk->len += build_logline(s, chunk->str + chunk->len, chunk->size - chunk->len, &rule->rdr_fmt);
+                       chunk->data += build_logline(s,
+                                                   chunk->area + chunk->data,
+                                                   chunk->size - chunk->data,
+                                                   &rule->rdr_fmt);
 
                        /* check if we can add scheme + "://" + host + path */
-                       if (chunk->len + 3 + hostlen + pathlen > chunk->size - 4)
+                       if (chunk->data + 3 + hostlen + pathlen > chunk->size - 4)
                                goto leave;
                }
                /* add "://" */
-               memcpy(chunk->str + chunk->len, "://", 3);
-               chunk->len += 3;
+               memcpy(chunk->area + chunk->data, "://", 3);
+               chunk->data += 3;
 
                /* add host */
-               memcpy(chunk->str + chunk->len, host, hostlen);
-               chunk->len += hostlen;
+               memcpy(chunk->area + chunk->data, host, hostlen);
+               chunk->data += hostlen;
 
                /* add path */
-               memcpy(chunk->str + chunk->len, path, pathlen);
-               chunk->len += pathlen;
+               memcpy(chunk->area + chunk->data, path, pathlen);
+               chunk->data += pathlen;
 
                /* append a slash at the end of the location if needed and missing */
-               if (chunk->len && chunk->str[chunk->len - 1] != '/' &&
+               if (chunk->data && chunk->area[chunk->data - 1] != '/' &&
                    (rule->flags & REDIRECT_FLAG_APPEND_SLASH)) {
-                       if (chunk->len > chunk->size - 5)
+                       if (chunk->data > chunk->size - 5)
                                goto leave;
-                       chunk->str[chunk->len] = '/';
-                       chunk->len++;
+                       chunk->area[chunk->data] = '/';
+                       chunk->data++;
                }
 
                break;
@@ -3290,7 +3318,7 @@ static int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s
                }
 
                if (rule->rdr_str) { /* this is an old "redirect" rule */
-                       if (chunk->len + rule->rdr_len + pathlen > chunk->size - 4)
+                       if (chunk->data + rule->rdr_len + pathlen > chunk->size - 4)
                                goto leave;
 
                        /* add prefix. Note that if prefix == "/", we don't want to
@@ -3298,30 +3326,34 @@ static int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s
                         * configure a self-redirection.
                         */
                        if (rule->rdr_len != 1 || *rule->rdr_str != '/') {
-                               memcpy(chunk->str + chunk->len, rule->rdr_str, rule->rdr_len);
-                               chunk->len += rule->rdr_len;
+                               memcpy(chunk->area + chunk->data,
+                                      rule->rdr_str, rule->rdr_len);
+                               chunk->data += rule->rdr_len;
                        }
                }
                else {
                        /* add prefix with executing log format */
-                       chunk->len += build_logline(s, chunk->str + chunk->len, chunk->size - chunk->len, &rule->rdr_fmt);
+                       chunk->data += build_logline(s,
+                                                   chunk->area + chunk->data,
+                                                   chunk->size - chunk->data,
+                                                   &rule->rdr_fmt);
 
                        /* Check length */
-                       if (chunk->len + pathlen > chunk->size - 4)
+                       if (chunk->data + pathlen > chunk->size - 4)
                                goto leave;
                }
 
                /* add path */
-               memcpy(chunk->str + chunk->len, path, pathlen);
-               chunk->len += pathlen;
+               memcpy(chunk->area + chunk->data, path, pathlen);
+               chunk->data += pathlen;
 
                /* append a slash at the end of the location if needed and missing */
-               if (chunk->len && chunk->str[chunk->len - 1] != '/' &&
+               if (chunk->data && chunk->area[chunk->data - 1] != '/' &&
                    (rule->flags & REDIRECT_FLAG_APPEND_SLASH)) {
-                       if (chunk->len > chunk->size - 5)
+                       if (chunk->data > chunk->size - 5)
                                goto leave;
-                       chunk->str[chunk->len] = '/';
-                       chunk->len++;
+                       chunk->area[chunk->data] = '/';
+                       chunk->data++;
                }
 
                break;
@@ -3329,29 +3361,34 @@ static int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s
        case REDIRECT_TYPE_LOCATION:
        default:
                if (rule->rdr_str) { /* this is an old "redirect" rule */
-                       if (chunk->len + rule->rdr_len > chunk->size - 4)
+                       if (chunk->data + rule->rdr_len > chunk->size - 4)
                                goto leave;
 
                        /* add location */
-                       memcpy(chunk->str + chunk->len, rule->rdr_str, rule->rdr_len);
-                       chunk->len += rule->rdr_len;
+                       memcpy(chunk->area + chunk->data, rule->rdr_str,
+                              rule->rdr_len);
+                       chunk->data += rule->rdr_len;
                }
                else {
                        /* add location with executing log format */
-                       chunk->len += build_logline(s, chunk->str + chunk->len, chunk->size - chunk->len, &rule->rdr_fmt);
+                       chunk->data += build_logline(s,
+                                                   chunk->area + chunk->data,
+                                                   chunk->size - chunk->data,
+                                                   &rule->rdr_fmt);
 
                        /* Check left length */
-                       if (chunk->len > chunk->size - 4)
+                       if (chunk->data > chunk->size - 4)
                                goto leave;
                }
                break;
        }
 
        if (rule->cookie_len) {
-               memcpy(chunk->str + chunk->len, "\r\nSet-Cookie: ", 14);
-               chunk->len += 14;
-               memcpy(chunk->str + chunk->len, rule->cookie_str, rule->cookie_len);
-               chunk->len += rule->cookie_len;
+               memcpy(chunk->area + chunk->data, "\r\nSet-Cookie: ", 14);
+               chunk->data += 14;
+               memcpy(chunk->area + chunk->data, rule->cookie_str,
+                      rule->cookie_len);
+               chunk->data += rule->cookie_len;
        }
 
        /* add end of headers and the keep-alive/close status. */
@@ -3365,17 +3402,19 @@ static int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s
                /* keep-alive possible */
                if (!(req->flags & HTTP_MSGF_VER_11)) {
                        if (unlikely(txn->flags & TX_USE_PX_CONN)) {
-                               memcpy(chunk->str + chunk->len, "\r\nProxy-Connection: keep-alive", 30);
-                               chunk->len += 30;
+                               memcpy(chunk->area + chunk->data,
+                                      "\r\nProxy-Connection: keep-alive", 30);
+                               chunk->data += 30;
                        } else {
-                               memcpy(chunk->str + chunk->len, "\r\nConnection: keep-alive", 24);
-                               chunk->len += 24;
+                               memcpy(chunk->area + chunk->data,
+                                      "\r\nConnection: keep-alive", 24);
+                               chunk->data += 24;
                        }
                }
-               memcpy(chunk->str + chunk->len, "\r\n\r\n", 4);
-               chunk->len += 4;
+               memcpy(chunk->area + chunk->data, "\r\n\r\n", 4);
+               chunk->data += 4;
                FLT_STRM_CB(s, flt_http_reply(s, txn->status, chunk));
-               co_inject(res->chn, chunk->str, chunk->len);
+               co_inject(res->chn, chunk->area, chunk->data);
                /* "eat" the request */
                b_del(&req->chn->buf, req->sov);
                req->next -= req->sov;
@@ -3392,11 +3431,13 @@ static int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s
        } else {
                /* keep-alive not possible */
                if (unlikely(txn->flags & TX_USE_PX_CONN)) {
-                       memcpy(chunk->str + chunk->len, "\r\nProxy-Connection: close\r\n\r\n", 29);
-                       chunk->len += 29;
+                       memcpy(chunk->area + chunk->data,
+                              "\r\nProxy-Connection: close\r\n\r\n", 29);
+                       chunk->data += 29;
                } else {
-                       memcpy(chunk->str + chunk->len, "\r\nConnection: close\r\n\r\n", 23);
-                       chunk->len += 23;
+                       memcpy(chunk->area + chunk->data,
+                              "\r\nConnection: close\r\n\r\n", 23);
+                       chunk->data += 23;
                }
                http_reply_and_close(s, txn->status, chunk);
                req->chn->analysers &= AN_REQ_FLT_END;
@@ -3805,9 +3846,9 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
 
        if (sess->fe->header_unique_id && s->unique_id) {
                chunk_printf(&trash, "%s: %s", sess->fe->header_unique_id, s->unique_id);
-               if (trash.len < 0)
+               if (trash.data < 0)
                        goto return_bad_req;
-               if (unlikely(http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.str, trash.len) < 0))
+               if (unlikely(http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.area, trash.data) < 0))
                   goto return_bad_req;
        }
 
@@ -3846,14 +3887,19 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
                                 */
                                if (s->be->fwdfor_hdr_len) {
                                        len = s->be->fwdfor_hdr_len;
-                                       memcpy(trash.str, s->be->fwdfor_hdr_name, len);
+                                       memcpy(trash.area,
+                                              s->be->fwdfor_hdr_name, len);
                                } else {
                                        len = sess->fe->fwdfor_hdr_len;
-                                       memcpy(trash.str, sess->fe->fwdfor_hdr_name, len);
+                                       memcpy(trash.area,
+                                              sess->fe->fwdfor_hdr_name, len);
                                }
-                               len += snprintf(trash.str + len, trash.size - len, ": %d.%d.%d.%d", pn[0], pn[1], pn[2], pn[3]);
+                               len += snprintf(trash.area + len,
+                                               trash.size - len,
+                                               ": %d.%d.%d.%d", pn[0], pn[1],
+                                               pn[2], pn[3]);
 
-                               if (unlikely(http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.str, len) < 0))
+                               if (unlikely(http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.area, len) < 0))
                                        goto return_bad_req;
                        }
                }
@@ -3874,14 +3920,17 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
                         */
                        if (s->be->fwdfor_hdr_len) {
                                len = s->be->fwdfor_hdr_len;
-                               memcpy(trash.str, s->be->fwdfor_hdr_name, len);
+                               memcpy(trash.area, s->be->fwdfor_hdr_name,
+                                      len);
                        } else {
                                len = sess->fe->fwdfor_hdr_len;
-                               memcpy(trash.str, sess->fe->fwdfor_hdr_name, len);
+                               memcpy(trash.area, sess->fe->fwdfor_hdr_name,
+                                      len);
                        }
-                       len += snprintf(trash.str + len, trash.size - len, ": %s", pn);
+                       len += snprintf(trash.area + len, trash.size - len,
+                                       ": %s", pn);
 
-                       if (unlikely(http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.str, len) < 0))
+                       if (unlikely(http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.area, len) < 0))
                                goto return_bad_req;
                }
        }
@@ -3917,14 +3966,19 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
                                 */
                                if (s->be->orgto_hdr_len) {
                                        len = s->be->orgto_hdr_len;
-                                       memcpy(trash.str, s->be->orgto_hdr_name, len);
+                                       memcpy(trash.area,
+                                              s->be->orgto_hdr_name, len);
                                } else {
                                        len = sess->fe->orgto_hdr_len;
-                                       memcpy(trash.str, sess->fe->orgto_hdr_name, len);
+                                       memcpy(trash.area,
+                                              sess->fe->orgto_hdr_name, len);
                                }
-                               len += snprintf(trash.str + len, trash.size - len, ": %d.%d.%d.%d", pn[0], pn[1], pn[2], pn[3]);
+                               len += snprintf(trash.area + len,
+                                               trash.size - len,
+                                               ": %d.%d.%d.%d", pn[0], pn[1],
+                                               pn[2], pn[3]);
 
-                               if (unlikely(http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.str, len) < 0))
+                               if (unlikely(http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.area, len) < 0))
                                        goto return_bad_req;
                        }
                }
@@ -4097,7 +4151,9 @@ int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit
                                /* Expect is allowed in 1.1, look for it */
                                if (http_find_header2("Expect", 6, ci_head(req), &txn->hdr_idx, &ctx) &&
                                    unlikely(ctx.vlen == 12 && strncasecmp(ctx.line+ctx.val, "100-continue", 12) == 0)) {
-                                       co_inject(&s->res, http_100_chunk.str, http_100_chunk.len);
+                                       co_inject(&s->res,
+                                                 http_100_chunk.area,
+                                                 http_100_chunk.data);
                                        http_remove_header2(&txn->req, &txn->hdr_idx, &ctx);
                                }
                        }
@@ -4255,13 +4311,15 @@ int http_send_name_header(struct http_txn *txn, struct proxy* be, const char* sr
        }
 
        /* Add the new header requested with the server value */
-       hdr_val = trash.str;
+       hdr_val = trash.area;
        memcpy(hdr_val, hdr_name, hdr_name_len);
        hdr_val += hdr_name_len;
        *hdr_val++ = ':';
        *hdr_val++ = ' ';
-       hdr_val += strlcpy2(hdr_val, srv_name, trash.str + trash.size - hdr_val);
-       http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.str, hdr_val - trash.str);
+       hdr_val += strlcpy2(hdr_val, srv_name,
+                           trash.area + trash.size - hdr_val);
+       http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.area,
+                             hdr_val - trash.area);
 
        if (old_o) {
                /* If this was a forwarded request, we must readjust the amount of
@@ -5131,7 +5189,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
 
                if (unlikely(ci_tail(rep) < c_ptr(rep, msg->next) ||
                             ci_tail(rep) > b_wrap(&rep->buf) - global.tune.maxrewrite))
-                       channel_slow_realign(rep, trash.str);
+                       channel_slow_realign(rep, trash.area);
 
                if (likely(msg->next < ci_data(rep)))
                        http_msg_analyzer(msg, &txn->hdr_idx);
@@ -5897,19 +5955,21 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
 
                        if (s->be->cookie_maxidle || s->be->cookie_maxlife) {
                                /* emit last_date, which is mandatory */
-                               trash.str[trash.len++] = COOKIE_DELIM_DATE;
-                               s30tob64((date.tv_sec+3) >> 2, trash.str + trash.len);
-                               trash.len += 5;
+                               trash.area[trash.data++] = COOKIE_DELIM_DATE;
+                               s30tob64((date.tv_sec+3) >> 2,
+                                        trash.area + trash.data);
+                               trash.data += 5;
 
                                if (s->be->cookie_maxlife) {
                                        /* emit first_date, which is either the original one or
                                         * the current date.
                                         */
-                                       trash.str[trash.len++] = COOKIE_DELIM_DATE;
+                                       trash.area[trash.data++] = COOKIE_DELIM_DATE;
                                        s30tob64(txn->cookie_first_date ?
                                                 txn->cookie_first_date >> 2 :
-                                                (date.tv_sec+3) >> 2, trash.str + trash.len);
-                                       trash.len += 5;
+                                                (date.tv_sec+3) >> 2,
+                                                trash.area + trash.data);
+                                       trash.data += 5;
                                }
                        }
                        chunk_appendf(&trash, "; path=/");
@@ -5924,7 +5984,7 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
                if (s->be->ck_opts & PR_CK_SECURE)
                        chunk_appendf(&trash, "; Secure");
 
-               if (unlikely(http_header_add_tail2(&txn->rsp, &txn->hdr_idx, trash.str, trash.len) < 0))
+               if (unlikely(http_header_add_tail2(&txn->rsp, &txn->hdr_idx, trash.area, trash.data) < 0))
                        goto return_bad_resp;
 
                txn->flags &= ~TX_SCK_MASK;
@@ -6512,11 +6572,14 @@ int apply_filter_to_req_headers(struct stream *s, struct channel *req, struct hd
                                break;
 
                        case ACT_REPLACE:
-                               trash.len = exp_replace(trash.str, trash.size, cur_ptr, exp->replace, pmatch);
-                               if (trash.len < 0)
+                               trash.data = exp_replace(trash.area,
+                                                       trash.size, cur_ptr,
+                                                       exp->replace, pmatch);
+                               if (trash.data < 0)
                                        return -1;
 
-                               delta = b_rep_blk(&req->buf, cur_ptr, cur_end, trash.str, trash.len);
+                               delta = b_rep_blk(&req->buf, cur_ptr, cur_end,
+                                                 trash.area, trash.data);
                                /* FIXME: if the user adds a newline in the replacement, the
                                 * index will not be recalculated for now, and the new line
                                 * will not be counted as a new header.
@@ -6600,11 +6663,13 @@ int apply_filter_to_req_line(struct stream *s, struct channel *req, struct hdr_e
                        break;
 
                case ACT_REPLACE:
-                       trash.len = exp_replace(trash.str, trash.size, cur_ptr, exp->replace, pmatch);
-                       if (trash.len < 0)
+                       trash.data = exp_replace(trash.area, trash.size,
+                                               cur_ptr, exp->replace, pmatch);
+                       if (trash.data < 0)
                                return -1;
 
-                       delta = b_rep_blk(&req->buf, cur_ptr, cur_end, trash.str, trash.len);
+                       delta = b_rep_blk(&req->buf, cur_ptr, cur_end,
+                                         trash.area, trash.data);
                        /* FIXME: if the user adds a newline in the replacement, the
                         * index will not be recalculated for now, and the new line
                         * will not be counted as a new header.
@@ -7248,11 +7313,14 @@ int apply_filter_to_resp_headers(struct stream *s, struct channel *rtr, struct h
                                break;
 
                        case ACT_REPLACE:
-                               trash.len = exp_replace(trash.str, trash.size, cur_ptr, exp->replace, pmatch);
-                               if (trash.len < 0)
+                               trash.data = exp_replace(trash.area,
+                                                       trash.size, cur_ptr,
+                                                       exp->replace, pmatch);
+                               if (trash.data < 0)
                                        return -1;
 
-                               delta = b_rep_blk(&rtr->buf, cur_ptr, cur_end, trash.str, trash.len);
+                               delta = b_rep_blk(&rtr->buf, cur_ptr, cur_end,
+                                                 trash.area, trash.data);
                                /* FIXME: if the user adds a newline in the replacement, the
                                 * index will not be recalculated for now, and the new line
                                 * will not be counted as a new header.
@@ -7329,11 +7397,13 @@ int apply_filter_to_sts_line(struct stream *s, struct channel *rtr, struct hdr_e
                        break;
 
                case ACT_REPLACE:
-                       trash.len = exp_replace(trash.str, trash.size, cur_ptr, exp->replace, pmatch);
-                       if (trash.len < 0)
+                       trash.data = exp_replace(trash.area, trash.size,
+                                               cur_ptr, exp->replace, pmatch);
+                       if (trash.data < 0)
                                return -1;
 
-                       delta = b_rep_blk(&rtr->buf, cur_ptr, cur_end, trash.str, trash.len);
+                       delta = b_rep_blk(&rtr->buf, cur_ptr, cur_end,
+                                         trash.area, trash.data);
                        /* FIXME: if the user adds a newline in the replacement, the
                         * index will not be recalculated for now, and the new line
                         * will not be counted as a new header.
@@ -8009,11 +8079,11 @@ void http_capture_bad_message(struct proxy *proxy, struct error_snapshot *es, st
  */
 unsigned int http_get_hdr(const struct http_msg *msg, const char *hname, int hlen,
                          struct hdr_idx *idx, int occ,
-                         struct hdr_ctx *ctx, char **vptr, int *vlen)
+                         struct hdr_ctx *ctx, char **vptr, size_t *vlen)
 {
        struct hdr_ctx local_ctx;
        char *ptr_hist[MAX_HDR_HISTORY];
-       int len_hist[MAX_HDR_HISTORY];
+       unsigned int len_hist[MAX_HDR_HISTORY];
        unsigned int hist_ptr;
        int found;
 
@@ -8075,11 +8145,11 @@ unsigned int http_get_hdr(const struct http_msg *msg, const char *hname, int hle
  */
 unsigned int http_get_fhdr(const struct http_msg *msg, const char *hname, int hlen,
                           struct hdr_idx *idx, int occ,
-                          struct hdr_ctx *ctx, char **vptr, int *vlen)
+                          struct hdr_ctx *ctx, char **vptr, size_t *vlen)
 {
        struct hdr_ctx local_ctx;
        char *ptr_hist[MAX_HDR_HISTORY];
-       int len_hist[MAX_HDR_HISTORY];
+       unsigned int len_hist[MAX_HDR_HISTORY];
        unsigned int hist_ptr;
        int found;
 
@@ -8148,10 +8218,10 @@ void debug_hdr(const char *dir, struct stream *s, const char *start, const char
                if (start[max] == '\r' || start[max] == '\n')
                        break;
 
-       UBOUND(max, trash.size - trash.len - 3);
-       trash.len += strlcpy2(trash.str + trash.len, start, max + 1);
-       trash.str[trash.len++] = '\n';
-       shut_your_big_mouth_gcc(write(1, trash.str, trash.len));
+       UBOUND(max, trash.size - trash.data - 3);
+       trash.data += strlcpy2(trash.area + trash.data, start, max + 1);
+       trash.area[trash.data++] = '\n';
+       shut_your_big_mouth_gcc(write(1, trash.area, trash.data));
 }
 
 
@@ -8816,7 +8886,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
                         "'tarpit', 'add-header', 'set-header', 'replace-header', 'replace-value', 'set-nice', "
                         "'set-tos', 'set-mark', 'set-log-level', 'add-acl', 'del-acl', 'del-map', 'set-map', 'track-sc*'"
                         "%s%s, but got '%s'%s.\n",
-                        file, linenum, *trash.str ? ", " : "", trash.str, args[0], *args[0] ? "" : " (missing argument)");
+                        file, linenum, *trash.area ? ", " : "", trash.area,
+                        args[0], *args[0] ? "" : " (missing argument)");
                goto out_err;
        }
 
@@ -9268,7 +9339,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
                         "'add-header', 'del-header', 'set-header', 'replace-header', 'replace-value', 'set-nice', "
                         "'set-tos', 'set-mark', 'set-log-level', 'add-acl', 'del-acl', 'del-map', 'set-map', 'track-sc*'"
                         "%s%s, but got '%s'%s.\n",
-                        file, linenum, *trash.str ? ", " : "", trash.str, args[0], *args[0] ? "" : " (missing argument)");
+                        file, linenum, *trash.area ? ", " : "", trash.area,
+                        args[0], *args[0] ? "" : " (missing argument)");
                goto out_err;
        }
 
@@ -9509,7 +9581,7 @@ int smp_prefetch_http(struct proxy *px, struct stream *s, unsigned int opt,
                 */
                if (ci_head(&s->req) > b_orig(&s->req.buf) &&
                    ci_head(&s->req) + ci_data(&s->req) > b_wrap(&s->req.buf) - global.tune.maxrewrite)
-                       channel_slow_realign(&s->req, trash.str);
+                       channel_slow_realign(&s->req, trash.area);
 
                if (unlikely(txn->req.msg_state < HTTP_MSG_BODY)) {
                        if (msg->msg_state == HTTP_MSG_ERROR)
@@ -9623,8 +9695,8 @@ smp_fetch_meth(const struct arg *args, struct sample *smp, const char *kw, void
                        /* ensure the indexes are not affected */
                        return 0;
                smp->flags |= SMP_F_CONST;
-               smp->data.u.meth.str.len = txn->req.sl.rq.m_l;
-               smp->data.u.meth.str.str = ci_head(txn->req.chn);
+               smp->data.u.meth.str.data = txn->req.sl.rq.m_l;
+               smp->data.u.meth.str.area = ci_head(txn->req.chn);
        }
        smp->flags |= SMP_F_VOL_1ST;
        return 1;
@@ -9649,12 +9721,12 @@ static struct pattern *pat_match_meth(struct sample *smp, struct pattern_expr *e
                }
 
                /* Other method, we must compare the strings */
-               if (pattern->len != smp->data.u.meth.str.len)
+               if (pattern->len != smp->data.u.meth.str.data)
                        continue;
 
                icase = expr->mflags & PAT_MF_IGNORE_CASE;
-               if ((icase && strncasecmp(pattern->ptr.str, smp->data.u.meth.str.str, smp->data.u.meth.str.len) == 0) ||
-                   (!icase && strncmp(pattern->ptr.str, smp->data.u.meth.str.str, smp->data.u.meth.str.len) == 0))
+               if ((icase && strncasecmp(pattern->ptr.str, smp->data.u.meth.str.area, smp->data.u.meth.str.data) == 0) ||
+                   (!icase && strncmp(pattern->ptr.str, smp->data.u.meth.str.area, smp->data.u.meth.str.data) == 0))
                        return pattern;
        }
        return NULL;
@@ -9678,8 +9750,8 @@ smp_fetch_rqver(const struct arg *args, struct sample *smp, const char *kw, void
                return 0;
 
        smp->data.type = SMP_T_STR;
-       smp->data.u.str.str = ptr;
-       smp->data.u.str.len = len;
+       smp->data.u.str.area = ptr;
+       smp->data.u.str.data = len;
 
        smp->flags = SMP_F_VOL_1ST | SMP_F_CONST;
        return 1;
@@ -9706,8 +9778,8 @@ smp_fetch_stver(const struct arg *args, struct sample *smp, const char *kw, void
                return 0;
 
        smp->data.type = SMP_T_STR;
-       smp->data.u.str.str = ptr;
-       smp->data.u.str.len = len;
+       smp->data.u.str.area = ptr;
+       smp->data.u.str.data = len;
 
        smp->flags = SMP_F_VOL_1ST | SMP_F_CONST;
        return 1;
@@ -9747,11 +9819,11 @@ smp_fetch_uniqueid(const struct arg *args, struct sample *smp, const char *kw, v
                        return 0;
                smp->strm->unique_id[0] = '\0';
        }
-       smp->data.u.str.len = build_logline(smp->strm, smp->strm->unique_id,
+       smp->data.u.str.data = build_logline(smp->strm, smp->strm->unique_id,
                                            UNIQUEID_LEN, &smp->sess->fe->format_unique_id);
 
        smp->data.type = SMP_T_STR;
-       smp->data.u.str.str = smp->strm->unique_id;
+       smp->data.u.str.area = smp->strm->unique_id;
        smp->flags = SMP_F_CONST;
        return 1;
 }
@@ -9774,8 +9846,8 @@ smp_fetch_hdrs(const struct arg *args, struct sample *smp, const char *kw, void
        msg = &txn->req;
 
        smp->data.type = SMP_T_STR;
-       smp->data.u.str.str = ci_head(msg->chn) + hdr_idx_first_pos(idx);
-       smp->data.u.str.len = msg->eoh - hdr_idx_first_pos(idx) + 1 +
+       smp->data.u.str.area = ci_head(msg->chn) + hdr_idx_first_pos(idx);
+       smp->data.u.str.data = msg->eoh - hdr_idx_first_pos(idx) + 1 +
                              (ci_head(msg->chn)[msg->eoh] == '\r');
 
        return 1;
@@ -9813,8 +9885,8 @@ smp_fetch_hdrs_bin(const struct arg *args, struct sample *smp, const char *kw, v
        CHECK_HTTP_MESSAGE_FIRST();
 
        temp = get_trash_chunk();
-       buf = temp->str;
-       end = temp->str + temp->size;
+       buf = temp->area;
+       end = temp->area + temp->size;
 
        txn = smp->strm->txn;
        idx = &txn->hdr_idx;
@@ -9884,8 +9956,8 @@ smp_fetch_hdrs_bin(const struct arg *args, struct sample *smp, const char *kw, v
 
        /* Initialise sample data which will be filled. */
        smp->data.type = SMP_T_BIN;
-       smp->data.u.str.str = temp->str;
-       smp->data.u.str.len = buf - temp->str;
+       smp->data.u.str.area = temp->area;
+       smp->data.u.str.data = buf - temp->area;
        smp->data.u.str.size = temp->size;
 
        return 1;
@@ -9920,18 +9992,19 @@ smp_fetch_body(const struct arg *args, struct sample *smp, const char *kw, void
        if (block1 == len) {
                /* buffer is not wrapped (or empty) */
                smp->data.type = SMP_T_BIN;
-               smp->data.u.str.str = body;
-               smp->data.u.str.len = len;
+               smp->data.u.str.area = body;
+               smp->data.u.str.data = len;
                smp->flags = SMP_F_VOL_TEST | SMP_F_CONST;
        }
        else {
                /* buffer is wrapped, we need to defragment it */
                temp = get_trash_chunk();
-               memcpy(temp->str, body, block1);
-               memcpy(temp->str + block1, b_orig(&msg->chn->buf), len - block1);
+               memcpy(temp->area, body, block1);
+               memcpy(temp->area + block1, b_orig(&msg->chn->buf),
+                      len - block1);
                smp->data.type = SMP_T_BIN;
-               smp->data.u.str.str = temp->str;
-               smp->data.u.str.len = len;
+               smp->data.u.str.area = temp->area;
+               smp->data.u.str.data = len;
                smp->flags = SMP_F_VOL_TEST;
        }
        return 1;
@@ -9995,8 +10068,8 @@ smp_fetch_url(const struct arg *args, struct sample *smp, const char *kw, void *
 
        txn = smp->strm->txn;
        smp->data.type = SMP_T_STR;
-       smp->data.u.str.len = txn->req.sl.rq.u_l;
-       smp->data.u.str.str = ci_head(txn->req.chn) + txn->req.sl.rq.u;
+       smp->data.u.str.data = txn->req.sl.rq.u_l;
+       smp->data.u.str.area = ci_head(txn->req.chn) + txn->req.sl.rq.u;
        smp->flags = SMP_F_VOL_1ST | SMP_F_CONST;
        return 1;
 }
@@ -10066,8 +10139,8 @@ smp_fetch_fhdr(const struct arg *args, struct sample *smp, const char *kw, void
        if (args) {
                if (args[0].type != ARGT_STR)
                        return 0;
-               name_str = args[0].data.str.str;
-               name_len = args[0].data.str.len;
+               name_str = args[0].data.str.area;
+               name_len = args[0].data.str.data;
 
                if (args[1].type == ARGT_SINT)
                        occ = args[1].data.sint;
@@ -10092,7 +10165,7 @@ smp_fetch_fhdr(const struct arg *args, struct sample *smp, const char *kw, void
 
        smp->data.type = SMP_T_STR;
        smp->flags |= SMP_F_VOL_HDR | SMP_F_CONST;
-       if (http_get_fhdr(msg, name_str, name_len, idx, occ, ctx, &smp->data.u.str.str, &smp->data.u.str.len))
+       if (http_get_fhdr(msg, name_str, name_len, idx, occ, ctx, &smp->data.u.str.area, &smp->data.u.str.data))
                return 1;
 
        smp->flags &= ~SMP_F_NOT_LAST;
@@ -10114,8 +10187,8 @@ smp_fetch_fhdr_cnt(const struct arg *args, struct sample *smp, const char *kw, v
        int len = 0;
 
        if (args && args->type == ARGT_STR) {
-               name = args->data.str.str;
-               len = args->data.str.len;
+               name = args->data.str.area;
+               len = args->data.str.data;
        }
 
        CHECK_HTTP_MESSAGE_FIRST();
@@ -10144,7 +10217,7 @@ smp_fetch_hdr_names(const struct arg *args, struct sample *smp, const char *kw,
        char del = ',';
 
        if (args && args->type == ARGT_STR)
-               del = *args[0].data.str.str;
+               del = *args[0].data.str.area;
 
        CHECK_HTTP_MESSAGE_FIRST();
 
@@ -10155,15 +10228,15 @@ smp_fetch_hdr_names(const struct arg *args, struct sample *smp, const char *kw,
 
        ctx.idx = 0;
        while (http_find_next_header(ci_head(msg->chn), idx, &ctx)) {
-               if (temp->len)
-                       temp->str[temp->len++] = del;
-               memcpy(temp->str + temp->len, ctx.line, ctx.del);
-               temp->len += ctx.del;
+               if (temp->data)
+                       temp->area[temp->data++] = del;
+               memcpy(temp->area + temp->data, ctx.line, ctx.del);
+               temp->data += ctx.del;
        }
 
        smp->data.type = SMP_T_STR;
-       smp->data.u.str.str = temp->str;
-       smp->data.u.str.len = temp->len;
+       smp->data.u.str.area = temp->area;
+       smp->data.u.str.data = temp->data;
        smp->flags = SMP_F_VOL_HDR;
        return 1;
 }
@@ -10194,8 +10267,8 @@ smp_fetch_hdr(const struct arg *args, struct sample *smp, const char *kw, void *
        if (args) {
                if (args[0].type != ARGT_STR)
                        return 0;
-               name_str = args[0].data.str.str;
-               name_len = args[0].data.str.len;
+               name_str = args[0].data.str.area;
+               name_len = args[0].data.str.data;
 
                if (args[1].type == ARGT_SINT)
                        occ = args[1].data.sint;
@@ -10220,7 +10293,7 @@ smp_fetch_hdr(const struct arg *args, struct sample *smp, const char *kw, void *
 
        smp->data.type = SMP_T_STR;
        smp->flags |= SMP_F_VOL_HDR | SMP_F_CONST;
-       if (http_get_hdr(msg, name_str, name_len, idx, occ, ctx, &smp->data.u.str.str, &smp->data.u.str.len))
+       if (http_get_hdr(msg, name_str, name_len, idx, occ, ctx, &smp->data.u.str.area, &smp->data.u.str.data))
                return 1;
 
        smp->flags &= ~SMP_F_NOT_LAST;
@@ -10241,8 +10314,8 @@ smp_fetch_hdr_cnt(const struct arg *args, struct sample *smp, const char *kw, vo
        int len = 0;
 
        if (args && args->type == ARGT_STR) {
-               name = args->data.str.str;
-               len = args->data.str.len;
+               name = args->data.str.area;
+               len = args->data.str.data;
        }
 
        CHECK_HTTP_MESSAGE_FIRST();
@@ -10273,7 +10346,8 @@ smp_fetch_hdr_val(const struct arg *args, struct sample *smp, const char *kw, vo
 
        if (ret > 0) {
                smp->data.type = SMP_T_SINT;
-               smp->data.u.sint = strl2ic(smp->data.u.str.str, smp->data.u.str.len);
+               smp->data.u.sint = strl2ic(smp->data.u.str.area,
+                                          smp->data.u.str.data);
        }
 
        return ret;
@@ -10289,15 +10363,16 @@ smp_fetch_hdr_ip(const struct arg *args, struct sample *smp, const char *kw, voi
        int ret;
 
        while ((ret = smp_fetch_hdr(args, smp, kw, private)) > 0) {
-               if (url2ipv4((char *)smp->data.u.str.str, &smp->data.u.ipv4)) {
+               if (url2ipv4((char *) smp->data.u.str.area, &smp->data.u.ipv4)) {
                        smp->data.type = SMP_T_IPV4;
                        break;
                } else {
                        struct chunk *temp = get_trash_chunk();
-                       if (smp->data.u.str.len < temp->size - 1) {
-                               memcpy(temp->str, smp->data.u.str.str, smp->data.u.str.len);
-                               temp->str[smp->data.u.str.len] = '\0';
-                               if (inet_pton(AF_INET6, temp->str, &smp->data.u.ipv6)) {
+                       if (smp->data.u.str.data < temp->size - 1) {
+                               memcpy(temp->area, smp->data.u.str.area,
+                                      smp->data.u.str.data);
+                               temp->area[smp->data.u.str.data] = '\0';
+                               if (inet_pton(AF_INET6, temp->area, &smp->data.u.ipv6)) {
                                        smp->data.type = SMP_T_IPV6;
                                        break;
                                }
@@ -10330,12 +10405,12 @@ smp_fetch_path(const struct arg *args, struct sample *smp, const char *kw, void
 
        /* OK, we got the '/' ! */
        smp->data.type = SMP_T_STR;
-       smp->data.u.str.str = ptr;
+       smp->data.u.str.area = ptr;
 
        while (ptr < end && *ptr != '?')
                ptr++;
 
-       smp->data.u.str.len = ptr - smp->data.u.str.str;
+       smp->data.u.str.data = ptr - smp->data.u.str.area;
        smp->flags = SMP_F_VOL_1ST | SMP_F_CONST;
        return 1;
 }
@@ -10364,10 +10439,10 @@ smp_fetch_base(const struct arg *args, struct sample *smp, const char *kw, void
 
        /* OK we have the header value in ctx.line+ctx.val for ctx.vlen bytes */
        temp = get_trash_chunk();
-       memcpy(temp->str, ctx.line + ctx.val, ctx.vlen);
+       memcpy(temp->area, ctx.line + ctx.val, ctx.vlen);
        smp->data.type = SMP_T_STR;
-       smp->data.u.str.str = temp->str;
-       smp->data.u.str.len = ctx.vlen;
+       smp->data.u.str.area = temp->area;
+       smp->data.u.str.data = ctx.vlen;
 
        /* now retrieve the path */
        end = ci_head(txn->req.chn) + txn->req.sl.rq.u + txn->req.sl.rq.u_l;
@@ -10378,8 +10453,9 @@ smp_fetch_base(const struct arg *args, struct sample *smp, const char *kw, void
        for (ptr = beg; ptr < end && *ptr != '?'; ptr++);
 
        if (beg < ptr && *beg == '/') {
-               memcpy(smp->data.u.str.str + smp->data.u.str.len, beg, ptr - beg);
-               smp->data.u.str.len += ptr - beg;
+               memcpy(smp->data.u.str.area + smp->data.u.str.data, beg,
+                      ptr - beg);
+               smp->data.u.str.data += ptr - beg;
        }
 
        smp->flags = SMP_F_VOL_1ST;
@@ -10455,17 +10531,21 @@ smp_fetch_base32_src(const struct arg *args, struct sample *smp, const char *kw,
                return 0;
 
        temp = get_trash_chunk();
-       *(unsigned int *)temp->str = htonl(smp->data.u.sint);
-       temp->len += sizeof(unsigned int);
+       *(unsigned int *) temp->area = htonl(smp->data.u.sint);
+       temp->data += sizeof(unsigned int);
 
        switch (cli_conn->addr.from.ss_family) {
        case AF_INET:
-               memcpy(temp->str + temp->len, &((struct sockaddr_in *)&cli_conn->addr.from)->sin_addr, 4);
-               temp->len += 4;
+               memcpy(temp->area + temp->data,
+                      &((struct sockaddr_in *)&cli_conn->addr.from)->sin_addr,
+                      4);
+               temp->data += 4;
                break;
        case AF_INET6:
-               memcpy(temp->str + temp->len, &((struct sockaddr_in6 *)&cli_conn->addr.from)->sin6_addr, 16);
-               temp->len += 16;
+               memcpy(temp->area + temp->data,
+                      &((struct sockaddr_in6 *)&cli_conn->addr.from)->sin6_addr,
+                      16);
+               temp->data += 16;
                break;
        default:
                return 0;
@@ -10499,8 +10579,8 @@ smp_fetch_query(const struct arg *args, struct sample *smp, const char *kw, void
        } while (*ptr++ != '?');
 
        smp->data.type = SMP_T_STR;
-       smp->data.u.str.str = ptr;
-       smp->data.u.str.len = end - ptr;
+       smp->data.u.str.area = ptr;
+       smp->data.u.str.data = end - ptr;
        smp->flags = SMP_F_VOL_1ST | SMP_F_CONST;
        return 1;
 }
@@ -10572,8 +10652,8 @@ smp_fetch_http_auth_grp(const struct arg *args, struct sample *smp, const char *
 
        smp->data.type = SMP_T_STR;
        smp->flags = SMP_F_CONST;
-       smp->data.u.str.str = smp->strm->txn->auth.user;
-       smp->data.u.str.len = strlen(smp->strm->txn->auth.user);
+       smp->data.u.str.area = smp->strm->txn->auth.user;
+       smp->data.u.str.data = strlen(smp->strm->txn->auth.user);
 
        return 1;
 }
@@ -10592,7 +10672,7 @@ smp_fetch_http_auth_grp(const struct arg *args, struct sample *smp, const char *
 char *
 extract_cookie_value(char *hdr, const char *hdr_end,
                  char *cookie_name, size_t cookie_name_l, int list,
-                 char **value, int *value_l)
+                 char **value, size_t *value_l)
 {
        char *equal, *att_end, *att_beg, *val_beg, *val_end;
        char *next;
@@ -10692,8 +10772,8 @@ smp_fetch_capture_header_req(const struct arg *args, struct sample *smp, const c
 
        smp->data.type = SMP_T_STR;
        smp->flags |= SMP_F_CONST;
-       smp->data.u.str.str = smp->strm->req_cap[idx];
-       smp->data.u.str.len = strlen(smp->strm->req_cap[idx]);
+       smp->data.u.str.area = smp->strm->req_cap[idx];
+       smp->data.u.str.data = strlen(smp->strm->req_cap[idx]);
 
        return 1;
 }
@@ -10717,8 +10797,8 @@ smp_fetch_capture_header_res(const struct arg *args, struct sample *smp, const c
 
        smp->data.type = SMP_T_STR;
        smp->flags |= SMP_F_CONST;
-       smp->data.u.str.str = smp->strm->res_cap[idx];
-       smp->data.u.str.len = strlen(smp->strm->res_cap[idx]);
+       smp->data.u.str.area = smp->strm->res_cap[idx];
+       smp->data.u.str.data = strlen(smp->strm->res_cap[idx]);
 
        return 1;
 }
@@ -10740,8 +10820,8 @@ smp_fetch_capture_req_method(const struct arg *args, struct sample *smp, const c
                ptr++;
 
        temp = get_trash_chunk();
-       temp->str = txn->uri;
-       temp->len = ptr - txn->uri;
+       temp->area = txn->uri;
+       temp->data = ptr - txn->uri;
        smp->data.u.str = *temp;
        smp->data.type = SMP_T_STR;
        smp->flags = SMP_F_CONST;
@@ -10772,14 +10852,14 @@ smp_fetch_capture_req_uri(const struct arg *args, struct sample *smp, const char
        ptr++;  /* skip the space */
 
        temp = get_trash_chunk();
-       ptr = temp->str = http_get_path_from_string(ptr);
+       ptr = temp->area = http_get_path_from_string(ptr);
        if (!ptr)
                return 0;
        while (*ptr != ' ' && *ptr != '\0')  /* find space after URI */
                ptr++;
 
        smp->data.u.str = *temp;
-       smp->data.u.str.len = ptr - temp->str;
+       smp->data.u.str.data = ptr - temp->area;
        smp->data.type = SMP_T_STR;
        smp->flags = SMP_F_CONST;
 
@@ -10798,11 +10878,11 @@ smp_fetch_capture_req_ver(const struct arg *args, struct sample *smp, const char
                return 0;
 
        if (txn->req.flags & HTTP_MSGF_VER_11)
-               smp->data.u.str.str = "HTTP/1.1";
+               smp->data.u.str.area = "HTTP/1.1";
        else
-               smp->data.u.str.str = "HTTP/1.0";
+               smp->data.u.str.area = "HTTP/1.0";
 
-       smp->data.u.str.len = 8;
+       smp->data.u.str.data = 8;
        smp->data.type  = SMP_T_STR;
        smp->flags = SMP_F_CONST;
        return 1;
@@ -10821,11 +10901,11 @@ smp_fetch_capture_res_ver(const struct arg *args, struct sample *smp, const char
                return 0;
 
        if (txn->rsp.flags & HTTP_MSGF_VER_11)
-               smp->data.u.str.str = "HTTP/1.1";
+               smp->data.u.str.area = "HTTP/1.1";
        else
-               smp->data.u.str.str = "HTTP/1.0";
+               smp->data.u.str.area = "HTTP/1.0";
 
-       smp->data.u.str.len = 8;
+       smp->data.u.str.data = 8;
        smp->data.type  = SMP_T_STR;
        smp->flags = SMP_F_CONST;
        return 1;
@@ -10906,7 +10986,7 @@ int smp_fetch_cookie(const struct arg *args, struct sample *smp, const char *kw,
                        if (!http_find_header2(hdr_name, hdr_name_len, sol, idx, ctx))
                                goto out;
 
-                       if (ctx->vlen < args->data.str.len + 1)
+                       if (ctx->vlen < args->data.str.data + 1)
                                continue;
 
                        smp->ctx.a[0] = ctx->line + ctx->val;
@@ -10916,10 +10996,11 @@ int smp_fetch_cookie(const struct arg *args, struct sample *smp, const char *kw,
                smp->data.type = SMP_T_STR;
                smp->flags |= SMP_F_CONST;
                smp->ctx.a[0] = extract_cookie_value(smp->ctx.a[0], smp->ctx.a[1],
-                                                args->data.str.str, args->data.str.len,
+                                                args->data.str.area,
+                                                args->data.str.data,
                                                 (smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ,
-                                                &smp->data.u.str.str,
-                                                &smp->data.u.str.len);
+                                                &smp->data.u.str.area,
+                                                &smp->data.u.str.data);
                if (smp->ctx.a[0]) {
                        found = 1;
                        if (occ >= 0) {
@@ -10985,7 +11066,7 @@ smp_fetch_cookie_cnt(const struct arg *args, struct sample *smp, const char *kw,
                        if (!http_find_header2(hdr_name, hdr_name_len, sol, idx, &ctx))
                                break;
 
-                       if (ctx.vlen < args->data.str.len + 1)
+                       if (ctx.vlen < args->data.str.data + 1)
                                continue;
 
                        val_beg = ctx.line + ctx.val;
@@ -10995,10 +11076,10 @@ smp_fetch_cookie_cnt(const struct arg *args, struct sample *smp, const char *kw,
                smp->data.type = SMP_T_STR;
                smp->flags |= SMP_F_CONST;
                while ((val_beg = extract_cookie_value(val_beg, val_end,
-                                                      args->data.str.str, args->data.str.len,
+                                                      args->data.str.area, args->data.str.data,
                                                       (smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ,
-                                                      &smp->data.u.str.str,
-                                                      &smp->data.u.str.len))) {
+                                                      &smp->data.u.str.area,
+                                                      &smp->data.u.str.data))) {
                        cnt++;
                }
        }
@@ -11019,7 +11100,8 @@ smp_fetch_cookie_val(const struct arg *args, struct sample *smp, const char *kw,
 
        if (ret > 0) {
                smp->data.type = SMP_T_SINT;
-               smp->data.u.sint = strl2ic(smp->data.u.str.str, smp->data.u.str.len);
+               smp->data.u.sint = strl2ic(smp->data.u.str.area,
+                                          smp->data.u.str.data);
        }
 
        return ret;
@@ -11270,14 +11352,15 @@ smp_fetch_param(char delim, const char *name, int name_len, const struct arg *ar
            vend >= chunks[2] && vend <= chunks[3]) {
                /* Wrapped case. */
                temp = get_trash_chunk();
-               memcpy(temp->str, vstart, chunks[1] - vstart);
-               memcpy(temp->str + ( chunks[1] - vstart ), chunks[2], vend - chunks[2]);
-               smp->data.u.str.str = temp->str;
-               smp->data.u.str.len = ( chunks[1] - vstart ) + ( vend - chunks[2] );
+               memcpy(temp->area, vstart, chunks[1] - vstart);
+               memcpy(temp->area + ( chunks[1] - vstart ), chunks[2],
+                      vend - chunks[2]);
+               smp->data.u.str.area = temp->area;
+               smp->data.u.str.data = ( chunks[1] - vstart ) + ( vend - chunks[2] );
        } else {
                /* Contiguous case. */
-               smp->data.u.str.str = (char *)vstart;
-               smp->data.u.str.len = vend - vstart;
+               smp->data.u.str.area = (char *)vstart;
+               smp->data.u.str.data = vend - vstart;
                smp->flags = SMP_F_VOL_1ST | SMP_F_CONST;
        }
 
@@ -11317,12 +11400,12 @@ smp_fetch_url_param(const struct arg *args, struct sample *smp, const char *kw,
        name = "";
        name_len = 0;
        if (args->type == ARGT_STR) {
-               name     = args->data.str.str;
-               name_len = args->data.str.len;
+               name     = args->data.str.area;
+               name_len = args->data.str.data;
        }
 
        if (args[1].type)
-               delim = *args[1].data.str.str;
+               delim = *args[1].data.str.area;
 
        if (!smp->ctx.a[0]) { // first call, find the query string
                CHECK_HTTP_MESSAGE_FIRST();
@@ -11369,8 +11452,8 @@ smp_fetch_body_param(const struct arg *args, struct sample *smp, const char *kw,
        name = "";
        name_len = 0;
        if (args[0].type == ARGT_STR) {
-               name     = args[0].data.str.str;
-               name_len = args[0].data.str.len;
+               name     = args[0].data.str.area;
+               name_len = args[0].data.str.data;
        }
 
        if (!smp->ctx.a[0]) { // first call, find the query string
@@ -11420,7 +11503,8 @@ smp_fetch_url_param_val(const struct arg *args, struct sample *smp, const char *
 
        if (ret > 0) {
                smp->data.type = SMP_T_SINT;
-               smp->data.u.sint = strl2ic(smp->data.u.str.str, smp->data.u.str.len);
+               smp->data.u.sint = strl2ic(smp->data.u.str.area,
+                                          smp->data.u.str.data);
        }
 
        return ret;
@@ -11497,17 +11581,21 @@ smp_fetch_url32_src(const struct arg *args, struct sample *smp, const char *kw,
                return 0;
 
        temp = get_trash_chunk();
-       *(unsigned int *)temp->str = htonl(smp->data.u.sint);
-       temp->len += sizeof(unsigned int);
+       *(unsigned int *) temp->area = htonl(smp->data.u.sint);
+       temp->data += sizeof(unsigned int);
 
        switch (cli_conn->addr.from.ss_family) {
        case AF_INET:
-               memcpy(temp->str + temp->len, &((struct sockaddr_in *)&cli_conn->addr.from)->sin_addr, 4);
-               temp->len += 4;
+               memcpy(temp->area + temp->data,
+                      &((struct sockaddr_in *)&cli_conn->addr.from)->sin_addr,
+                      4);
+               temp->data += 4;
                break;
        case AF_INET6:
-               memcpy(temp->str + temp->len, &((struct sockaddr_in6 *)&cli_conn->addr.from)->sin6_addr, 16);
-               temp->len += 16;
+               memcpy(temp->area + temp->data,
+                      &((struct sockaddr_in6 *)&cli_conn->addr.from)->sin6_addr,
+                      16);
+               temp->data += 16;
                break;
        default:
                return 0;
@@ -11557,10 +11645,11 @@ static int sample_conv_http_date(const struct arg *args, struct sample *smp, voi
                return 0;
 
        temp = get_trash_chunk();
-       temp->len = snprintf(temp->str, temp->size - temp->len,
-                            "%s, %02d %s %04d %02d:%02d:%02d GMT",
-                            day[tm->tm_wday], tm->tm_mday, mon[tm->tm_mon], 1900+tm->tm_year,
-                            tm->tm_hour, tm->tm_min, tm->tm_sec);
+       temp->data = snprintf(temp->area, temp->size - temp->data,
+                             "%s, %02d %s %04d %02d:%02d:%02d GMT",
+                             day[tm->tm_wday], tm->tm_mday, mon[tm->tm_mon],
+                             1900+tm->tm_year,
+                             tm->tm_hour, tm->tm_min, tm->tm_sec);
 
        smp->data.u.str = *temp;
        smp->data.type = SMP_T_STR;
@@ -11595,8 +11684,8 @@ static inline int language_range_match(const char *range, int range_len,
 /* Arguments: The list of expected value, the number of parts returned and the separator */
 static int sample_conv_q_prefered(const struct arg *args, struct sample *smp, void *private)
 {
-       const char *al = smp->data.u.str.str;
-       const char *end = al + smp->data.u.str.len;
+       const char *al = smp->data.u.str.area;
+       const char *end = al + smp->data.u.str.data;
        const char *token;
        int toklen;
        int qvalue;
@@ -11609,8 +11698,8 @@ static int sample_conv_q_prefered(const struct arg *args, struct sample *smp, vo
         */
        smp->flags |= SMP_F_CONST;
        smp->data.u.str.size = 0;
-       smp->data.u.str.str = "";
-       smp->data.u.str.len = 0;
+       smp->data.u.str.area = "";
+       smp->data.u.str.data = 0;
 
        /* Parse the accept language */
        while (1) {
@@ -11637,7 +11726,7 @@ static int sample_conv_q_prefered(const struct arg *args, struct sample *smp, vo
                /* Check if the token exists in the list. If the token not exists,
                 * jump to the next token.
                 */
-               str = args[0].data.str.str;
+               str = args[0].data.str.area;
                w = str;
                while (1) {
                        if (*str == ';' || *str == '\0') {
@@ -11710,8 +11799,8 @@ process_value:
                 * break the process.
                 */
                if (qvalue > best_q) {
-                       smp->data.u.str.str = (char *)w;
-                       smp->data.u.str.len = str - w;
+                       smp->data.u.str.area = (char *)w;
+                       smp->data.u.str.data = str - w;
                        if (qvalue >= 1000)
                                break;
                        best_q = qvalue;
@@ -11730,13 +11819,13 @@ expect_comma:
        }
 
        /* Set default value if required. */
-       if (smp->data.u.str.len == 0 && args[1].type == ARGT_STR) {
-               smp->data.u.str.str = args[1].data.str.str;
-               smp->data.u.str.len = args[1].data.str.len;
+       if (smp->data.u.str.data == 0 && args[1].type == ARGT_STR) {
+               smp->data.u.str.area = args[1].data.str.area;
+               smp->data.u.str.data = args[1].data.str.data;
        }
 
        /* Return true only if a matching language was found. */
-       return smp->data.u.str.len != 0;
+       return smp->data.u.str.data != 0;
 }
 
 /* This fetch url-decode any input string. */
@@ -11746,18 +11835,18 @@ static int sample_conv_url_dec(const struct arg *args, struct sample *smp, void
         * the end of the buffer, copy the string in other buffer
          * before decoding.
         */
-       if (smp->flags & SMP_F_CONST || smp->data.u.str.size <= smp->data.u.str.len) {
+       if (smp->flags & SMP_F_CONST || smp->data.u.str.size <= smp->data.u.str.data) {
                struct chunk *str = get_trash_chunk();
-               memcpy(str->str, smp->data.u.str.str, smp->data.u.str.len);
-               smp->data.u.str.str = str->str;
+               memcpy(str->area, smp->data.u.str.area, smp->data.u.str.data);
+               smp->data.u.str.area = str->area;
                smp->data.u.str.size = str->size;
                smp->flags &= ~SMP_F_CONST;
        }
 
        /* Add final \0 required by url_decode(), and convert the input string. */
-       smp->data.u.str.str[smp->data.u.str.len] = '\0';
-       smp->data.u.str.len = url_decode(smp->data.u.str.str);
-       return (smp->data.u.str.len >= 0);
+       smp->data.u.str.area[smp->data.u.str.data] = '\0';
+       smp->data.u.str.data = url_decode(smp->data.u.str.area);
+       return (smp->data.u.str.data >= 0);
 }
 
 static int smp_conv_req_capture(const struct arg *args, struct sample *smp, void *private)
@@ -11790,12 +11879,12 @@ static int smp_conv_req_capture(const struct arg *args, struct sample *smp, void
                return 0;
 
        /* Check length. */
-       len = smp->data.u.str.len;
+       len = smp->data.u.str.data;
        if (len > hdr->len)
                len = hdr->len;
 
        /* Capture input data. */
-       memcpy(smp->strm->req_cap[idx], smp->data.u.str.str, len);
+       memcpy(smp->strm->req_cap[idx], smp->data.u.str.area, len);
        smp->strm->req_cap[idx][len] = '\0';
 
        return 1;
@@ -11831,12 +11920,12 @@ static int smp_conv_res_capture(const struct arg *args, struct sample *smp, void
                return 0;
 
        /* Check length. */
-       len = smp->data.u.str.len;
+       len = smp->data.u.str.data;
        if (len > hdr->len)
                len = hdr->len;
 
        /* Capture input data. */
-       memcpy(smp->strm->res_cap[idx], smp->data.u.str.str, len);
+       memcpy(smp->strm->res_cap[idx], smp->data.u.str.area, len);
        smp->strm->res_cap[idx][len] = '\0';
 
        return 1;
@@ -11949,31 +12038,32 @@ void http_set_status(unsigned int status, const char *reason, struct stream *s)
 
        chunk_reset(&trash);
 
-       res = ultoa_o(status, trash.str, trash.size);
-       c_l = res - trash.str;
+       res = ultoa_o(status, trash.area, trash.size);
+       c_l = res - trash.area;
 
-       trash.str[c_l] = ' ';
-       trash.len = c_l + 1;
+       trash.area[c_l] = ' ';
+       trash.data = c_l + 1;
 
        /* Do we have a custom reason format string? */
        if (msg == NULL)
                msg = get_reason(status);
        msg_len = strlen(msg);
-       strncpy(&trash.str[trash.len], msg, trash.size - trash.len);
-       trash.len += msg_len;
+       strncpy(&trash.area[trash.data], msg, trash.size - trash.data);
+       trash.data += msg_len;
 
        cur_ptr = ci_head(&s->res) + txn->rsp.sl.st.c;
        cur_end = ci_head(&s->res) + txn->rsp.sl.st.r + txn->rsp.sl.st.r_l;
 
        /* commit changes and adjust message */
-       delta = b_rep_blk(&s->res.buf, cur_ptr, cur_end, trash.str, trash.len);
+       delta = b_rep_blk(&s->res.buf, cur_ptr, cur_end, trash.area,
+                         trash.data);
 
        /* adjust res line offsets and lengths */
        txn->rsp.sl.st.r += c_l - txn->rsp.sl.st.c_l;
        txn->rsp.sl.st.c_l = c_l;
        txn->rsp.sl.st.r_l = msg_len;
 
-       delta = trash.len - (cur_end - cur_ptr);
+       delta = trash.data - (cur_end - cur_ptr);
        txn->rsp.sl.st.l += delta;
        txn->hdr_idx.v[0].len += delta;
        http_msg_move_end(&txn->rsp, delta);
@@ -11998,11 +12088,13 @@ enum act_return http_action_set_req_line(struct act_rule *rule, struct proxy *px
 
        /* If we have to create a query string, prepare a '?'. */
        if (rule->arg.http.action == 2)
-               replace->str[replace->len++] = '?';
-       replace->len += build_logline(s, replace->str + replace->len, replace->size - replace->len,
-                                     &rule->arg.http.logfmt);
+               replace->area[replace->data++] = '?';
+       replace->data += build_logline(s, replace->area + replace->data,
+                                      replace->size - replace->data,
+                                      &rule->arg.http.logfmt);
 
-       http_replace_req_line(rule->arg.http.action, replace->str, replace->len, px, s);
+       http_replace_req_line(rule->arg.http.action, replace->area,
+                             replace->data, px, s);
 
        ret = ACT_RET_CONT;
 
@@ -12179,11 +12271,11 @@ enum act_return http_action_req_capture(struct act_rule *rule, struct proxy *px,
        if (cap[h->index] == NULL) /* no more capture memory */
                return ACT_RET_CONT;
 
-       len = key->data.u.str.len;
+       len = key->data.u.str.data;
        if (len > h->len)
                len = h->len;
 
-       memcpy(cap[h->index], key->data.u.str.str, len);
+       memcpy(cap[h->index], key->data.u.str.area, len);
        cap[h->index][len] = 0;
        return ACT_RET_CONT;
 }
@@ -12220,11 +12312,11 @@ enum act_return http_action_req_capture_by_id(struct act_rule *rule, struct prox
        if (cap[h->index] == NULL) /* no more capture memory */
                return ACT_RET_CONT;
 
-       len = key->data.u.str.len;
+       len = key->data.u.str.data;
        if (len > h->len)
                len = h->len;
 
-       memcpy(cap[h->index], key->data.u.str.str, len);
+       memcpy(cap[h->index], key->data.u.str.area, len);
        cap[h->index][len] = 0;
        return ACT_RET_CONT;
 }
@@ -12408,11 +12500,11 @@ enum act_return http_action_res_capture_by_id(struct act_rule *rule, struct prox
        if (cap[h->index] == NULL) /* no more capture memory */
                return ACT_RET_CONT;
 
-       len = key->data.u.str.len;
+       len = key->data.u.str.data;
        if (len > h->len)
                len = h->len;
 
-       memcpy(cap[h->index], key->data.u.str.str, len);
+       memcpy(cap[h->index], key->data.u.str.area, len);
        cap[h->index][len] = 0;
        return ACT_RET_CONT;
 }
index 9a3689c719685dd8424066b1902d41448bc9f798..d49ecf4c7b9a0b35ae472b1d4d98daa3ce481da9 100644 (file)
@@ -631,7 +631,8 @@ int tcp_drain(int fd)
                len = recv(fd, NULL, INT_MAX, MSG_DONTWAIT | MSG_NOSIGNAL | MSG_TRUNC);
                if (len == -1 && errno == EFAULT)
 #endif
-                       len = recv(fd, trash.str, trash.size, MSG_DONTWAIT | MSG_NOSIGNAL);
+                       len = recv(fd, trash.area, trash.size,
+                                  MSG_DONTWAIT | MSG_NOSIGNAL);
 
                if (len == 0) {
                        /* cool, shutdown received */
@@ -1636,9 +1637,9 @@ static inline int get_tcp_info(const struct arg *args, struct sample *smp,
        /* Convert the value as expected. */
        if (args) {
                if (args[0].type == ARGT_STR) {
-                       if (strcmp(args[0].data.str.str, "us") == 0) {
+                       if (strcmp(args[0].data.str.area, "us") == 0) {
                                /* Do nothing. */
-                       } else if (strcmp(args[0].data.str.str, "ms") == 0) {
+                       } else if (strcmp(args[0].data.str.area, "ms") == 0) {
                                smp->data.u.sint = (smp->data.u.sint + 500) / 1000;
                        } else
                                return 0;
index 3f72266b90223c25ec204169ae834787ea7bfc3a..9ccfe7d6f73cd6a40e7589756c2d2c2e21c9627a 100644 (file)
@@ -312,8 +312,8 @@ const char *sample_src_names(unsigned int use)
 {
        int bit;
 
-       trash.len = 0;
-       trash.str[0] = '\0';
+       trash.data = 0;
+       trash.area[0] = '\0';
        for (bit = 0; bit < SMP_SRC_ENTRIES; bit++) {
                if (!(use & ~((1 << bit) - 1)))
                        break; /* no more bits */
@@ -321,11 +321,12 @@ const char *sample_src_names(unsigned int use)
                if (!(use & (1 << bit)))
                        continue; /* bit not set */
 
-               trash.len += snprintf(trash.str + trash.len, trash.size - trash.len, "%s%s",
-                                     (use & ((1 << bit) - 1)) ? "," : "",
-                                     fetch_src_names[bit]);
+               trash.data += snprintf(trash.area + trash.data,
+                                      trash.size - trash.data, "%s%s",
+                                      (use & ((1 << bit) - 1)) ? "," : "",
+                                      fetch_src_names[bit]);
        }
-       return trash.str;
+       return trash.area;
 }
 
 /* return a pointer to the correct sample checkpoint name, or "unknown" when
@@ -509,10 +510,10 @@ static int c_ip2str(struct sample *smp)
 {
        struct chunk *trash = get_trash_chunk();
 
-       if (!inet_ntop(AF_INET, (void *)&smp->data.u.ipv4, trash->str, trash->size))
+       if (!inet_ntop(AF_INET, (void *)&smp->data.u.ipv4, trash->area, trash->size))
                return 0;
 
-       trash->len = strlen(trash->str);
+       trash->data = strlen(trash->area);
        smp->data.u.str = *trash;
        smp->data.type = SMP_T_STR;
        smp->flags &= ~SMP_F_CONST;
@@ -539,10 +540,10 @@ static int c_ipv62str(struct sample *smp)
 {
        struct chunk *trash = get_trash_chunk();
 
-       if (!inet_ntop(AF_INET6, (void *)&smp->data.u.ipv6, trash->str, trash->size))
+       if (!inet_ntop(AF_INET6, (void *)&smp->data.u.ipv6, trash->area, trash->size))
                return 0;
 
-       trash->len = strlen(trash->str);
+       trash->data = strlen(trash->area);
        smp->data.u.str = *trash;
        smp->data.type = SMP_T_STR;
        smp->flags &= ~SMP_F_CONST;
@@ -573,8 +574,8 @@ static int c_int2ipv6(struct sample *smp)
 
 static int c_str2addr(struct sample *smp)
 {
-       if (!buf2ip(smp->data.u.str.str, smp->data.u.str.len, &smp->data.u.ipv4)) {
-               if (!buf2ip6(smp->data.u.str.str, smp->data.u.str.len, &smp->data.u.ipv6))
+       if (!buf2ip(smp->data.u.str.area, smp->data.u.str.data, &smp->data.u.ipv4)) {
+               if (!buf2ip6(smp->data.u.str.area, smp->data.u.str.data, &smp->data.u.ipv6))
                        return 0;
                smp->data.type = SMP_T_IPV6;
                smp->flags &= ~SMP_F_CONST;
@@ -587,7 +588,7 @@ static int c_str2addr(struct sample *smp)
 
 static int c_str2ip(struct sample *smp)
 {
-       if (!buf2ip(smp->data.u.str.str, smp->data.u.str.len, &smp->data.u.ipv4))
+       if (!buf2ip(smp->data.u.str.area, smp->data.u.str.data, &smp->data.u.ipv4))
                return 0;
        smp->data.type = SMP_T_IPV4;
        smp->flags &= ~SMP_F_CONST;
@@ -596,7 +597,7 @@ static int c_str2ip(struct sample *smp)
 
 static int c_str2ipv6(struct sample *smp)
 {
-       if (!buf2ip6(smp->data.u.str.str, smp->data.u.str.len, &smp->data.u.ipv6))
+       if (!buf2ip6(smp->data.u.str.area, smp->data.u.str.data, &smp->data.u.ipv6))
                return 0;
        smp->data.type = SMP_T_IPV6;
        smp->flags &= ~SMP_F_CONST;
@@ -611,9 +612,9 @@ static int c_bin2str(struct sample *smp)
 {
        int i;
 
-       for (i = 0; i < smp->data.u.str.len; i++) {
-               if (!smp->data.u.str.str[i]) {
-                       smp->data.u.str.len = i;
+       for (i = 0; i < smp->data.u.str.data; i++) {
+               if (!smp->data.u.str.area[i]) {
+                       smp->data.u.str.data = i;
                        break;
                }
        }
@@ -625,13 +626,13 @@ static int c_int2str(struct sample *smp)
        struct chunk *trash = get_trash_chunk();
        char *pos;
 
-       pos = lltoa_r(smp->data.u.sint, trash->str, trash->size);
+       pos = lltoa_r(smp->data.u.sint, trash->area, trash->size);
        if (!pos)
                return 0;
 
-       trash->size = trash->size - (pos - trash->str);
-       trash->str = pos;
-       trash->len = strlen(pos);
+       trash->size = trash->size - (pos - trash->area);
+       trash->area = pos;
+       trash->data = strlen(pos);
        smp->data.u.str = *trash;
        smp->data.type = SMP_T_STR;
        smp->flags &= ~SMP_F_CONST;
@@ -664,22 +665,22 @@ int smp_dup(struct sample *smp)
 
        case SMP_T_STR:
                trash = get_trash_chunk();
-               trash->len = smp->data.u.str.len;
-               if (trash->len > trash->size - 1)
-                       trash->len = trash->size - 1;
+               trash->data = smp->data.u.str.data;
+               if (trash->data > trash->size - 1)
+                       trash->data = trash->size - 1;
 
-               memcpy(trash->str, smp->data.u.str.str, trash->len);
-               trash->str[trash->len] = 0;
+               memcpy(trash->area, smp->data.u.str.area, trash->data);
+               trash->area[trash->data] = 0;
                smp->data.u.str = *trash;
                break;
 
        case SMP_T_BIN:
                trash = get_trash_chunk();
-               trash->len = smp->data.u.str.len;
-               if (trash->len > trash->size)
-                       trash->len = trash->size;
+               trash->data = smp->data.u.str.data;
+               if (trash->data > trash->size)
+                       trash->data = trash->size;
 
-               memcpy(trash->str, smp->data.u.str.str, trash->len);
+               memcpy(trash->area, smp->data.u.str.area, trash->data);
                smp->data.u.str = *trash;
                break;
 
@@ -703,11 +704,11 @@ static int c_str2int(struct sample *smp)
        const char *str;
        const char *end;
 
-       if (smp->data.u.str.len == 0)
+       if (smp->data.u.str.data == 0)
                return 0;
 
-       str = smp->data.u.str.str;
-       end = smp->data.u.str.str + smp->data.u.str.len;
+       str = smp->data.u.str.area;
+       end = smp->data.u.str.area + smp->data.u.str.data;
 
        smp->data.u.sint = read_int64(&str, end);
        smp->data.type = SMP_T_SINT;
@@ -720,11 +721,11 @@ static int c_str2meth(struct sample *smp)
        enum http_meth_t meth;
        int len;
 
-       meth = find_http_meth(smp->data.u.str.str, smp->data.u.str.len);
+       meth = find_http_meth(smp->data.u.str.area, smp->data.u.str.data);
        if (meth == HTTP_METH_OTHER) {
-               len = smp->data.u.str.len;
-               smp->data.u.meth.str.str = smp->data.u.str.str;
-               smp->data.u.meth.str.len = len;
+               len = smp->data.u.str.data;
+               smp->data.u.meth.str.area = smp->data.u.str.area;
+               smp->data.u.meth.str.data = len;
        }
        else
                smp->flags &= ~SMP_F_CONST;
@@ -740,16 +741,16 @@ static int c_meth2str(struct sample *smp)
 
        if (smp->data.u.meth.meth == HTTP_METH_OTHER) {
                /* The method is unknown. Copy the original pointer. */
-               len = smp->data.u.meth.str.len;
-               smp->data.u.str.str = smp->data.u.meth.str.str;
-               smp->data.u.str.len = len;
+               len = smp->data.u.meth.str.data;
+               smp->data.u.str.area = smp->data.u.meth.str.area;
+               smp->data.u.str.data = len;
                smp->data.type = SMP_T_STR;
        }
        else if (smp->data.u.meth.meth < HTTP_METH_OTHER) {
                /* The method is known, copy the pointer containing the string. */
                meth = smp->data.u.meth.meth;
-               smp->data.u.str.str = http_known_methods[meth].name;
-               smp->data.u.str.len = http_known_methods[meth].len;
+               smp->data.u.str.area = http_known_methods[meth].name;
+               smp->data.u.str.data = http_known_methods[meth].len;
                smp->flags |= SMP_F_CONST;
                smp->data.type = SMP_T_STR;
        }
@@ -765,12 +766,12 @@ static int c_addr2bin(struct sample *smp)
        struct chunk *chk = get_trash_chunk();
 
        if (smp->data.type == SMP_T_IPV4) {
-               chk->len = 4;
-               memcpy(chk->str, &smp->data.u.ipv4, chk->len);
+               chk->data = 4;
+               memcpy(chk->area, &smp->data.u.ipv4, chk->data);
        }
        else if (smp->data.type == SMP_T_IPV6) {
-               chk->len = 16;
-               memcpy(chk->str, &smp->data.u.ipv6, chk->len);
+               chk->data = 16;
+               memcpy(chk->area, &smp->data.u.ipv6, chk->data);
        }
        else
                return 0;
@@ -784,8 +785,8 @@ static int c_int2bin(struct sample *smp)
 {
        struct chunk *chk = get_trash_chunk();
 
-       *(unsigned long long int *)chk->str = my_htonll(smp->data.u.sint);
-       chk->len = 8;
+       *(unsigned long long int *) chk->area = my_htonll(smp->data.u.sint);
+       chk->data = 8;
 
        smp->data.u.str = *chk;
        smp->data.type = SMP_T_BIN;
@@ -1139,7 +1140,7 @@ int smp_resolve_args(struct proxy *p)
 
                switch (arg->type) {
                case ARGT_SRV:
-                       if (!arg->data.str.len) {
+                       if (!arg->data.str.data) {
                                ha_alert("parsing [%s:%d] : missing server name in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
                                         cur->file, cur->line,
                                         cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
@@ -1148,11 +1149,11 @@ int smp_resolve_args(struct proxy *p)
                        }
 
                        /* we support two formats : "bck/srv" and "srv" */
-                       sname = strrchr(arg->data.str.str, '/');
+                       sname = strrchr(arg->data.str.area, '/');
 
                        if (sname) {
                                *sname++ = '\0';
-                               pname = arg->data.str.str;
+                               pname = arg->data.str.area;
 
                                px = proxy_be_by_name(pname);
                                if (!px) {
@@ -1164,7 +1165,7 @@ int smp_resolve_args(struct proxy *p)
                                }
                        }
                        else
-                               sname = arg->data.str.str;
+                               sname = arg->data.str.area;
 
                        srv = findserver(px, sname);
                        if (!srv) {
@@ -1175,15 +1176,15 @@ int smp_resolve_args(struct proxy *p)
                                break;
                        }
 
-                       free(arg->data.str.str);
-                       arg->data.str.str = NULL;
+                       free(arg->data.str.area);
+                       arg->data.str.area = NULL;
                        arg->unresolved = 0;
                        arg->data.srv = srv;
                        break;
 
                case ARGT_FE:
-                       if (arg->data.str.len) {
-                               pname = arg->data.str.str;
+                       if (arg->data.str.data) {
+                               pname = arg->data.str.area;
                                px = proxy_fe_by_name(pname);
                        }
 
@@ -1203,15 +1204,15 @@ int smp_resolve_args(struct proxy *p)
                                break;
                        }
 
-                       free(arg->data.str.str);
-                       arg->data.str.str = NULL;
+                       free(arg->data.str.area);
+                       arg->data.str.area = NULL;
                        arg->unresolved = 0;
                        arg->data.prx = px;
                        break;
 
                case ARGT_BE:
-                       if (arg->data.str.len) {
-                               pname = arg->data.str.str;
+                       if (arg->data.str.data) {
+                               pname = arg->data.str.area;
                                px = proxy_be_by_name(pname);
                        }
 
@@ -1231,15 +1232,15 @@ int smp_resolve_args(struct proxy *p)
                                break;
                        }
 
-                       free(arg->data.str.str);
-                       arg->data.str.str = NULL;
+                       free(arg->data.str.area);
+                       arg->data.str.area = NULL;
                        arg->unresolved = 0;
                        arg->data.prx = px;
                        break;
 
                case ARGT_TAB:
-                       if (arg->data.str.len) {
-                               pname = arg->data.str.str;
+                       if (arg->data.str.data) {
+                               pname = arg->data.str.area;
                                px = proxy_tbl_by_name(pname);
                        }
 
@@ -1259,14 +1260,14 @@ int smp_resolve_args(struct proxy *p)
                                break;
                        }
 
-                       free(arg->data.str.str);
-                       arg->data.str.str = NULL;
+                       free(arg->data.str.area);
+                       arg->data.str.area = NULL;
                        arg->unresolved = 0;
                        arg->data.prx = px;
                        break;
 
                case ARGT_USR:
-                       if (!arg->data.str.len) {
+                       if (!arg->data.str.data) {
                                ha_alert("parsing [%s:%d] : missing userlist name in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
                                         cur->file, cur->line,
                                         cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
@@ -1275,27 +1276,28 @@ int smp_resolve_args(struct proxy *p)
                        }
 
                        if (p->uri_auth && p->uri_auth->userlist &&
-                           !strcmp(p->uri_auth->userlist->name, arg->data.str.str))
+                           !strcmp(p->uri_auth->userlist->name, arg->data.str.area))
                                ul = p->uri_auth->userlist;
                        else
-                               ul = auth_find_userlist(arg->data.str.str);
+                               ul = auth_find_userlist(arg->data.str.area);
 
                        if (!ul) {
                                ha_alert("parsing [%s:%d] : unable to find userlist '%s' referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
-                                        cur->file, cur->line, arg->data.str.str,
+                                        cur->file, cur->line,
+                                        arg->data.str.area,
                                         cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
                                cfgerr++;
                                break;
                        }
 
-                       free(arg->data.str.str);
-                       arg->data.str.str = NULL;
+                       free(arg->data.str.area);
+                       arg->data.str.area = NULL;
                        arg->unresolved = 0;
                        arg->data.usr = ul;
                        break;
 
                case ARGT_REG:
-                       if (!arg->data.str.len) {
+                       if (!arg->data.str.data) {
                                ha_alert("parsing [%s:%d] : missing regex in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
                                         cur->file, cur->line,
                                         cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
@@ -1316,17 +1318,17 @@ int smp_resolve_args(struct proxy *p)
                        rflags |= (arg->type_flags & ARGF_REG_ICASE) ? REG_ICASE : 0;
                        err = NULL;
 
-                       if (!regex_comp(arg->data.str.str, reg, !(rflags & REG_ICASE), 1 /* capture substr */, &err)) {
+                       if (!regex_comp(arg->data.str.area, reg, !(rflags & REG_ICASE), 1 /* capture substr */, &err)) {
                                ha_alert("parsing [%s:%d] : error in regex '%s' in arg %d of %s%s%s%s '%s' %s proxy '%s' : %s.\n",
                                         cur->file, cur->line,
-                                        arg->data.str.str,
+                                        arg->data.str.area,
                                         cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id, err);
                                cfgerr++;
                                continue;
                        }
 
-                       free(arg->data.str.str);
-                       arg->data.str.str = NULL;
+                       free(arg->data.str.area);
+                       arg->data.str.area = NULL;
                        arg->unresolved = 0;
                        arg->data.reg = reg;
                        break;
@@ -1395,8 +1397,8 @@ static void release_sample_arg(struct arg *p)
 
        while (p->type != ARGT_STOP) {
                if (p->type == ARGT_STR || p->unresolved) {
-                       free(p->data.str.str);
-                       p->data.str.str = NULL;
+                       free(p->data.str.area);
+                       p->data.str.area = NULL;
                        p->unresolved = 0;
                }
                else if (p->type == ARGT_REG) {
@@ -1455,9 +1457,10 @@ static int sample_conv_debug(const struct arg *arg_p, struct sample *smp, void *
                        else {
                                /* Display the displayable chars*. */
                                fprintf(stderr, "<");
-                               for (i = 0; i < tmp.data.u.str.len; i++) {
-                                       if (isprint(tmp.data.u.str.str[i]))
-                                               fputc(tmp.data.u.str.str[i], stderr);
+                               for (i = 0; i < tmp.data.u.str.data; i++) {
+                                       if (isprint(tmp.data.u.str.area[i]))
+                                               fputc(tmp.data.u.str.area[i],
+                                                     stderr);
                                        else
                                                fputc('.', stderr);
                                }
@@ -1474,12 +1477,13 @@ static int sample_conv_base642bin(const struct arg *arg_p, struct sample *smp, v
        struct chunk *trash = get_trash_chunk();
        int bin_len;
 
-       trash->len = 0;
-       bin_len = base64dec(smp->data.u.str.str, smp->data.u.str.len, trash->str, trash->size);
+       trash->data = 0;
+       bin_len = base64dec(smp->data.u.str.area, smp->data.u.str.data,
+                           trash->area, trash->size);
        if (bin_len < 0)
                return 0;
 
-       trash->len = bin_len;
+       trash->data = bin_len;
        smp->data.u.str = *trash;
        smp->data.type = SMP_T_BIN;
        smp->flags &= ~SMP_F_CONST;
@@ -1491,12 +1495,13 @@ static int sample_conv_bin2base64(const struct arg *arg_p, struct sample *smp, v
        struct chunk *trash = get_trash_chunk();
        int b64_len;
 
-       trash->len = 0;
-       b64_len = a2base64(smp->data.u.str.str, smp->data.u.str.len, trash->str, trash->size);
+       trash->data = 0;
+       b64_len = a2base64(smp->data.u.str.area, smp->data.u.str.data,
+                          trash->area, trash->size);
        if (b64_len < 0)
                return 0;
 
-       trash->len = b64_len;
+       trash->data = b64_len;
        smp->data.u.str = *trash;
        smp->data.type = SMP_T_STR;
        smp->flags &= ~SMP_F_CONST;
@@ -1511,10 +1516,10 @@ static int sample_conv_sha1(const struct arg *arg_p, struct sample *smp, void *p
        memset(&ctx, 0, sizeof(ctx));
 
        blk_SHA1_Init(&ctx);
-       blk_SHA1_Update(&ctx, smp->data.u.str.str, smp->data.u.str.len);
-       blk_SHA1_Final((unsigned char *)trash->str, &ctx);
+       blk_SHA1_Update(&ctx, smp->data.u.str.area, smp->data.u.str.data);
+       blk_SHA1_Final((unsigned char *) trash->area, &ctx);
 
-       trash->len = 20;
+       trash->data = 20;
        smp->data.u.str = *trash;
        smp->data.type = SMP_T_BIN;
        smp->flags &= ~SMP_F_CONST;
@@ -1527,11 +1532,11 @@ static int sample_conv_bin2hex(const struct arg *arg_p, struct sample *smp, void
        unsigned char c;
        int ptr = 0;
 
-       trash->len = 0;
-       while (ptr < smp->data.u.str.len && trash->len <= trash->size - 2) {
-               c = smp->data.u.str.str[ptr++];
-               trash->str[trash->len++] = hextab[(c >> 4) & 0xF];
-               trash->str[trash->len++] = hextab[c & 0xF];
+       trash->data = 0;
+       while (ptr < smp->data.u.str.data && trash->data <= trash->size - 2) {
+               c = smp->data.u.str.area[ptr++];
+               trash->area[trash->data++] = hextab[(c >> 4) & 0xF];
+               trash->area[trash->data++] = hextab[c & 0xF];
        }
        smp->data.u.str = *trash;
        smp->data.type = SMP_T_STR;
@@ -1544,8 +1549,8 @@ static int sample_conv_hex2int(const struct arg *arg_p, struct sample *smp, void
        long long int n = 0;
        int i, c;
 
-       for (i = 0; i < smp->data.u.str.len; i++) {
-               if ((c = hex2i(smp->data.u.str.str[i])) < 0)
+       for (i = 0; i < smp->data.u.str.data; i++) {
+               if ((c = hex2i(smp->data.u.str.area[i])) < 0)
                        return 0;
                n = (n << 4) + c;
        }
@@ -1559,7 +1564,8 @@ static int sample_conv_hex2int(const struct arg *arg_p, struct sample *smp, void
 /* hashes the binary input into a 32-bit unsigned int */
 static int sample_conv_djb2(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       smp->data.u.sint = hash_djb2(smp->data.u.str.str, smp->data.u.str.len);
+       smp->data.u.sint = hash_djb2(smp->data.u.str.area,
+                                    smp->data.u.str.data);
        if (arg_p && arg_p->data.sint)
                smp->data.u.sint = full_hash(smp->data.u.sint);
        smp->data.type = SMP_T_SINT;
@@ -1568,7 +1574,7 @@ static int sample_conv_djb2(const struct arg *arg_p, struct sample *smp, void *p
 
 static int sample_conv_length(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       int i = smp->data.u.str.len;
+       int i = smp->data.u.str.data;
        smp->data.u.sint = i;
        smp->data.type = SMP_T_SINT;
        return 1;
@@ -1582,9 +1588,9 @@ static int sample_conv_str2lower(const struct arg *arg_p, struct sample *smp, vo
        if (!smp_make_rw(smp))
                return 0;
 
-       for (i = 0; i < smp->data.u.str.len; i++) {
-               if ((smp->data.u.str.str[i] >= 'A') && (smp->data.u.str.str[i] <= 'Z'))
-                       smp->data.u.str.str[i] += 'a' - 'A';
+       for (i = 0; i < smp->data.u.str.data; i++) {
+               if ((smp->data.u.str.area[i] >= 'A') && (smp->data.u.str.area[i] <= 'Z'))
+                       smp->data.u.str.area[i] += 'a' - 'A';
        }
        return 1;
 }
@@ -1596,9 +1602,9 @@ static int sample_conv_str2upper(const struct arg *arg_p, struct sample *smp, vo
        if (!smp_make_rw(smp))
                return 0;
 
-       for (i = 0; i < smp->data.u.str.len; i++) {
-               if ((smp->data.u.str.str[i] >= 'a') && (smp->data.u.str.str[i] <= 'z'))
-                       smp->data.u.str.str[i] += 'A' - 'a';
+       for (i = 0; i < smp->data.u.str.data; i++) {
+               if ((smp->data.u.str.area[i] >= 'a') && (smp->data.u.str.area[i] <= 'z'))
+                       smp->data.u.str.area[i] += 'A' - 'a';
        }
        return 1;
 }
@@ -1647,7 +1653,8 @@ static int sample_conv_ltime(const struct arg *args, struct sample *smp, void *p
        if (!tm)
                return 0;
        temp = get_trash_chunk();
-       temp->len = strftime(temp->str, temp->size, args[0].data.str.str, tm);
+       temp->data = strftime(temp->area, temp->size, args[0].data.str.area,
+                             tm);
        smp->data.u.str = *temp;
        smp->data.type = SMP_T_STR;
        return 1;
@@ -1656,7 +1663,8 @@ static int sample_conv_ltime(const struct arg *args, struct sample *smp, void *p
 /* hashes the binary input into a 32-bit unsigned int */
 static int sample_conv_sdbm(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       smp->data.u.sint = hash_sdbm(smp->data.u.str.str, smp->data.u.str.len);
+       smp->data.u.sint = hash_sdbm(smp->data.u.str.area,
+                                    smp->data.u.str.data);
        if (arg_p && arg_p->data.sint)
                smp->data.u.sint = full_hash(smp->data.u.sint);
        smp->data.type = SMP_T_SINT;
@@ -1682,7 +1690,8 @@ static int sample_conv_utime(const struct arg *args, struct sample *smp, void *p
        if (!tm)
                return 0;
        temp = get_trash_chunk();
-       temp->len = strftime(temp->str, temp->size, args[0].data.str.str, tm);
+       temp->data = strftime(temp->area, temp->size, args[0].data.str.area,
+                             tm);
        smp->data.u.str = *temp;
        smp->data.type = SMP_T_STR;
        return 1;
@@ -1691,7 +1700,8 @@ static int sample_conv_utime(const struct arg *args, struct sample *smp, void *p
 /* hashes the binary input into a 32-bit unsigned int */
 static int sample_conv_wt6(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       smp->data.u.sint = hash_wt6(smp->data.u.str.str, smp->data.u.str.len);
+       smp->data.u.sint = hash_wt6(smp->data.u.str.area,
+                                   smp->data.u.str.data);
        if (arg_p && arg_p->data.sint)
                smp->data.u.sint = full_hash(smp->data.u.sint);
        smp->data.type = SMP_T_SINT;
@@ -1709,7 +1719,8 @@ static int sample_conv_xxh32(const struct arg *arg_p, struct sample *smp, void *
                seed = arg_p->data.sint;
        else
                seed = 0;
-       smp->data.u.sint = XXH32(smp->data.u.str.str, smp->data.u.str.len, seed);
+       smp->data.u.sint = XXH32(smp->data.u.str.area, smp->data.u.str.data,
+                                seed);
        smp->data.type = SMP_T_SINT;
        return 1;
 }
@@ -1728,7 +1739,8 @@ static int sample_conv_xxh64(const struct arg *arg_p, struct sample *smp, void *
                seed = (unsigned long long int)arg_p->data.sint;
        else
                seed = 0;
-       smp->data.u.sint = (long long int)XXH64(smp->data.u.str.str, smp->data.u.str.len, seed);
+       smp->data.u.sint = (long long int)XXH64(smp->data.u.str.area,
+                                               smp->data.u.str.data, seed);
        smp->data.type = SMP_T_SINT;
        return 1;
 }
@@ -1736,7 +1748,8 @@ static int sample_conv_xxh64(const struct arg *arg_p, struct sample *smp, void *
 /* hashes the binary input into a 32-bit unsigned int */
 static int sample_conv_crc32(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       smp->data.u.sint = hash_crc32(smp->data.u.str.str, smp->data.u.str.len);
+       smp->data.u.sint = hash_crc32(smp->data.u.str.area,
+                                     smp->data.u.str.data);
        if (arg_p && arg_p->data.sint)
                smp->data.u.sint = full_hash(smp->data.u.sint);
        smp->data.type = SMP_T_SINT;
@@ -1746,7 +1759,8 @@ static int sample_conv_crc32(const struct arg *arg_p, struct sample *smp, void *
 /* hashes the binary input into crc32c (RFC4960, Appendix B [8].) */
 static int sample_conv_crc32c(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       smp->data.u.sint = hash_crc32c(smp->data.u.str.str, smp->data.u.str.len);
+       smp->data.u.sint = hash_crc32c(smp->data.u.str.area,
+                                      smp->data.u.str.data);
        if (arg_p && arg_p->data.sint)
                smp->data.u.sint = full_hash(smp->data.u.sint);
        smp->data.type = SMP_T_SINT;
@@ -1783,37 +1797,37 @@ static int sample_conv_json_check(struct arg *arg, struct sample_conv *conv,
                return 0;
        }
 
-       if (strcmp(arg->data.str.str, "") == 0) {
+       if (strcmp(arg->data.str.area, "") == 0) {
                arg->type = ARGT_SINT;
                arg->data.sint = IT_ASCII;
                return 1;
        }
 
-       else if (strcmp(arg->data.str.str, "ascii") == 0) {
+       else if (strcmp(arg->data.str.area, "ascii") == 0) {
                arg->type = ARGT_SINT;
                arg->data.sint = IT_ASCII;
                return 1;
        }
 
-       else if (strcmp(arg->data.str.str, "utf8") == 0) {
+       else if (strcmp(arg->data.str.area, "utf8") == 0) {
                arg->type = ARGT_SINT;
                arg->data.sint = IT_UTF8;
                return 1;
        }
 
-       else if (strcmp(arg->data.str.str, "utf8s") == 0) {
+       else if (strcmp(arg->data.str.area, "utf8s") == 0) {
                arg->type = ARGT_SINT;
                arg->data.sint = IT_UTF8S;
                return 1;
        }
 
-       else if (strcmp(arg->data.str.str, "utf8p") == 0) {
+       else if (strcmp(arg->data.str.area, "utf8p") == 0) {
                arg->type = ARGT_SINT;
                arg->data.sint = IT_UTF8P;
                return 1;
        }
 
-       else if (strcmp(arg->data.str.str, "utf8ps") == 0) {
+       else if (strcmp(arg->data.str.area, "utf8ps") == 0) {
                arg->type = ARGT_SINT;
                arg->data.sint = IT_UTF8PS;
                return 1;
@@ -1839,10 +1853,10 @@ static int sample_conv_json(const struct arg *arg_p, struct sample *smp, void *p
                input_type = arg_p->data.sint;
 
        temp = get_trash_chunk();
-       temp->len = 0;
+       temp->data = 0;
 
-       p = smp->data.u.str.str;
-       while (p < smp->data.u.str.str + smp->data.u.str.len) {
+       p = smp->data.u.str.area;
+       while (p < smp->data.u.str.area + smp->data.u.str.data) {
 
                if (input_type == IT_ASCII) {
                        /* Read input as ASCII. */
@@ -1851,7 +1865,9 @@ static int sample_conv_json(const struct arg *arg_p, struct sample *smp, void *p
                }
                else {
                        /* Read input as UTF8. */
-                       ret = utf8_next(p, smp->data.u.str.len - ( p - smp->data.u.str.str ), &c);
+                       ret = utf8_next(p,
+                                       smp->data.u.str.data - ( p - smp->data.u.str.area),
+                                       &c);
                        p += utf8_return_length(ret);
 
                        if (input_type == IT_UTF8 && utf8_return_code(ret) != UTF8_CODE_OK)
@@ -1920,12 +1936,12 @@ static int sample_conv_json(const struct arg *arg_p, struct sample *smp, void *p
                }
 
                /* Check length */
-               if (temp->len + len > temp->size)
+               if (temp->data + len > temp->size)
                        return 0;
 
                /* Copy string. */
-               memcpy(temp->str + temp->len, str, len);
-               temp->len += len;
+               memcpy(temp->area + temp->data, str, len);
+               temp->data += len;
        }
 
        smp->flags &= ~SMP_F_CONST;
@@ -1940,18 +1956,18 @@ static int sample_conv_json(const struct arg *arg_p, struct sample *smp, void *p
  * Optional second arg is the length to truncate */
 static int sample_conv_bytes(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       if (smp->data.u.str.len <= arg_p[0].data.sint) {
-               smp->data.u.str.len = 0;
+       if (smp->data.u.str.data <= arg_p[0].data.sint) {
+               smp->data.u.str.data = 0;
                return 1;
        }
 
        if (smp->data.u.str.size)
                        smp->data.u.str.size -= arg_p[0].data.sint;
-       smp->data.u.str.len -= arg_p[0].data.sint;
-       smp->data.u.str.str += arg_p[0].data.sint;
+       smp->data.u.str.data -= arg_p[0].data.sint;
+       smp->data.u.str.area += arg_p[0].data.sint;
 
-       if ((arg_p[1].type == ARGT_SINT) && (arg_p[1].data.sint < smp->data.u.str.len))
-               smp->data.u.str.len = arg_p[1].data.sint;
+       if ((arg_p[1].type == ARGT_SINT) && (arg_p[1].data.sint < smp->data.u.str.data))
+               smp->data.u.str.data = arg_p[1].data.sint;
 
        return 1;
 }
@@ -1983,7 +1999,7 @@ static int sample_conv_field_check(struct arg *args, struct sample_conv *conv,
                return 0;
        }
 
-       if (!arg->data.str.len) {
+       if (!arg->data.str.data) {
                memprintf(err, "Empty separators list");
                return 0;
        }
@@ -2007,10 +2023,10 @@ static int sample_conv_field(const struct arg *arg_p, struct sample *smp, void *
 
        if (arg_p[0].data.sint < 0) {
                field = -1;
-               end = start = smp->data.u.str.str + smp->data.u.str.len;
-               while (start > smp->data.u.str.str) {
-                       for (i = 0 ; i < arg_p[1].data.str.len ; i++) {
-                               if (*(start-1) == arg_p[1].data.str.str[i]) {
+               end = start = smp->data.u.str.area + smp->data.u.str.data;
+               while (start > smp->data.u.str.area) {
+                       for (i = 0 ; i < arg_p[1].data.str.data; i++) {
+                               if (*(start-1) == arg_p[1].data.str.area[i]) {
                                        if (field == arg_p[0].data.sint) {
                                                if (count == 1)
                                                        goto found;
@@ -2027,10 +2043,10 @@ static int sample_conv_field(const struct arg *arg_p, struct sample *smp, void *
                }
        } else {
                field = 1;
-               end = start = smp->data.u.str.str;
-               while (end - smp->data.u.str.str < smp->data.u.str.len) {
-                       for (i = 0 ; i < arg_p[1].data.str.len ; i++) {
-                               if (*end == arg_p[1].data.str.str[i]) {
+               end = start = smp->data.u.str.area;
+               while (end - smp->data.u.str.area < smp->data.u.str.data) {
+                       for (i = 0 ; i < arg_p[1].data.str.data; i++) {
+                               if (*end == arg_p[1].data.str.area[i]) {
                                        if (field == arg_p[0].data.sint) {
                                                if (count == 1)
                                                        goto found;
@@ -2049,22 +2065,22 @@ static int sample_conv_field(const struct arg *arg_p, struct sample *smp, void *
 
        /* Field not found */
        if (field != arg_p[0].data.sint) {
-               smp->data.u.str.len = 0;
+               smp->data.u.str.data = 0;
                return 1;
        }
 found:
-       smp->data.u.str.len = end - start;
+       smp->data.u.str.data = end - start;
        /* If ret string is len 0, no need to
            change pointers or to update size */
-       if (!smp->data.u.str.len)
+       if (!smp->data.u.str.data)
                return 1;
 
-       smp->data.u.str.str = start;
+       smp->data.u.str.area = start;
 
        /* Compute remaining size if needed
            Note: smp->data.u.str.size cannot be set to 0 */
        if (smp->data.u.str.size)
-               smp->data.u.str.size -= start - smp->data.u.str.str;
+               smp->data.u.str.size -= start - smp->data.u.str.area;
 
        return 1;
 }
@@ -2086,11 +2102,11 @@ static int sample_conv_word(const struct arg *arg_p, struct sample *smp, void *p
        word = 0;
        inword = 0;
        if (arg_p[0].data.sint < 0) {
-               end = start = smp->data.u.str.str + smp->data.u.str.len;
-               while (start > smp->data.u.str.str) {
+               end = start = smp->data.u.str.area + smp->data.u.str.data;
+               while (start > smp->data.u.str.area) {
                        issep = 0;
-                       for (i = 0 ; i < arg_p[1].data.str.len ; i++) {
-                               if (*(start-1) == arg_p[1].data.str.str[i]) {
+                       for (i = 0 ; i < arg_p[1].data.str.data; i++) {
+                               if (*(start-1) == arg_p[1].data.str.area[i]) {
                                        issep = 1;
                                        break;
                                }
@@ -2116,11 +2132,11 @@ static int sample_conv_word(const struct arg *arg_p, struct sample *smp, void *p
                        start--;
                }
        } else {
-               end = start = smp->data.u.str.str;
-               while (end - smp->data.u.str.str < smp->data.u.str.len) {
+               end = start = smp->data.u.str.area;
+               while (end - smp->data.u.str.area < smp->data.u.str.data) {
                        issep = 0;
-                       for (i = 0 ; i < arg_p[1].data.str.len ; i++) {
-                               if (*end == arg_p[1].data.str.str[i]) {
+                       for (i = 0 ; i < arg_p[1].data.str.data; i++) {
+                               if (*end == arg_p[1].data.str.area[i]) {
                                        issep = 1;
                                        break;
                                }
@@ -2149,22 +2165,22 @@ static int sample_conv_word(const struct arg *arg_p, struct sample *smp, void *p
 
        /* Field not found */
        if (word != arg_p[0].data.sint) {
-               smp->data.u.str.len = 0;
+               smp->data.u.str.data = 0;
                return 1;
        }
 found:
-       smp->data.u.str.len = end - start;
+       smp->data.u.str.data = end - start;
        /* If ret string is len 0, no need to
            change pointers or to update size */
-       if (!smp->data.u.str.len)
+       if (!smp->data.u.str.data)
                return 1;
 
-       smp->data.u.str.str = start;
+       smp->data.u.str.area = start;
 
        /* Compute remaining size if needed
            Note: smp->data.u.str.size cannot be set to 0 */
        if (smp->data.u.str.size)
-               smp->data.u.str.size -= start - smp->data.u.str.str;
+               smp->data.u.str.size -= start - smp->data.u.str.area;
 
        return 1;
 }
@@ -2182,8 +2198,8 @@ static int sample_conv_regsub_check(struct arg *args, struct sample_conv *conv,
        if (arg[2].type != ARGT_STR)
                return 1;
 
-       p = arg[2].data.str.str;
-       len = arg[2].data.str.len;
+       p = arg[2].data.str.area;
+       len = arg[2].data.str.data;
        while (len) {
                if (*p == 'i') {
                        arg[0].type_flags |= ARGF_REG_ICASE;
@@ -2215,8 +2231,8 @@ static int sample_conv_regsub(const struct arg *arg_p, struct sample *smp, void
        int flag, max;
        int found;
 
-       start = smp->data.u.str.str;
-       end = start + smp->data.u.str.len;
+       start = smp->data.u.str.area;
+       end = start + smp->data.u.str.data;
 
        flag = 0;
        while (1) {
@@ -2233,24 +2249,25 @@ static int sample_conv_regsub(const struct arg *arg_p, struct sample *smp, void
                        pmatch[0].rm_so = end - start;
 
                /* copy the heading non-matching part (which may also be the tail if nothing matches) */
-               max = trash->size - trash->len;
+               max = trash->size - trash->data;
                if (max && pmatch[0].rm_so > 0) {
                        if (max > pmatch[0].rm_so)
                                max = pmatch[0].rm_so;
-                       memcpy(trash->str + trash->len, start, max);
-                       trash->len += max;
+                       memcpy(trash->area + trash->data, start, max);
+                       trash->data += max;
                }
 
                if (!found)
                        break;
 
                /* replace the matching part */
-               max = trash->size - trash->len;
+               max = trash->size - trash->data;
                if (max) {
-                       if (max > arg_p[1].data.str.len)
-                               max = arg_p[1].data.str.len;
-                       memcpy(trash->str + trash->len, arg_p[1].data.str.str, max);
-                       trash->len += max;
+                       if (max > arg_p[1].data.str.data)
+                               max = arg_p[1].data.str.data;
+                       memcpy(trash->area + trash->data,
+                              arg_p[1].data.str.area, max);
+                       trash->data += max;
                }
 
                /* stop here if we're done with this string */
@@ -2262,8 +2279,8 @@ static int sample_conv_regsub(const struct arg *arg_p, struct sample *smp, void
                 * so we have to copy that character and skip to the next one.
                 */
                if (!pmatch[0].rm_eo) {
-                       if (trash->len < trash->size)
-                               trash->str[trash->len++] = start[pmatch[0].rm_eo];
+                       if (trash->data < trash->size)
+                               trash->area[trash->data++] = start[pmatch[0].rm_eo];
                        pmatch[0].rm_eo++;
                }
 
@@ -2289,7 +2306,7 @@ static int check_operator(struct arg *args, struct sample_conv *conv,
                return 1;
 
        /* Try to convert an integer */
-       str = args[0].data.str.str;
+       str = args[0].data.str.area;
        end = str + strlen(str);
        args[0].data.sint = read_int64(&str, end);
        if (*str != '\0') {
@@ -2617,22 +2634,22 @@ static int sample_conv_concat(const struct arg *arg_p, struct sample *smp, void
        int max;
 
        trash = get_trash_chunk();
-       trash->len = smp->data.u.str.len;
-       if (trash->len > trash->size - 1)
-               trash->len = trash->size - 1;
+       trash->data = smp->data.u.str.data;
+       if (trash->data > trash->size - 1)
+               trash->data = trash->size - 1;
 
-       memcpy(trash->str, smp->data.u.str.str, trash->len);
-       trash->str[trash->len] = 0;
+       memcpy(trash->area, smp->data.u.str.area, trash->data);
+       trash->area[trash->data] = 0;
 
        /* append first string */
-       max = arg_p[0].data.str.len;
-       if (max > trash->size - 1 - trash->len)
-               max = trash->size - 1 - trash->len;
+       max = arg_p[0].data.str.data;
+       if (max > trash->size - 1 - trash->data)
+               max = trash->size - 1 - trash->data;
 
        if (max) {
-               memcpy(trash->str + trash->len, arg_p[0].data.str.str, max);
-               trash->len += max;
-               trash->str[trash->len] = 0;
+               memcpy(trash->area + trash->data, arg_p[0].data.str.area, max);
+               trash->data += max;
+               trash->area[trash->data] = 0;
        }
 
        /* append second string (variable) if it's found and we can turn it
@@ -2643,26 +2660,27 @@ static int sample_conv_concat(const struct arg *arg_p, struct sample *smp, void
            (sample_casts[tmp.data.type][SMP_T_STR] == c_none ||
             sample_casts[tmp.data.type][SMP_T_STR](&tmp))) {
 
-               max = tmp.data.u.str.len;
-               if (max > trash->size - 1 - trash->len)
-                       max = trash->size - 1 - trash->len;
+               max = tmp.data.u.str.data;
+               if (max > trash->size - 1 - trash->data)
+                       max = trash->size - 1 - trash->data;
 
                if (max) {
-                       memcpy(trash->str + trash->len, tmp.data.u.str.str, max);
-                       trash->len += max;
-                       trash->str[trash->len] = 0;
+                       memcpy(trash->area + trash->data, tmp.data.u.str.area,
+                              max);
+                       trash->data += max;
+                       trash->area[trash->data] = 0;
                }
        }
 
        /* append third string */
-       max = arg_p[2].data.str.len;
-       if (max > trash->size - 1 - trash->len)
-               max = trash->size - 1 - trash->len;
+       max = arg_p[2].data.str.data;
+       if (max > trash->size - 1 - trash->data)
+               max = trash->size - 1 - trash->data;
 
        if (max) {
-               memcpy(trash->str + trash->len, arg_p[2].data.str.str, max);
-               trash->len += max;
-               trash->str[trash->len] = 0;
+               memcpy(trash->area + trash->data, arg_p[2].data.str.area, max);
+               trash->data += max;
+               trash->area[trash->data] = 0;
        }
 
        smp->data.u.str = *trash;
@@ -2677,8 +2695,9 @@ static int smp_check_concat(struct arg *args, struct sample_conv *conv,
                            const char *file, int line, char **err)
 {
        /* Try to decode a variable. */
-       if (args[1].data.str.len > 0 && !vars_check_arg(&args[1], NULL)) {
-               memprintf(err, "failed to register variable name '%s'", args[1].data.str.str);
+       if (args[1].data.str.data > 0 && !vars_check_arg(&args[1], NULL)) {
+               memprintf(err, "failed to register variable name '%s'",
+                         args[1].data.str.area);
                return 0;
        }
        return 1;
@@ -2700,11 +2719,11 @@ static int sample_conv_strcmp(const struct arg *arg_p, struct sample *smp, void
        if (!sample_casts[tmp.data.type][SMP_T_STR](&tmp))
                return 0;
 
-       max = MIN(smp->data.u.str.len, tmp.data.u.str.len);
-       result = strncmp(smp->data.u.str.str, tmp.data.u.str.str, max);
+       max = MIN(smp->data.u.str.data, tmp.data.u.str.data);
+       result = strncmp(smp->data.u.str.area, tmp.data.u.str.area, max);
        if (result == 0) {
-               if (smp->data.u.str.len != tmp.data.u.str.len) {
-                       if (smp->data.u.str.len < tmp.data.u.str.len) {
+               if (smp->data.u.str.data != tmp.data.u.str.data) {
+                       if (smp->data.u.str.data < tmp.data.u.str.data) {
                                result = -1;
                        }
                        else {
@@ -2728,7 +2747,8 @@ static int smp_check_strcmp(struct arg *args, struct sample_conv *conv,
        if (vars_check_arg(&args[0], NULL))
                return 1;
 
-       memprintf(err, "failed to register variable name '%s'", args[0].data.str.str);
+       memprintf(err, "failed to register variable name '%s'",
+                 args[0].data.str.area);
        return 0;
 }
 
@@ -2766,14 +2786,14 @@ smp_fetch_env(const struct arg *args, struct sample *smp, const char *kw, void *
        if (!args || args[0].type != ARGT_STR)
                return 0;
 
-       env = getenv(args[0].data.str.str);
+       env = getenv(args[0].data.str.area);
        if (!env)
                return 0;
 
        smp->data.type = SMP_T_STR;
        smp->flags = SMP_F_CONST;
-       smp->data.u.str.str = env;
-       smp->data.u.str.len = strlen(env);
+       smp->data.u.str.area = env;
+       smp->data.u.str.data = strlen(env);
        return 1;
 }
 
@@ -2811,8 +2831,8 @@ smp_fetch_hostname(const struct arg *args, struct sample *smp, const char *kw, v
 {
        smp->data.type = SMP_T_STR;
        smp->flags = SMP_F_CONST;
-       smp->data.u.str.str = hostname;
-       smp->data.u.str.len = strlen(hostname);
+       smp->data.u.str.area = hostname;
+       smp->data.u.str.data = strlen(hostname);
        return 1;
 }
 
@@ -2873,21 +2893,21 @@ static int smp_fetch_const_str(const struct arg *args, struct sample *smp, const
 {
        smp->flags |= SMP_F_CONST;
        smp->data.type = SMP_T_STR;
-       smp->data.u.str.str = args[0].data.str.str;
-       smp->data.u.str.len = args[0].data.str.len;
+       smp->data.u.str.area = args[0].data.str.area;
+       smp->data.u.str.data = args[0].data.str.data;
        return 1;
 }
 
 static int smp_check_const_bool(struct arg *args, char **err)
 {
-       if (strcasecmp(args[0].data.str.str, "true") == 0 ||
-           strcasecmp(args[0].data.str.str, "1") == 0) {
+       if (strcasecmp(args[0].data.str.area, "true") == 0 ||
+           strcasecmp(args[0].data.str.area, "1") == 0) {
                args[0].type = ARGT_SINT;
                args[0].data.sint = 1;
                return 1;
        }
-       if (strcasecmp(args[0].data.str.str, "false") == 0 ||
-           strcasecmp(args[0].data.str.str, "0") == 0) {
+       if (strcasecmp(args[0].data.str.area, "false") == 0 ||
+           strcasecmp(args[0].data.str.area, "0") == 0) {
                args[0].type = ARGT_SINT;
                args[0].data.sint = 0;
                return 1;
@@ -2929,11 +2949,11 @@ static int smp_check_const_bin(struct arg *args, char **err)
        char *binstr = NULL;
        int binstrlen;
 
-       if (!parse_binary(args[0].data.str.str, &binstr, &binstrlen, err))
+       if (!parse_binary(args[0].data.str.area, &binstr, &binstrlen, err))
                return 0;
        args[0].type = ARGT_STR;
-       args[0].data.str.str = binstr;
-       args[0].data.str.len = binstrlen;
+       args[0].data.str.area = binstr;
+       args[0].data.str.data = binstrlen;
        return 1;
 }
 
@@ -2941,8 +2961,8 @@ static int smp_fetch_const_bin(const struct arg *args, struct sample *smp, const
 {
        smp->flags |= SMP_F_CONST;
        smp->data.type = SMP_T_BIN;
-       smp->data.u.str.str = args[0].data.str.str;
-       smp->data.u.str.len = args[0].data.str.len;
+       smp->data.u.str.area = args[0].data.str.area;
+       smp->data.u.str.data = args[0].data.str.data;
        return 1;
 }
 
@@ -2951,7 +2971,7 @@ static int smp_check_const_meth(struct arg *args, char **err)
        enum http_meth_t meth;
        int i;
 
-       meth = find_http_meth(args[0].data.str.str, args[0].data.str.len);
+       meth = find_http_meth(args[0].data.str.area, args[0].data.str.data);
        if (meth != HTTP_METH_OTHER) {
                args[0].type = ARGT_SINT;
                args[0].data.sint = meth;
@@ -2961,8 +2981,8 @@ static int smp_check_const_meth(struct arg *args, char **err)
                 *         "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA
                 * token = 1*tchar
                 */
-               for (i = 0; i < args[0].data.str.len; i++) {
-                       if (!HTTP_IS_TOKEN(args[0].data.str.str[i])) {
+               for (i = 0; i < args[0].data.str.data; i++) {
+                       if (!HTTP_IS_TOKEN(args[0].data.str.area[i])) {
                                memprintf(err, "expects valid method.");
                                return 0;
                        }
@@ -2977,13 +2997,13 @@ static int smp_fetch_const_meth(const struct arg *args, struct sample *smp, cons
        if (args[0].type == ARGT_SINT) {
                smp->flags &= ~SMP_F_CONST;
                smp->data.u.meth.meth = args[0].data.sint;
-               smp->data.u.meth.str.str = "";
-               smp->data.u.meth.str.len = 0;
+               smp->data.u.meth.str.area = "";
+               smp->data.u.meth.str.data = 0;
        } else {
                smp->flags |= SMP_F_CONST;
                smp->data.u.meth.meth = HTTP_METH_OTHER;
-               smp->data.u.meth.str.str = args[0].data.str.str;
-               smp->data.u.meth.str.len = args[0].data.str.len;
+               smp->data.u.meth.str.area = args[0].data.str.area;
+               smp->data.u.meth.str.data = args[0].data.str.data;
        }
        return 1;
 }
index 17d7663e818ef75956dc38bc9c81bd18d4e2779c..422f8bf1c632c65fefdfbda9af3abec447877669 100644 (file)
@@ -142,7 +142,7 @@ void srv_set_dyncookie(struct server *s)
         * on the safe side.
         */
        buffer_len = key_len + addr_len + 4;
-       tmpbuf = trash.str;
+       tmpbuf = trash.area;
        memcpy(tmpbuf, p->dyncookie_key, key_len);
        memcpy(&(tmpbuf[key_len]),
            s->addr.ss_family == AF_INET ?
@@ -1437,7 +1437,7 @@ static int srv_prepare_for_resolution(struct server *srv, const char *hostname)
                return 0;
 
        hostname_len    = strlen(hostname);
-       hostname_dn     = trash.str;
+       hostname_dn     = trash.area;
        hostname_dn_len = dns_str_to_dn_label(hostname, hostname_len + 1,
                                              hostname_dn, trash.size);
        if (hostname_dn_len == -1)
@@ -1826,9 +1826,9 @@ static int srv_tmpl_parse_range(struct server *srv, const char *arg, int *nb_low
 
        *nb_high = 0;
        chunk_printf(&trash, "%s", arg);
-       *nb_low = atoi(trash.str);
+       *nb_low = atoi(trash.area);
 
-       if ((nb_high_arg = strchr(trash.str, '-'))) {
+       if ((nb_high_arg = strchr(trash.area, '-'))) {
                *nb_high_arg++ = '\0';
                *nb_high = atoi(nb_high_arg);
        }
@@ -1847,7 +1847,7 @@ static inline void srv_set_id_from_prefix(struct server *srv, const char *prefix
 {
        chunk_printf(&trash, "%s%d", prefix, nb);
        free(srv->id);
-       srv->id = strdup(trash.str);
+       srv->id = strdup(trash.area);
 }
 
 /*
@@ -2861,7 +2861,7 @@ static void srv_update_state(struct server *srv, int version, char **params)
                        }
 
                        /* don't apply anything if one error has been detected */
-                       if (msg->len)
+                       if (msg->data)
                                goto out;
 
                        HA_SPIN_LOCK(SERVER_LOCK, &srv->lock);
@@ -3003,10 +3003,10 @@ static void srv_update_state(struct server *srv, int version, char **params)
        }
 
  out:
-       if (msg->len) {
+       if (msg->data) {
                chunk_appendf(msg, "\n");
                ha_warning("server-state application failed for server '%s/%s'%s",
-                          srv->proxy->id, srv->id, msg->str);
+                          srv->proxy->id, srv->id, msg->area);
        }
 }
 
@@ -3370,10 +3370,10 @@ int update_server_addr(struct server *s, void *ip, int ip_sin_family, const char
                                s->proxy->id, s->id, oldip, newip, updater);
 
                /* write the buffer on stderr */
-               ha_warning("%s.\n", trash.str);
+               ha_warning("%s.\n", trash.area);
 
                /* send a log */
-               send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str);
+               send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.area);
        }
 
        /* save the new IP family */
@@ -3559,7 +3559,7 @@ out:
        if (updater)
                chunk_appendf(msg, " by '%s'", updater);
        chunk_appendf(msg, "\n");
-       return msg->str;
+       return msg->area;
 }
 
 
@@ -3600,8 +3600,8 @@ int snr_update_srv_status(struct server *s, int has_no_ip)
                        chunk_printf(&trash, "Server %s/%s administratively READY thanks to valid DNS answer",
                                     s->proxy->id, s->id);
 
-                       ha_warning("%s.\n", trash.str);
-                       send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str);
+                       ha_warning("%s.\n", trash.area);
+                       send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.area);
                        return 0;
 
                case RSLV_STATUS_NX:
@@ -3743,7 +3743,7 @@ int snr_resolution_cb(struct dns_requester *requester, struct dns_nameserver *na
        }
        else
                chunk_printf(chk, "DNS cache");
-       update_server_addr(s, firstip, firstip_sin_family, (char *)chk->str);
+       update_server_addr(s, firstip, firstip_sin_family, (char *) chk->area);
 
  update_status:
        snr_update_srv_status(s, has_no_ip);
@@ -3873,7 +3873,7 @@ int srv_set_fqdn(struct server *srv, const char *hostname, int dns_locked)
 
        chunk_reset(&trash);
        hostname_len    = strlen(hostname);
-       hostname_dn     = trash.str;
+       hostname_dn     = trash.area;
        hostname_dn_len = dns_str_to_dn_label(hostname, hostname_len + 1,
                                              hostname_dn, trash.size);
        if (hostname_dn_len == -1)
@@ -4068,7 +4068,7 @@ const char *update_server_fqdn(struct server *server, const char *fqdn, const ch
                chunk_appendf(msg, " by '%s'", updater);
        chunk_appendf(msg, "\n");
 
-       return msg->str;
+       return msg->area;
 }
 
 
@@ -4329,8 +4329,9 @@ static int cli_parse_get_weight(char **args, char *payload, struct appctx *appct
        }
 
        /* return server's effective weight at the moment */
-       snprintf(trash.str, trash.size, "%d (initial %d)\n", sv->uweight, sv->iweight);
-       if (ci_putstr(si_ic(si), trash.str) == -1) {
+       snprintf(trash.area, trash.size, "%d (initial %d)\n", sv->uweight,
+                sv->iweight);
+       if (ci_putstr(si_ic(si), trash.area) == -1) {
                si_applet_cant_put(si);
                return 0;
        }
@@ -4557,12 +4558,14 @@ void srv_update_status(struct server *s)
                                             s->proxy->id, s->id);
 
                                srv_append_status(tmptrash, s, NULL, xferred, 0);
-                               ha_warning("%s.\n", tmptrash->str);
+                               ha_warning("%s.\n", tmptrash->area);
 
                                /* we don't send an alert if the server was previously paused */
                                log_level = srv_was_stopping ? LOG_NOTICE : LOG_ALERT;
-                               send_log(s->proxy, log_level, "%s.\n", tmptrash->str);
-                               send_email_alert(s, log_level, "%s", tmptrash->str);
+                               send_log(s->proxy, log_level, "%s.\n",
+                                        tmptrash->area);
+                               send_email_alert(s, log_level, "%s",
+                                                tmptrash->area);
                                free_trash_chunk(tmptrash);
                                tmptrash = NULL;
                        }
@@ -4590,8 +4593,9 @@ void srv_update_status(struct server *s)
 
                                srv_append_status(tmptrash, s, NULL, xferred, 0);
 
-                               ha_warning("%s.\n", tmptrash->str);
-                               send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
+                               ha_warning("%s.\n", tmptrash->area);
+                               send_log(s->proxy, LOG_NOTICE, "%s.\n",
+                                        tmptrash->area);
                                free_trash_chunk(tmptrash);
                                tmptrash = NULL;
                        }
@@ -4648,9 +4652,11 @@ void srv_update_status(struct server *s)
                                             s->proxy->id, s->id);
 
                                srv_append_status(tmptrash, s, NULL, xferred, 0);
-                               ha_warning("%s.\n", tmptrash->str);
-                               send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
-                               send_email_alert(s, LOG_NOTICE, "%s", tmptrash->str);
+                               ha_warning("%s.\n", tmptrash->area);
+                               send_log(s->proxy, LOG_NOTICE, "%s.\n",
+                                        tmptrash->area);
+                               send_email_alert(s, LOG_NOTICE, "%s",
+                                                tmptrash->area);
                                free_trash_chunk(tmptrash);
                                tmptrash = NULL;
                        }
@@ -4703,8 +4709,9 @@ void srv_update_status(struct server *s)
                                srv_append_status(tmptrash, s, NULL, -1, (s->next_admin & SRV_ADMF_FMAINT));
 
                                if (!(global.mode & MODE_STARTING)) {
-                                       ha_warning("%s.\n", tmptrash->str);
-                                       send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
+                                       ha_warning("%s.\n", tmptrash->area);
+                                       send_log(s->proxy, LOG_NOTICE, "%s.\n",
+                                                tmptrash->area);
                                }
                                free_trash_chunk(tmptrash);
                                tmptrash = NULL;
@@ -4741,8 +4748,9 @@ void srv_update_status(struct server *s)
                                srv_append_status(tmptrash, s, NULL, xferred, (s->next_admin & SRV_ADMF_FMAINT));
 
                                if (!(global.mode & MODE_STARTING)) {
-                                       ha_warning("%s.\n", tmptrash->str);
-                                       send_log(s->proxy, srv_was_stopping ? LOG_NOTICE : LOG_ALERT, "%s.\n", tmptrash->str);
+                                       ha_warning("%s.\n", tmptrash->area);
+                                       send_log(s->proxy, srv_was_stopping ? LOG_NOTICE : LOG_ALERT, "%s.\n",
+                                                tmptrash->area);
                                }
                                free_trash_chunk(tmptrash);
                                tmptrash = NULL;
@@ -4817,8 +4825,9 @@ void srv_update_status(struct server *s)
                                             (s->next_state == SRV_ST_STOPPED) ? "DOWN" : "UP",
                                             (s->next_admin & SRV_ADMF_DRAIN) ? "DRAIN" : "READY");
                        }
-                       ha_warning("%s.\n", tmptrash->str);
-                       send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
+                       ha_warning("%s.\n", tmptrash->area);
+                       send_log(s->proxy, LOG_NOTICE, "%s.\n",
+                                tmptrash->area);
                        free_trash_chunk(tmptrash);
                        tmptrash = NULL;
                }
@@ -4855,8 +4864,9 @@ void srv_update_status(struct server *s)
                                if (s->track) /* normally it's mandatory here */
                                        chunk_appendf(tmptrash, " via %s/%s",
                                              s->track->proxy->id, s->track->id);
-                               ha_warning("%s.\n", tmptrash->str);
-                               send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
+                               ha_warning("%s.\n", tmptrash->area);
+                               send_log(s->proxy, LOG_NOTICE, "%s.\n",
+                                        tmptrash->area);
                                free_trash_chunk(tmptrash);
                                tmptrash = NULL;
                        }
@@ -4872,8 +4882,9 @@ void srv_update_status(struct server *s)
                                if (s->track) /* normally it's mandatory here */
                                        chunk_appendf(tmptrash, " via %s/%s",
                                              s->track->proxy->id, s->track->id);
-                               ha_warning("%s.\n", tmptrash->str);
-                               send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
+                               ha_warning("%s.\n", tmptrash->area);
+                               send_log(s->proxy, LOG_NOTICE, "%s.\n",
+                                        tmptrash->area);
                                free_trash_chunk(tmptrash);
                                tmptrash = NULL;
                        }
@@ -4885,8 +4896,9 @@ void srv_update_status(struct server *s)
                                             "%sServer %s/%s remains in forced maintenance",
                                             s->flags & SRV_F_BACKUP ? "Backup " : "",
                                             s->proxy->id, s->id);
-                               ha_warning("%s.\n", tmptrash->str);
-                               send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
+                               ha_warning("%s.\n", tmptrash->area);
+                               send_log(s->proxy, LOG_NOTICE, "%s.\n",
+                                        tmptrash->area);
                                free_trash_chunk(tmptrash);
                                tmptrash = NULL;
                        }
@@ -4919,9 +4931,11 @@ void srv_update_status(struct server *s)
                                srv_append_status(tmptrash, s, NULL, xferred, (s->next_admin & SRV_ADMF_FDRAIN));
 
                                if (!(global.mode & MODE_STARTING)) {
-                                       ha_warning("%s.\n", tmptrash->str);
-                                       send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
-                                       send_email_alert(s, LOG_NOTICE, "%s", tmptrash->str);
+                                       ha_warning("%s.\n", tmptrash->area);
+                                       send_log(s->proxy, LOG_NOTICE, "%s.\n",
+                                                tmptrash->area);
+                                       send_email_alert(s, LOG_NOTICE, "%s",
+                                                        tmptrash->area);
                                }
                                free_trash_chunk(tmptrash);
                                tmptrash = NULL;
@@ -4963,8 +4977,9 @@ void srv_update_status(struct server *s)
                                        s->track->proxy->id, s->track->id);
                                }
 
-                               ha_warning("%s.\n", tmptrash->str);
-                               send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
+                               ha_warning("%s.\n", tmptrash->area);
+                               send_log(s->proxy, LOG_NOTICE, "%s.\n",
+                                        tmptrash->area);
                                free_trash_chunk(tmptrash);
                                tmptrash = NULL;
                        }
@@ -5002,8 +5017,9 @@ void srv_update_status(struct server *s)
                                                     s->flags & SRV_F_BACKUP ? "Backup " : "",
                                                     s->proxy->id, s->id);
                                }
-                               ha_warning("%s.\n", tmptrash->str);
-                               send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
+                               ha_warning("%s.\n", tmptrash->area);
+                               send_log(s->proxy, LOG_NOTICE, "%s.\n",
+                                        tmptrash->area);
                                free_trash_chunk(tmptrash);
                                tmptrash = NULL;
                        }
index ae2d9e1d9a02c34b1d9b28e6c5b9adc2c45036b1..6cea612c54106e0f36f3aa998f28e7e2ab757292 100644 (file)
@@ -282,9 +282,10 @@ int session_accept_fd(struct listener *l, int cfd, struct sockaddr_storage *addr
        if (ret < 0 && l->bind_conf->xprt == xprt_get(XPRT_RAW) && p->mode == PR_MODE_HTTP) {
                /* critical error, no more memory, try to emit a 500 response */
                struct chunk *err_msg = &p->errmsg[HTTP_ERR_500];
-               if (!err_msg->str)
+               if (!err_msg->area)
                        err_msg = &http_err_chunks[HTTP_ERR_500];
-               send(cfd, err_msg->str, err_msg->len, MSG_DONTWAIT|MSG_NOSIGNAL);
+               send(cfd, err_msg->area, err_msg->data,
+                    MSG_DONTWAIT|MSG_NOSIGNAL);
        }
 
        if (fdtab[cfd].owner)
@@ -316,8 +317,9 @@ static void session_prepare_log_prefix(struct session *sess)
                chunk_printf(&trash, "%s:%d [", pn, get_host_port(&cli_conn->addr.from));
 
        get_localtime(sess->accept_date.tv_sec, &tm);
-       end = date2str_log(trash.str + trash.len, &tm, &(sess->accept_date), trash.size - trash.len);
-       trash.len = end - trash.str;
+       end = date2str_log(trash.area + trash.data, &tm, &(sess->accept_date),
+                          trash.size - trash.data);
+       trash.data = end - trash.area;
        if (sess->listener->name)
                chunk_appendf(&trash, "] %s/%s", sess->fe->id, sess->listener->name);
        else
@@ -362,10 +364,11 @@ static void session_kill_embryonic(struct session *sess)
                session_prepare_log_prefix(sess);
                err_msg = conn_err_code_str(conn);
                if (err_msg)
-                       send_log(sess->fe, level, "%s: %s\n", trash.str, err_msg);
+                       send_log(sess->fe, level, "%s: %s\n", trash.area,
+                                err_msg);
                else
                        send_log(sess->fe, level, "%s: unknown connection error (code=%d flags=%08x)\n",
-                                trash.str, conn->err_code, conn->flags);
+                                trash.area, conn->err_code, conn->flags);
        }
 
        /* kill the connection now */
index 9e3341a31b6b881cdc29d4cd1c82e97835dce435..b0b7d25437b25ac383898d6eacf4cde03655e3fe 100644 (file)
@@ -64,6 +64,7 @@
 #include <import/xxhash.h>
 
 #include <common/buffer.h>
+#include <common/chunk.h>
 #include <common/compat.h>
 #include <common/config.h>
 #include <common/debug.h>
@@ -649,13 +650,14 @@ static int ssl_sock_load_ocsp_response(struct chunk *ocsp_response, struct certi
        OCSP_BASICRESP *bs = NULL;
        OCSP_SINGLERESP *sr;
        OCSP_CERTID *id;
-       unsigned char *p = (unsigned char *)ocsp_response->str;
+       unsigned char *p = (unsigned char *) ocsp_response->area;
        int rc , count_sr;
        ASN1_GENERALIZEDTIME *revtime, *thisupd, *nextupd = NULL;
        int reason;
        int ret = 1;
 
-       resp = d2i_OCSP_RESPONSE(NULL, (const unsigned char **)&p, ocsp_response->len);
+       resp = d2i_OCSP_RESPONSE(NULL, (const unsigned char **)&p,
+                                ocsp_response->data);
        if (!resp) {
                memprintf(err, "Unable to parse OCSP response");
                goto out;
@@ -787,9 +789,9 @@ static int ssl_sock_load_ocsp_response_from_file(const char *ocsp_path, struct c
                goto end;
        }
 
-       trash.len = 0;
-       while (trash.len < trash.size) {
-               r = read(fd, trash.str + trash.len, trash.size - trash.len);
+       trash.data = 0;
+       while (trash.data < trash.size) {
+               r = read(fd, trash.area + trash.data, trash.size - trash.data);
                if (r < 0) {
                        if (errno == EINTR)
                                continue;
@@ -800,7 +802,7 @@ static int ssl_sock_load_ocsp_response_from_file(const char *ocsp_path, struct c
                else if (r == 0) {
                        break;
                }
-               trash.len += r;
+               trash.data += r;
        }
 
        close(fd);
@@ -887,7 +889,8 @@ struct tls_keys_ref *tlskeys_ref_lookupid(int unique_id)
 void ssl_sock_update_tlskey_ref(struct tls_keys_ref *ref, struct chunk *tlskey)
 {
        HA_RWLOCK_WRLOCK(TLSKEYS_REF_LOCK, &ref->lock);
-       memcpy((char *) (ref->tlskeys + ((ref->tls_ticket_enc_index + 2) % TLS_TICKETS_NO)), tlskey->str, tlskey->len);
+       memcpy((char *) (ref->tlskeys + ((ref->tls_ticket_enc_index + 2) % TLS_TICKETS_NO)),
+              tlskey->area, tlskey->data);
        ref->tls_ticket_enc_index = (ref->tls_ticket_enc_index + 1) % TLS_TICKETS_NO;
        HA_RWLOCK_WRUNLOCK(TLSKEYS_REF_LOCK, &ref->lock);
 }
@@ -1005,17 +1008,17 @@ int ssl_sock_ocsp_stapling_cbk(SSL *ssl, void *arg)
        }
 
        if (!ocsp ||
-           !ocsp->response.str ||
-           !ocsp->response.len ||
+           !ocsp->response.area ||
+           !ocsp->response.data ||
            (ocsp->expire < now.tv_sec))
                return SSL_TLSEXT_ERR_NOACK;
 
-       ssl_buf = OPENSSL_malloc(ocsp->response.len);
+       ssl_buf = OPENSSL_malloc(ocsp->response.data);
        if (!ssl_buf)
                return SSL_TLSEXT_ERR_NOACK;
 
-       memcpy(ssl_buf, ocsp->response.str, ocsp->response.len);
-       SSL_set_tlsext_status_ocsp_resp(ssl, ssl_buf, ocsp->response.len);
+       memcpy(ssl_buf, ocsp->response.area, ocsp->response.data);
+       SSL_set_tlsext_status_ocsp_resp(ssl, ssl_buf, ocsp->response.data);
 
        return SSL_TLSEXT_ERR_OK;
 }
@@ -1232,9 +1235,9 @@ static int ssl_sock_set_ocsp_response_from_file(SSL_CTX *ctx, const char *cert_p
                return -1;
        }
 
-       trash.len = 0;
-       while (trash.len < trash.size) {
-               r = read(fd, trash.str + trash.len, trash.size - trash.len);
+       trash.data = 0;
+       while (trash.data < trash.size) {
+               r = read(fd, trash.area + trash.data, trash.size - trash.data);
                if (r < 0) {
                        if (errno == EINTR)
                                continue;
@@ -1245,10 +1248,11 @@ static int ssl_sock_set_ocsp_response_from_file(SSL_CTX *ctx, const char *cert_p
                else if (r == 0) {
                        break;
                }
-               trash.len += r;
+               trash.data += r;
        }
        close(fd);
-       return SSL_CTX_set_ocsp_response(ctx, (const uint8_t *)trash.str, trash.len);
+       return SSL_CTX_set_ocsp_response(ctx, (const uint8_t *) trash.area,
+                                        trash.data);
 }
 #endif
 
@@ -1269,13 +1273,13 @@ static int ssl_sock_parse_sctl(struct chunk *sctl)
        int len, pos, sct_len;
        unsigned char *data;
 
-       if (sctl->len < 2)
+       if (sctl->data < 2)
                goto out;
 
-       data = (unsigned char *)sctl->str;
+       data = (unsigned char *) sctl->area;
        len = (data[0] << 8) | data[1];
 
-       if (len + 2 != sctl->len)
+       if (len + 2 != sctl->data)
                goto out;
 
        data = data + 2;
@@ -1309,9 +1313,9 @@ static int ssl_sock_load_sctl_from_file(const char *sctl_path, struct chunk **sc
        if (fd == -1)
                goto end;
 
-       trash.len = 0;
-       while (trash.len < trash.size) {
-               r = read(fd, trash.str + trash.len, trash.size - trash.len);
+       trash.data = 0;
+       while (trash.data < trash.size) {
+               r = read(fd, trash.area + trash.data, trash.size - trash.data);
                if (r < 0) {
                        if (errno == EINTR)
                                continue;
@@ -1321,7 +1325,7 @@ static int ssl_sock_load_sctl_from_file(const char *sctl_path, struct chunk **sc
                else if (r == 0) {
                        break;
                }
-               trash.len += r;
+               trash.data += r;
        }
 
        ret = ssl_sock_parse_sctl(&trash);
@@ -1346,8 +1350,8 @@ int ssl_sock_sctl_add_cbk(SSL *ssl, unsigned ext_type, const unsigned char **out
 {
        struct chunk *sctl = add_arg;
 
-       *out = (unsigned char *)sctl->str;
-       *outlen = sctl->len;
+       *out = (unsigned char *) sctl->area;
+       *outlen = sctl->data;
 
        return 1;
 }
@@ -2219,14 +2223,14 @@ static int ssl_sock_switchctx_cbk(SSL *ssl, int *al, void *arg)
        }
 
        for (i = 0; i < trash.size && i < servername_len; i++) {
-               trash.str[i] = tolower(servername[i]);
-               if (!wildp && (trash.str[i] == '.'))
-                       wildp = &trash.str[i];
+               trash.area[i] = tolower(servername[i]);
+               if (!wildp && (trash.area[i] == '.'))
+                       wildp = &trash.area[i];
        }
-       trash.str[i] = 0;
+       trash.area[i] = 0;
 
        /* lookup in full qualified names */
-       node = ebst_lookup(&s->sni_ctx, trash.str);
+       node = ebst_lookup(&s->sni_ctx, trash.area);
 
        /* lookup a not neg filter */
        for (n = node; n; n = ebmb_next_dup(n)) {
@@ -2296,7 +2300,7 @@ static int ssl_sock_switchctx_cbk(SSL *ssl, int *al, void *arg)
                        goto allow_early;
        }
 #if (!defined SSL_NO_GENERATE_CERTIFICATES)
-       if (s->generate_certs && ssl_sock_generate_certificate(trash.str, s, ssl)) {
+       if (s->generate_certs && ssl_sock_generate_certificate(trash.area, s, ssl)) {
                /* switch ctx done in ssl_sock_generate_certificate */
                goto allow_early;
        }
@@ -2355,14 +2359,14 @@ static int ssl_sock_switchctx_cbk(SSL *ssl, int *al, void *priv)
        for (i = 0; i < trash.size; i++) {
                if (!servername[i])
                        break;
-               trash.str[i] = tolower(servername[i]);
-               if (!wildp && (trash.str[i] == '.'))
-                       wildp = &trash.str[i];
+               trash.area[i] = tolower(servername[i]);
+               if (!wildp && (trash.area[i] == '.'))
+                       wildp = &trash.area[i];
        }
-       trash.str[i] = 0;
+       trash.area[i] = 0;
 
        /* lookup in full qualified names */
-       node = ebst_lookup(&s->sni_ctx, trash.str);
+       node = ebst_lookup(&s->sni_ctx, trash.area);
 
        /* lookup a not neg filter */
        for (n = node; n; n = ebmb_next_dup(n)) {
@@ -2685,16 +2689,16 @@ static int ssl_sock_add_cert_sni(SSL_CTX *ctx, struct bind_conf *s, struct ssl_b
                int j, len;
                len = strlen(name);
                for (j = 0; j < len && j < trash.size; j++)
-                       trash.str[j] = tolower(name[j]);
+                       trash.area[j] = tolower(name[j]);
                if (j >= trash.size)
                        return order;
-               trash.str[j] = 0;
+               trash.area[j] = 0;
 
                /* Check for duplicates. */
                if (wild)
-                       node = ebst_lookup(&s->sni_w_ctx, trash.str);
+                       node = ebst_lookup(&s->sni_w_ctx, trash.area);
                else
-                       node = ebst_lookup(&s->sni_ctx, trash.str);
+                       node = ebst_lookup(&s->sni_ctx, trash.area);
                for (; node; node = ebmb_next_dup(node)) {
                        sc = ebmb_entry(node, struct sni_ctx, name);
                        if (sc->ctx == ctx && sc->conf == conf && sc->neg == neg)
@@ -2704,7 +2708,7 @@ static int ssl_sock_add_cert_sni(SSL_CTX *ctx, struct bind_conf *s, struct ssl_b
                sc = malloc(sizeof(struct sni_ctx) + len + 1);
                if (!sc)
                        return order;
-               memcpy(sc->name.key, trash.str, len + 1);
+               memcpy(sc->name.key, trash.area, len + 1);
                sc->ctx = ctx;
                sc->conf = conf;
                sc->kinfo = kinfo;
@@ -2929,10 +2933,10 @@ static void ssl_sock_populate_sni_keytypes_hplr(const char *str, struct eb_root
        for (i = 0; i < trash.size; i++) {
                if (!str[i])
                        break;
-               trash.str[i] = tolower(str[i]);
+               trash.area[i] = tolower(str[i]);
        }
-       trash.str[i] = 0;
-       node = ebst_lookup(sni_keytypes, trash.str);
+       trash.area[i] = 0;
+       node = ebst_lookup(sni_keytypes, trash.area);
        if (!node) {
                /* CN not found in tree */
                s_kt = malloc(sizeof(struct sni_keytype) + i + 1);
@@ -2940,7 +2944,7 @@ static void ssl_sock_populate_sni_keytypes_hplr(const char *str, struct eb_root
                 * strncpy will cause sig_abrt errors under certain versions of gcc with -O2
                 * See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60792
                 */
-               memcpy(s_kt->name.key, trash.str, i+1);
+               memcpy(s_kt->name.key, trash.area, i+1);
                s_kt->keytypes = 0;
                ebst_insert(sni_keytypes, &s_kt->name);
        } else {
@@ -5822,8 +5826,8 @@ ssl_sock_get_serial(X509 *crt, struct chunk *out)
        if (out->size < serial->length)
                return -1;
 
-       memcpy(out->str, serial->data, serial->length);
-       out->len = serial->length;
+       memcpy(out->area, serial->data, serial->length);
+       out->data = serial->length;
        return 1;
 }
 
@@ -5835,7 +5839,7 @@ static int
 ssl_sock_crt2der(X509 *crt, struct chunk *out)
 {
        int len;
-       unsigned char *p = (unsigned char *)out->str;;
+       unsigned char *p = (unsigned char *) out->area;;
 
        len =i2d_X509(crt, NULL);
        if (len <= 0)
@@ -5845,7 +5849,7 @@ ssl_sock_crt2der(X509 *crt, struct chunk *out)
                return -1;
 
        i2d_X509(crt,&p);
-       out->len = len;
+       out->data = len;
        return 1;
 }
 
@@ -5867,8 +5871,8 @@ ssl_sock_get_time(ASN1_TIME *tm, struct chunk *out)
                if (out->size < gentm->length-2)
                        return -1;
 
-               memcpy(out->str, gentm->data+2, gentm->length-2);
-               out->len = gentm->length-2;
+               memcpy(out->area, gentm->data+2, gentm->length-2);
+               out->data = gentm->length-2;
                return 1;
        }
        else if (tm->type == V_ASN1_UTCTIME) {
@@ -5881,8 +5885,8 @@ ssl_sock_get_time(ASN1_TIME *tm, struct chunk *out)
                if (out->size < utctm->length)
                        return -1;
 
-               memcpy(out->str, utctm->data, utctm->length);
-               out->len = utctm->length;
+               memcpy(out->area, utctm->data, utctm->length);
+               out->data = utctm->length;
                return 1;
        }
 
@@ -5908,7 +5912,7 @@ ssl_sock_get_dn_entry(X509_NAME *a, const struct chunk *entry, int pos, struct c
 
        name_count = X509_NAME_entry_count(a);
 
-       out->len = 0;
+       out->data = 0;
        for (i = 0; i < name_count; i++) {
                if (pos < 0)
                        j = (name_count-1) - i;
@@ -5940,8 +5944,8 @@ ssl_sock_get_dn_entry(X509_NAME *a, const struct chunk *entry, int pos, struct c
                if (data_len > out->size)
                        return -1;
 
-               memcpy(out->str, data_ptr, data_len);
-               out->len = data_len;
+               memcpy(out->area, data_ptr, data_len);
+               out->data = data_len;
                return 1;
        }
 
@@ -5970,8 +5974,8 @@ ssl_sock_get_dn_oneline(X509_NAME *a, struct chunk *out)
 
        name_count = X509_NAME_entry_count(a);
 
-       out->len = 0;
-       p = out->str;
+       out->data = 0;
+       p = out->area;
        for (i = 0; i < name_count; i++) {
                ne = X509_NAME_get_entry(a, i);
                obj = X509_NAME_ENTRY_get_object(ne);
@@ -5988,7 +5992,7 @@ ssl_sock_get_dn_oneline(X509_NAME *a, struct chunk *out)
                l += 1 + ln + 1 + data_len;
                if (l > out->size)
                        return -1;
-               out->len = l;
+               out->data = l;
 
                *(p++)='/';
                memcpy(p, s, ln);
@@ -5998,7 +6002,7 @@ ssl_sock_get_dn_oneline(X509_NAME *a, struct chunk *out)
                p += data_len;
        }
 
-       if (!out->len)
+       if (!out->data)
                return 0;
 
        return 1;
@@ -6041,8 +6045,8 @@ int ssl_sock_get_remote_common_name(struct connection *conn, struct chunk *dest)
        X509_NAME *name;
        const char find_cn[] = "CN";
        const struct chunk find_cn_chunk = {
-               .str = (char *)&find_cn,
-               .len = sizeof(find_cn)-1
+               .area = (char *)&find_cn,
+               .data = sizeof(find_cn)-1
        };
        int result = -1;
 
@@ -6288,7 +6292,8 @@ smp_fetch_ssl_x_sha1(const struct arg *args, struct sample *smp, const char *kw,
 
        smp_trash = get_trash_chunk();
        digest = EVP_sha1();
-       X509_digest(crt, digest, (unsigned char *)smp_trash->str, (unsigned int *)&smp_trash->len);
+       X509_digest(crt, digest, (unsigned char *) smp_trash->area,
+                   (unsigned int *)&smp_trash->data);
 
        smp->data.u.str = *smp_trash;
        smp->data.type = SMP_T_BIN;
@@ -6595,8 +6600,8 @@ smp_fetch_ssl_x_sig_alg(const struct arg *args, struct sample *smp, const char *
        X509_ALGOR_get0(&algorithm, NULL, NULL, X509_get0_tbs_sigalg(crt));
        nid = OBJ_obj2nid(algorithm);
 
-       smp->data.u.str.str = (char *)OBJ_nid2sn(nid);
-       if (!smp->data.u.str.str) {
+       smp->data.u.str.area = (char *)OBJ_nid2sn(nid);
+       if (!smp->data.u.str.area) {
                /* SSL_get_peer_certificate increase X509 * ref count  */
                if (cert_peer)
                        X509_free(crt);
@@ -6605,7 +6610,7 @@ smp_fetch_ssl_x_sig_alg(const struct arg *args, struct sample *smp, const char *
 
        smp->data.type = SMP_T_STR;
        smp->flags |= SMP_F_CONST;
-       smp->data.u.str.len = strlen(smp->data.u.str.str);
+       smp->data.u.str.data = strlen(smp->data.u.str.area);
        /* SSL_get_peer_certificate increase X509 * ref count  */
        if (cert_peer)
                X509_free(crt);
@@ -6645,8 +6650,8 @@ smp_fetch_ssl_x_key_alg(const struct arg *args, struct sample *smp, const char *
        X509_PUBKEY_get0_param(&algorithm, NULL, NULL, NULL, X509_get_X509_PUBKEY(crt));
        nid = OBJ_obj2nid(algorithm);
 
-       smp->data.u.str.str = (char *)OBJ_nid2sn(nid);
-       if (!smp->data.u.str.str) {
+       smp->data.u.str.area = (char *)OBJ_nid2sn(nid);
+       if (!smp->data.u.str.area) {
                /* SSL_get_peer_certificate increase X509 * ref count  */
                if (cert_peer)
                        X509_free(crt);
@@ -6655,7 +6660,7 @@ smp_fetch_ssl_x_key_alg(const struct arg *args, struct sample *smp, const char *
 
        smp->data.type = SMP_T_STR;
        smp->flags |= SMP_F_CONST;
-       smp->data.u.str.len = strlen(smp->data.u.str.str);
+       smp->data.u.str.data = strlen(smp->data.u.str.area);
        if (cert_peer)
                X509_free(crt);
 
@@ -6726,13 +6731,13 @@ smp_fetch_ssl_fc_cipher(const struct arg *args, struct sample *smp, const char *
        if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
                return 0;
 
-       smp->data.u.str.str = (char *)SSL_get_cipher_name(conn->xprt_ctx);
-       if (!smp->data.u.str.str)
+       smp->data.u.str.area = (char *)SSL_get_cipher_name(conn->xprt_ctx);
+       if (!smp->data.u.str.area)
                return 0;
 
        smp->data.type = SMP_T_STR;
        smp->flags |= SMP_F_CONST;
-       smp->data.u.str.len = strlen(smp->data.u.str.str);
+       smp->data.u.str.data = strlen(smp->data.u.str.area);
 
        return 1;
 }
@@ -6798,11 +6803,12 @@ smp_fetch_ssl_fc_npn(const struct arg *args, struct sample *smp, const char *kw,
        if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
                return 0;
 
-       smp->data.u.str.str = NULL;
+       smp->data.u.str.area = NULL;
        SSL_get0_next_proto_negotiated(conn->xprt_ctx,
-                                       (const unsigned char **)&smp->data.u.str.str, (unsigned *)&smp->data.u.str.len);
+                                       (const unsigned char **)&smp->data.u.str.area,
+                                       (unsigned *)&smp->data.u.str.data);
 
-       if (!smp->data.u.str.str)
+       if (!smp->data.u.str.area)
                return 0;
 
        return 1;
@@ -6822,11 +6828,12 @@ smp_fetch_ssl_fc_alpn(const struct arg *args, struct sample *smp, const char *kw
        if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
                return 0;
 
-       smp->data.u.str.str = NULL;
+       smp->data.u.str.area = NULL;
        SSL_get0_alpn_selected(conn->xprt_ctx,
-                                (const unsigned char **)&smp->data.u.str.str, (unsigned *)&smp->data.u.str.len);
+                                (const unsigned char **)&smp->data.u.str.area,
+                                (unsigned *)&smp->data.u.str.data);
 
-       if (!smp->data.u.str.str)
+       if (!smp->data.u.str.area)
                return 0;
 
        return 1;
@@ -6847,13 +6854,13 @@ smp_fetch_ssl_fc_protocol(const struct arg *args, struct sample *smp, const char
        if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
                return 0;
 
-       smp->data.u.str.str = (char *)SSL_get_version(conn->xprt_ctx);
-       if (!smp->data.u.str.str)
+       smp->data.u.str.area = (char *)SSL_get_version(conn->xprt_ctx);
+       if (!smp->data.u.str.area)
                return 0;
 
        smp->data.type = SMP_T_STR;
        smp->flags = SMP_F_CONST;
-       smp->data.u.str.len = strlen(smp->data.u.str.str);
+       smp->data.u.str.data = strlen(smp->data.u.str.area);
 
        return 1;
 }
@@ -6880,8 +6887,9 @@ smp_fetch_ssl_fc_session_id(const struct arg *args, struct sample *smp, const ch
        if (!ssl_sess)
                return 0;
 
-       smp->data.u.str.str = (char *)SSL_SESSION_get_id(ssl_sess, (unsigned int *)&smp->data.u.str.len);
-       if (!smp->data.u.str.str || !smp->data.u.str.len)
+       smp->data.u.str.area = (char *)SSL_SESSION_get_id(ssl_sess,
+                                                         (unsigned int *)&smp->data.u.str.data);
+       if (!smp->data.u.str.area || !smp->data.u.str.data)
                return 0;
 
        return 1;
@@ -6906,8 +6914,10 @@ smp_fetch_ssl_fc_session_key(const struct arg *args, struct sample *smp, const c
                return 0;
 
        data = get_trash_chunk();
-       data->len = SSL_SESSION_get_master_key(ssl_sess, (unsigned char *)data->str, data->size);
-       if (!data->len)
+       data->data = SSL_SESSION_get_master_key(ssl_sess,
+                                              (unsigned char *) data->area,
+                                              data->size);
+       if (!data->data)
                return 0;
 
        smp->flags = 0;
@@ -6931,11 +6941,11 @@ smp_fetch_ssl_fc_sni(const struct arg *args, struct sample *smp, const char *kw,
        if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
                return 0;
 
-       smp->data.u.str.str = (char *)SSL_get_servername(conn->xprt_ctx, TLSEXT_NAMETYPE_host_name);
-       if (!smp->data.u.str.str)
+       smp->data.u.str.area = (char *)SSL_get_servername(conn->xprt_ctx, TLSEXT_NAMETYPE_host_name);
+       if (!smp->data.u.str.area)
                return 0;
 
-       smp->data.u.str.len = strlen(smp->data.u.str.str);
+       smp->data.u.str.data = strlen(smp->data.u.str.area);
        return 1;
 }
 #endif
@@ -6956,8 +6966,8 @@ smp_fetch_ssl_fc_cl_bin(const struct arg *args, struct sample *smp, const char *
 
        smp->flags = SMP_F_CONST;
        smp->data.type = SMP_T_BIN;
-       smp->data.u.str.str = capture->ciphersuite;
-       smp->data.u.str.len = capture->ciphersuite_len;
+       smp->data.u.str.area = capture->ciphersuite;
+       smp->data.u.str.data = capture->ciphersuite_len;
        return 1;
 }
 
@@ -6970,7 +6980,7 @@ smp_fetch_ssl_fc_cl_hex(const struct arg *args, struct sample *smp, const char *
                return 0;
 
        data = get_trash_chunk();
-       dump_binary(data, smp->data.u.str.str, smp->data.u.str.len);
+       dump_binary(data, smp->data.u.str.area, smp->data.u.str.data);
        smp->data.type = SMP_T_BIN;
        smp->data.u.str = *data;
        return 1;
@@ -7006,10 +7016,10 @@ smp_fetch_ssl_fc_cl_str(const struct arg *args, struct sample *smp, const char *
                return 0;
 
        data = get_trash_chunk();
-       for (i = 0; i + 1 < smp->data.u.str.len; i += 2) {
+       for (i = 0; i + 1 < smp->data.u.str.data; i += 2) {
                const char *str;
                const SSL_CIPHER *cipher;
-               const unsigned char *bin = (const unsigned char *)smp->data.u.str.str + i;
+               const unsigned char *bin = (const unsigned char *) smp->data.u.str.area + i;
                uint16_t id = (bin[0] << 8) | bin[1];
 #if defined(OPENSSL_IS_BORINGSSL)
                cipher = SSL_get_cipher_by_value(id);
@@ -7051,14 +7061,18 @@ smp_fetch_ssl_fc_unique_id(const struct arg *args, struct sample *smp, const cha
 
        finished_trash = get_trash_chunk();
        if (!SSL_session_reused(conn->xprt_ctx))
-               finished_len = SSL_get_peer_finished(conn->xprt_ctx, finished_trash->str, finished_trash->size);
+               finished_len = SSL_get_peer_finished(conn->xprt_ctx,
+                                                    finished_trash->area,
+                                                    finished_trash->size);
        else
-               finished_len = SSL_get_finished(conn->xprt_ctx, finished_trash->str, finished_trash->size);
+               finished_len = SSL_get_finished(conn->xprt_ctx,
+                                               finished_trash->area,
+                                               finished_trash->size);
 
        if (!finished_len)
                return 0;
 
-       finished_trash->len = finished_len;
+       finished_trash->data = finished_len;
        smp->data.u.str = *finished_trash;
        smp->data.type = SMP_T_BIN;
 
@@ -8477,9 +8491,11 @@ static int cli_io_handler_tlskeys_files(struct appctx *appctx) {
 
                                        chunk_reset(t2);
                                        /* should never fail here because we dump only a key in the t2 buffer */
-                                       t2->len = a2base64((char *)(ref->tlskeys + (head + 2 + appctx->ctx.cli.i1) % TLS_TICKETS_NO),
-                                                          sizeof(struct tls_sess_key), t2->str, t2->size);
-                                       chunk_appendf(&trash, "%d.%d %s\n", ref->unique_id, appctx->ctx.cli.i1, t2->str);
+                                       t2->data = a2base64((char *)(ref->tlskeys + (head + 2 + appctx->ctx.cli.i1) % TLS_TICKETS_NO),
+                                                          sizeof(struct tls_sess_key),
+                                                          t2->area, t2->size);
+                                       chunk_appendf(&trash, "%d.%d %s\n", ref->unique_id, appctx->ctx.cli.i1,
+                                                     t2->area);
 
                                        if (ci_putchk(si_ic(si), &trash) == -1) {
                                                /* let's try again later from this stream. We add ourselves into
@@ -8565,8 +8581,9 @@ static int cli_parse_set_tlskeys(char **args, char *payload, struct appctx *appc
                return 1;
        }
 
-       trash.len = base64dec(args[4], strlen(args[4]), trash.str, trash.size);
-       if (trash.len != sizeof(struct tls_sess_key)) {
+       trash.data = base64dec(args[4], strlen(args[4]), trash.area,
+                             trash.size);
+       if (trash.data != sizeof(struct tls_sess_key)) {
                appctx->ctx.cli.severity = LOG_ERR;
                appctx->ctx.cli.msg = "'set ssl tls-key' received invalid base64 encoded TLS key.\n";
                appctx->st0 = CLI_ST_PRINT;
@@ -8606,8 +8623,8 @@ static int cli_parse_set_ocspresponse(char **args, char *payload, struct appctx
        }
        payload[j] = 0;
 
-       trash.len = base64dec(payload, j, trash.str, trash.size);
-       if (trash.len < 0) {
+       trash.data = base64dec(payload, j, trash.area, trash.size);
+       if (trash.data < 0) {
                appctx->ctx.cli.severity = LOG_ERR;
                appctx->ctx.cli.msg = "'set ssl ocsp-response' received invalid base64 encoded response.\n";
                appctx->st0 = CLI_ST_PRINT;
index ebe043f182fbcf4f0eb2e2737c508b2f4565e4a0..86827dbbf3e9c680097bd2abe3177e53e1e917b2 100644 (file)
@@ -1300,7 +1300,7 @@ int url2sa(const char *url, int ulen, struct sockaddr_storage *addr, struct spli
                        return -1;
 
                /* Look for ']' and copy the address in a trash buffer. */
-               p = trash.str;
+               p = trash.area;
                for (end = curr;
                     end < url + ulen && *end != ']';
                     end++, p++)
@@ -1316,7 +1316,7 @@ int url2sa(const char *url, int ulen, struct sockaddr_storage *addr, struct spli
                }
 
                /* Try IPv6 decoding. */
-               if (!inet_pton(AF_INET6, trash.str, &((struct sockaddr_in6 *)addr)->sin6_addr))
+               if (!inet_pton(AF_INET6, trash.area, &((struct sockaddr_in6 *)addr)->sin6_addr))
                        return -1;
                end++;
 
@@ -1365,11 +1365,11 @@ int url2sa(const char *url, int ulen, struct sockaddr_storage *addr, struct spli
                        for (end = curr;
                             end < url + ulen && *end != '/' && *end != ':';
                             end++);
-                       memcpy(trash.str, curr, end - curr);
-                       trash.str[end - curr] = '\0';
+                       memcpy(trash.area, curr, end - curr);
+                       trash.area[end - curr] = '\0';
 
                        /* try to resolve an IPv4/IPv6 hostname */
-                       he = gethostbyname(trash.str);
+                       he = gethostbyname(trash.area);
                        if (!he)
                                return -1;
 
@@ -1557,8 +1557,8 @@ char *encode_chunk(char *start, char *stop,
                    const char escape, const fd_set *map,
                    const struct chunk *chunk)
 {
-       char *str = chunk->str;
-       char *end = chunk->str + chunk->len;
+       char *str = chunk->area;
+       char *end = chunk->area + chunk->data;
 
        if (start < stop) {
                stop--; /* reserve one byte for the final '\0' */
@@ -1620,8 +1620,8 @@ char *escape_chunk(char *start, char *stop,
                   const char escape, const fd_set *map,
                   const struct chunk *chunk)
 {
-       char *str = chunk->str;
-       char *end = chunk->str + chunk->len;
+       char *str = chunk->area;
+       char *end = chunk->area + chunk->data;
 
        if (start < stop) {
                stop--; /* reserve one byte for the final '\0' */
@@ -1672,8 +1672,8 @@ char *escape_chunk(char *start, char *stop,
  */
 const char *csv_enc_append(const char *str, int quote, struct chunk *output)
 {
-       char *end = output->str + output->size;
-       char *out = output->str + output->len;
+       char *end = output->area + output->size;
+       char *out = output->area + output->data;
        char *ptr = out;
 
        if (quote == 1) {
@@ -1703,7 +1703,7 @@ const char *csv_enc_append(const char *str, int quote, struct chunk *output)
                *ptr++ = '"';
 
        *ptr = '\0';
-       output->len = ptr - output->str;
+       output->data = ptr - output->area;
        return out;
 }
 
@@ -3833,14 +3833,14 @@ int dump_text(struct chunk *out, const char *buf, int bsize)
        while (buf[ptr] && ptr < bsize) {
                c = buf[ptr];
                if (isprint(c) && isascii(c) && c != '\\' && c != ' ' && c != '=') {
-                       if (out->len > out->size - 1)
+                       if (out->data > out->size - 1)
                                break;
-                       out->str[out->len++] = c;
+                       out->area[out->data++] = c;
                }
                else if (c == '\t' || c == '\n' || c == '\r' || c == '\e' || c == '\\' || c == ' ' || c == '=') {
-                       if (out->len > out->size - 2)
+                       if (out->data > out->size - 2)
                                break;
-                       out->str[out->len++] = '\\';
+                       out->area[out->data++] = '\\';
                        switch (c) {
                        case ' ': c = ' '; break;
                        case '\t': c = 't'; break;
@@ -3850,15 +3850,15 @@ int dump_text(struct chunk *out, const char *buf, int bsize)
                        case '\\': c = '\\'; break;
                        case '=': c = '='; break;
                        }
-                       out->str[out->len++] = c;
+                       out->area[out->data++] = c;
                }
                else {
-                       if (out->len > out->size - 4)
+                       if (out->data > out->size - 4)
                                break;
-                       out->str[out->len++] = '\\';
-                       out->str[out->len++] = 'x';
-                       out->str[out->len++] = hextab[(c >> 4) & 0xF];
-                       out->str[out->len++] = hextab[c & 0xF];
+                       out->area[out->data++] = '\\';
+                       out->area[out->data++] = 'x';
+                       out->area[out->data++] = hextab[(c >> 4) & 0xF];
+                       out->area[out->data++] = hextab[c & 0xF];
                }
                ptr++;
        }
@@ -3877,10 +3877,10 @@ int dump_binary(struct chunk *out, const char *buf, int bsize)
        while (ptr < bsize) {
                c = buf[ptr];
 
-               if (out->len > out->size - 2)
+               if (out->data > out->size - 2)
                        break;
-               out->str[out->len++] = hextab[(c >> 4) & 0xF];
-               out->str[out->len++] = hextab[c & 0xF];
+               out->area[out->data++] = hextab[(c >> 4) & 0xF];
+               out->area[out->data++] = hextab[c & 0xF];
 
                ptr++;
        }
@@ -3901,7 +3901,7 @@ int dump_text_line(struct chunk *out, const char *buf, int bsize, int len,
        int end;
        unsigned char c;
 
-       end = out->len + 80;
+       end = out->data + 80;
        if (end > out->size)
                return ptr;
 
@@ -3910,13 +3910,13 @@ int dump_text_line(struct chunk *out, const char *buf, int bsize, int len,
        while (ptr < len && ptr < bsize) {
                c = buf[ptr];
                if (isprint(c) && isascii(c) && c != '\\') {
-                       if (out->len > end - 2)
+                       if (out->data > end - 2)
                                break;
-                       out->str[out->len++] = c;
+                       out->area[out->data++] = c;
                } else if (c == '\t' || c == '\n' || c == '\r' || c == '\e' || c == '\\') {
-                       if (out->len > end - 3)
+                       if (out->data > end - 3)
                                break;
-                       out->str[out->len++] = '\\';
+                       out->area[out->data++] = '\\';
                        switch (c) {
                        case '\t': c = 't'; break;
                        case '\n': c = 'n'; break;
@@ -3924,24 +3924,24 @@ int dump_text_line(struct chunk *out, const char *buf, int bsize, int len,
                        case '\e': c = 'e'; break;
                        case '\\': c = '\\'; break;
                        }
-                       out->str[out->len++] = c;
+                       out->area[out->data++] = c;
                } else {
-                       if (out->len > end - 5)
+                       if (out->data > end - 5)
                                break;
-                       out->str[out->len++] = '\\';
-                       out->str[out->len++] = 'x';
-                       out->str[out->len++] = hextab[(c >> 4) & 0xF];
-                       out->str[out->len++] = hextab[c & 0xF];
+                       out->area[out->data++] = '\\';
+                       out->area[out->data++] = 'x';
+                       out->area[out->data++] = hextab[(c >> 4) & 0xF];
+                       out->area[out->data++] = hextab[c & 0xF];
                }
                if (buf[ptr++] == '\n') {
                        /* we had a line break, let's return now */
-                       out->str[out->len++] = '\n';
+                       out->area[out->data++] = '\n';
                        *line = ptr;
                        return ptr;
                }
        }
        /* we have an incomplete line, we return it as-is */
-       out->str[out->len++] = '\n';
+       out->area[out->data++] = '\n';
        return ptr;
 }
 
index 443024bc38cf54077c5f30196137edfab866312b..88d665e977b4f62c1802d022c282bd0eea4d43a5 100644 (file)
@@ -343,10 +343,10 @@ int stats_emit_json_data_field(struct chunk *out, const struct field *f)
                       break;
        }
 
-       old_len = out->len;
+       old_len = out->data;
        chunk_appendf(out, ",\"value\":{\"type\":%s,\"value\":%s%s%s}",
                      type, quote, value, quote);
-       return !(old_len == out->len);
+       return !(old_len == out->data);
 }
 
 /* Emits an encoding of the field type on 3 characters followed by a delimiter.
@@ -433,13 +433,13 @@ int stats_emit_json_field_tags(struct chunk *out, const struct field *f)
        default:         scope = "Unknown"; break;
        }
 
-       old_len = out->len;
+       old_len = out->data;
        chunk_appendf(out, "\"tags\":{"
                            "\"origin\":\"%s\","
                            "\"nature\":\"%s\","
                            "\"scope\":\"%s\""
                           "}", origin, nature, scope);
-       return !(old_len == out->len);
+       return !(old_len == out->data);
 }
 
 /* Dump all fields from <stats> into <out> using CSV format */
@@ -505,13 +505,13 @@ static int stats_dump_json_info_fields(struct chunk *out,
                        goto err;
                started = 1;
 
-               old_len = out->len;
+               old_len = out->data;
                chunk_appendf(out,
                              "{\"field\":{\"pos\":%d,\"name\":\"%s\"},"
                              "\"processNum\":%u,",
                              field, info_field_names[field],
                              info[INF_PROCESS_NUM].u.u32);
-               if (old_len == out->len)
+               if (old_len == out->data)
                        goto err;
 
                if (!stats_emit_json_field_tags(out, &info[field]))
@@ -565,7 +565,7 @@ static int stats_dump_fields_json(struct chunk *out, const struct field *stats,
                default:            obj_type = "Unknown";  break;
                }
 
-               old_len = out->len;
+               old_len = out->data;
                chunk_appendf(out,
                              "{"
                                "\"objType\":\"%s\","
@@ -576,7 +576,7 @@ static int stats_dump_fields_json(struct chunk *out, const struct field *stats,
                               obj_type, stats[ST_F_IID].u.u32,
                               stats[ST_F_SID].u.u32, field,
                               stat_field_names[field], stats[ST_F_PID].u.u32);
-               if (old_len == out->len)
+               if (old_len == out->data)
                        goto err;
 
                if (!stats_emit_json_field_tags(out, &stats[field]))
@@ -2648,15 +2648,16 @@ static int stats_process_http_post(struct stream_interface *si)
                goto out;
        }
 
-       reql = co_getblk(si_oc(si), temp->str, s->txn->req.body_len, s->txn->req.eoh + 2);
+       reql = co_getblk(si_oc(si), temp->area, s->txn->req.body_len,
+                        s->txn->req.eoh + 2);
        if (reql <= 0) {
                /* we need more data */
                appctx->ctx.stats.st_code = STAT_STATUS_NONE;
                return 0;
        }
 
-       first_param = temp->str;
-       end_params  = temp->str + reql;
+       first_param = temp->area;
+       end_params  = temp->area + reql;
        cur_param = next_param = end_params;
        *end_params = '\0';
 
@@ -3317,7 +3318,7 @@ static int stats_dump_info_to_buffer(struct stream_interface *si)
 static void stats_dump_json_schema(struct chunk *out)
 {
 
-       int old_len = out->len;
+       int old_len = out->data;
 
        chunk_strcat(out,
                     "{"
@@ -3510,7 +3511,7 @@ static void stats_dump_json_schema(struct chunk *out)
                      "}"
                     "}");
 
-       if (old_len == out->len) {
+       if (old_len == out->data) {
                chunk_reset(out);
                chunk_appendf(out,
                              "{\"errorStr\":\"output buffer too short\"}");
index 3c4e78309a72039d68bd9ba953e8a5614b679eb5..f688740af5ae71465b2098c1a7706379a3904788 100644 (file)
@@ -697,12 +697,12 @@ struct stktable_key *smp_to_stkey(struct sample *smp, struct stktable *t)
        case SMP_T_STR:
                if (!smp_make_safe(smp))
                        return NULL;
-               static_table_key.key = smp->data.u.str.str;
-               static_table_key.key_len = smp->data.u.str.len;
+               static_table_key.key = smp->data.u.str.area;
+               static_table_key.key_len = smp->data.u.str.data;
                break;
 
        case SMP_T_BIN:
-               if (smp->data.u.str.len < t->key_size) {
+               if (smp->data.u.str.data < t->key_size) {
                        /* This type needs padding with 0. */
                        if (!smp_make_rw(smp))
                                return NULL;
@@ -712,12 +712,12 @@ struct stktable_key *smp_to_stkey(struct sample *smp, struct stktable *t)
                                        return NULL;
                        if (smp->data.u.str.size < t->key_size)
                                return NULL;
-                       memset(smp->data.u.str.str + smp->data.u.str.len, 0,
-                              t->key_size - smp->data.u.str.len);
-                       smp->data.u.str.len = t->key_size;
+                       memset(smp->data.u.str.area + smp->data.u.str.data, 0,
+                              t->key_size - smp->data.u.str.data);
+                       smp->data.u.str.data = t->key_size;
                }
-               static_table_key.key = smp->data.u.str.str;
-               static_table_key.key_len = smp->data.u.str.len;
+               static_table_key.key = smp->data.u.str.area;
+               static_table_key.key_len = smp->data.u.str.data;
                break;
 
        default: /* impossible case. */
index d6ba1733ab7efa22738d45cfa690a97cd8e8d492..6c7bd5b93054e32374ba5cec8474186f4b82cc2b 100644 (file)
@@ -1232,8 +1232,8 @@ static int process_switching_rules(struct stream *s, struct channel *req, int an
                                        if (!tmp)
                                                goto sw_failed;
 
-                                       if (build_logline(s, tmp->str, tmp->size, &rule->be.expr))
-                                               backend = proxy_be_by_name(tmp->str);
+                                       if (build_logline(s, tmp->area, tmp->size, &rule->be.expr))
+                                               backend = proxy_be_by_name(tmp->area);
 
                                        free_trash_chunk(tmp);
                                        tmp = NULL;
@@ -2381,7 +2381,7 @@ struct task *process_stream(struct task *t, void *context, unsigned short state)
                                      s->uniq_id, s->be->id,
                                      objt_cs(si_f->end) ? (unsigned short)objt_cs(si_f->end)->conn->handle.fd : -1,
                                      objt_cs(si_b->end) ? (unsigned short)objt_cs(si_b->end)->conn->handle.fd : -1);
-                       shut_your_big_mouth_gcc(write(1, trash.str, trash.len));
+                       shut_your_big_mouth_gcc(write(1, trash.area, trash.data));
                }
 
                if (si_f->state == SI_ST_CLO &&
@@ -2390,7 +2390,7 @@ struct task *process_stream(struct task *t, void *context, unsigned short state)
                                      s->uniq_id, s->be->id,
                                      objt_cs(si_f->end) ? (unsigned short)objt_cs(si_f->end)->conn->handle.fd : -1,
                                      objt_cs(si_b->end) ? (unsigned short)objt_cs(si_b->end)->conn->handle.fd : -1);
-                       shut_your_big_mouth_gcc(write(1, trash.str, trash.len));
+                       shut_your_big_mouth_gcc(write(1, trash.area, trash.data));
                }
        }
 
@@ -2477,7 +2477,7 @@ struct task *process_stream(struct task *t, void *context, unsigned short state)
                              s->uniq_id, s->be->id,
                              objt_cs(si_f->end) ? (unsigned short)objt_cs(si_f->end)->conn->handle.fd : -1,
                              objt_cs(si_b->end) ? (unsigned short)objt_cs(si_b->end)->conn->handle.fd : -1);
-               shut_your_big_mouth_gcc(write(1, trash.str, trash.len));
+               shut_your_big_mouth_gcc(write(1, trash.area, trash.data));
        }
 
        s->logs.t_close = tv_ms_elapsed(&s->logs.tv_accept, &now);
index 8190108bfe45b51b0534cd20fabe8949e5545477..245f680379aafb03ff25ac1d40c8bbb3c513c3f6 100644 (file)
@@ -143,8 +143,8 @@ void stream_int_retnclose(struct stream_interface *si, const struct chunk *msg)
        channel_erase(ic);
        channel_truncate(oc);
 
-       if (likely(msg && msg->len))
-               co_inject(oc, msg->str, msg->len);
+       if (likely(msg && msg->data))
+               co_inject(oc, msg->area, msg->data);
 
        oc->wex = tick_add_ifset(now_ms, oc->wto);
        channel_auto_read(oc);
@@ -354,7 +354,9 @@ int conn_si_send_proxy(struct connection *conn, unsigned int flag)
                if (conn->mux == &mux_pt_ops && cs->data_cb == &si_conn_cb) {
                        struct stream_interface *si = cs->data;
                        struct conn_stream *remote_cs = objt_cs(si_opposite(si)->end);
-                       ret = make_proxy_line(trash.str, trash.size, objt_server(conn->target), remote_cs ? remote_cs->conn : NULL);
+                       ret = make_proxy_line(trash.area, trash.size,
+                                             objt_server(conn->target),
+                                             remote_cs ? remote_cs->conn : NULL);
                }
                else {
                        /* The target server expects a LOCAL line to be sent first. Retrieving
@@ -368,7 +370,8 @@ int conn_si_send_proxy(struct connection *conn, unsigned int flag)
                        if (!(conn->flags & CO_FL_ADDR_TO_SET))
                                goto out_wait;
 
-                       ret = make_proxy_line(trash.str, trash.size, objt_server(conn->target), conn);
+                       ret = make_proxy_line(trash.area, trash.size,
+                                             objt_server(conn->target), conn);
                }
 
                if (!ret)
@@ -380,7 +383,9 @@ int conn_si_send_proxy(struct connection *conn, unsigned int flag)
                /* we have to send trash from (ret+sp for -sp bytes). If the
                 * data layer has a pending write, we'll also set MSG_MORE.
                 */
-               ret = conn_sock_send(conn, trash.str + ret + conn->send_proxy_ofs, -conn->send_proxy_ofs,
+               ret = conn_sock_send(conn,
+                                    trash.area + ret + conn->send_proxy_ofs,
+                                    -conn->send_proxy_ofs,
                                     (conn->flags & CO_FL_XPRT_WR_ENA) ? MSG_MORE : 0);
 
                if (ret < 0)
index e21c5b717f108d765696777e8d405dd918d7a277..1b48dedb908d8073ecc7a0428055e3534c82ac77 100644 (file)
@@ -219,11 +219,12 @@ resume_execution:
                                if (cap[h->index] == NULL) /* no more capture memory */
                                        continue;
 
-                               len = key->data.u.str.len;
+                               len = key->data.u.str.data;
                                if (len > h->len)
                                        len = h->len;
 
-                               memcpy(cap[h->index], key->data.u.str.str, len);
+                               memcpy(cap[h->index], key->data.u.str.area,
+                                      len);
                                cap[h->index][len] = 0;
                        }
                        else {
@@ -600,7 +601,8 @@ static int tcp_parse_response_rule(char **args, int arg, int section_type,
                        action_build_list(&tcp_res_cont_keywords, &trash);
                        memprintf(err,
                                  "'%s %s' expects 'accept', 'close', 'reject', %s in %s '%s' (got '%s')",
-                                 args[0], args[1], trash.str, proxy_type_str(curpx), curpx->id, args[arg]);
+                                 args[0], args[1], trash.area,
+                                 proxy_type_str(curpx), curpx->id, args[arg]);
                        return -1;
                }
        }
@@ -849,7 +851,8 @@ static int tcp_parse_request_rule(char **args, int arg, int section_type,
                        memprintf(err,
                                  "'%s %s' expects 'accept', 'reject', 'track-sc0' ... 'track-sc%d', %s "
                                  "in %s '%s' (got '%s').\n",
-                                 args[0], args[1], MAX_SESS_STKCTR-1, trash.str, proxy_type_str(curpx),
+                                 args[0], args[1], MAX_SESS_STKCTR-1,
+                                 trash.area, proxy_type_str(curpx),
                                  curpx->id, args[arg]);
                        return -1;
                }
index 566ead6ec1ad48cf701eed22193d07ed4e7a3250..5787cf6edda223d3987874aaacb2c0f20d33a236 100644 (file)
@@ -95,12 +95,12 @@ unsigned int var_clear(struct var *var)
        unsigned int size = 0;
 
        if (var->data.type == SMP_T_STR || var->data.type == SMP_T_BIN) {
-               free(var->data.u.str.str);
-               size += var->data.u.str.len;
+               free(var->data.u.str.area);
+               size += var->data.u.str.data;
        }
        else if (var->data.type == SMP_T_METH && var->data.u.meth.meth == HTTP_METH_OTHER) {
-               free(var->data.u.meth.str.str);
-               size += var->data.u.meth.str.len;
+               free(var->data.u.meth.str.area);
+               size += var->data.u.meth.str.data;
        }
        LIST_DEL(&var->l);
        pool_free(var_pool, var);
@@ -343,12 +343,14 @@ static int sample_store(struct vars *vars, const char *name, struct sample *smp)
                /* free its used memory. */
                if (var->data.type == SMP_T_STR ||
                    var->data.type == SMP_T_BIN) {
-                       free(var->data.u.str.str);
-                       var_accounting_diff(vars, smp->sess, smp->strm, -var->data.u.str.len);
+                       free(var->data.u.str.area);
+                       var_accounting_diff(vars, smp->sess, smp->strm,
+                                           -var->data.u.str.data);
                }
                else if (var->data.type == SMP_T_METH && var->data.u.meth.meth == HTTP_METH_OTHER) {
-                       free(var->data.u.meth.str.str);
-                       var_accounting_diff(vars, smp->sess, smp->strm, -var->data.u.meth.str.len);
+                       free(var->data.u.meth.str.area);
+                       var_accounting_diff(vars, smp->sess, smp->strm,
+                                           -var->data.u.meth.str.data);
                }
        } else {
 
@@ -381,37 +383,41 @@ static int sample_store(struct vars *vars, const char *name, struct sample *smp)
                break;
        case SMP_T_STR:
        case SMP_T_BIN:
-               if (!var_accounting_add(vars, smp->sess, smp->strm, smp->data.u.str.len)) {
+               if (!var_accounting_add(vars, smp->sess, smp->strm, smp->data.u.str.data)) {
                        var->data.type = SMP_T_BOOL; /* This type doesn't use additional memory. */
                        return 0;
                }
-               var->data.u.str.str = malloc(smp->data.u.str.len);
-               if (!var->data.u.str.str) {
-                       var_accounting_diff(vars, smp->sess, smp->strm, -smp->data.u.str.len);
+               var->data.u.str.area = malloc(smp->data.u.str.data);
+               if (!var->data.u.str.area) {
+                       var_accounting_diff(vars, smp->sess, smp->strm,
+                                           -smp->data.u.str.data);
                        var->data.type = SMP_T_BOOL; /* This type doesn't use additional memory. */
                        return 0;
                }
-               var->data.u.str.len = smp->data.u.str.len;
-               memcpy(var->data.u.str.str, smp->data.u.str.str, var->data.u.str.len);
+               var->data.u.str.data = smp->data.u.str.data;
+               memcpy(var->data.u.str.area, smp->data.u.str.area,
+                      var->data.u.str.data);
                break;
        case SMP_T_METH:
                var->data.u.meth.meth = smp->data.u.meth.meth;
                if (smp->data.u.meth.meth != HTTP_METH_OTHER)
                        break;
 
-               if (!var_accounting_add(vars, smp->sess, smp->strm, smp->data.u.meth.str.len)) {
+               if (!var_accounting_add(vars, smp->sess, smp->strm, smp->data.u.meth.str.data)) {
                        var->data.type = SMP_T_BOOL; /* This type doesn't use additional memory. */
                        return 0;
                }
-               var->data.u.meth.str.str = malloc(smp->data.u.meth.str.len);
-               if (!var->data.u.meth.str.str) {
-                       var_accounting_diff(vars, smp->sess, smp->strm, -smp->data.u.meth.str.len);
+               var->data.u.meth.str.area = malloc(smp->data.u.meth.str.data);
+               if (!var->data.u.meth.str.area) {
+                       var_accounting_diff(vars, smp->sess, smp->strm,
+                                           -smp->data.u.meth.str.data);
                        var->data.type = SMP_T_BOOL; /* This type doesn't use additional memory. */
                        return 0;
                }
-               var->data.u.meth.str.len = smp->data.u.meth.str.len;
-               var->data.u.meth.str.size = smp->data.u.meth.str.len;
-               memcpy(var->data.u.meth.str.str, smp->data.u.meth.str.str, var->data.u.meth.str.len);
+               var->data.u.meth.str.data = smp->data.u.meth.str.data;
+               var->data.u.meth.str.size = smp->data.u.meth.str.data;
+               memcpy(var->data.u.meth.str.area, smp->data.u.meth.str.area,
+                      var->data.u.meth.str.data);
                break;
        }
        return 1;
@@ -497,7 +503,9 @@ int vars_check_arg(struct arg *arg, char **err)
        }
 
        /* Register new variable name. */
-       name = register_name(arg->data.str.str, arg->data.str.len, &scope, 1, err);
+       name = register_name(arg->data.str.area, arg->data.str.data, &scope,
+                            1,
+                            err);
        if (!name)
                return 0;
 
index 591fbdba3c279bfca14e9ec6b315c1f3c14528f2..9d2dfa6443eff32ae31f38ed8a05cdcddeb8a8a4 100644 (file)
@@ -576,8 +576,8 @@ static int ha_wurfl_get_all(const struct arg *args, struct sample *smp, const ch
        }
 
        wurfl_device_destroy(dHandle);
-       smp->data.u.str.str = temp->str;
-       smp->data.u.str.len = temp->len;
+       smp->data.u.str.area = temp->area;
+       smp->data.u.str.data = temp->data;
        return 1;
 }
 
@@ -602,9 +602,9 @@ static int ha_wurfl_get(const struct arg *args, struct sample *smp, const char *
        temp = get_trash_chunk();
        chunk_reset(temp);
 
-       while (args[i].data.str.str) {
+       while (args[i].data.str.area) {
                chunk_appendf(temp, "%c", global_wurfl.information_list_separator);
-               node = ebst_lookup(&global_wurfl.btree, args[i].data.str.str);
+               node = ebst_lookup(&global_wurfl.btree, args[i].data.str.area);
                wn = container_of(node, wurfl_data_t, nd);
 
                if (wn) {
@@ -644,15 +644,16 @@ static int ha_wurfl_get(const struct arg *args, struct sample *smp, const char *
                        }
 
                } else {
-                       ha_wurfl_log("WURFL: %s not in wurfl-information-list \n", args[i].data.str.str);
+                       ha_wurfl_log("WURFL: %s not in wurfl-information-list \n",
+                                    args[i].data.str.area);
                }
 
                i++;
        }
 
        wurfl_device_destroy(dHandle);
-       smp->data.u.str.str = temp->str;
-       smp->data.u.str.len = temp->len;
+       smp->data.u.str.area = temp->area;
+       smp->data.u.str.data = temp->data;
        return 1;
 }