Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 1 | /* |
| 2 | * HTTP sample conversion |
| 3 | * |
| 4 | * Copyright 2000-2018 Willy Tarreau <w@1wt.eu> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | #include <sys/types.h> |
| 14 | |
| 15 | #include <ctype.h> |
| 16 | #include <string.h> |
| 17 | #include <time.h> |
| 18 | |
Willy Tarreau | 4c7e4b7 | 2020-05-27 12:58:42 +0200 | [diff] [blame] | 19 | #include <haproxy/api.h> |
Willy Tarreau | b255105 | 2020-06-09 09:07:15 +0200 | [diff] [blame] | 20 | #include <haproxy/arg.h> |
Willy Tarreau | dfd3de8 | 2020-06-04 23:46:14 +0200 | [diff] [blame] | 21 | #include <haproxy/capture-t.h> |
Willy Tarreau | c13ed53 | 2020-06-02 10:22:45 +0200 | [diff] [blame] | 22 | #include <haproxy/chunk.h> |
Willy Tarreau | cd72d8c | 2020-06-02 19:11:26 +0200 | [diff] [blame] | 23 | #include <haproxy/http.h> |
Willy Tarreau | d0ef439 | 2020-06-02 09:38:52 +0200 | [diff] [blame] | 24 | #include <haproxy/pool.h> |
Willy Tarreau | e6ce10b | 2020-06-04 15:33:47 +0200 | [diff] [blame] | 25 | #include <haproxy/sample.h> |
Willy Tarreau | dfd3de8 | 2020-06-04 23:46:14 +0200 | [diff] [blame] | 26 | #include <haproxy/stream.h> |
Willy Tarreau | 48fbcae | 2020-06-03 18:09:46 +0200 | [diff] [blame] | 27 | #include <haproxy/tools.h> |
Willy Tarreau | d678805 | 2020-05-27 15:59:00 +0200 | [diff] [blame] | 28 | #include <haproxy/version.h> |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 29 | |
Damien Claisse | ae6f125 | 2019-10-30 15:57:28 +0000 | [diff] [blame] | 30 | static int smp_check_http_date_unit(struct arg *args, struct sample_conv *conv, |
| 31 | const char *file, int line, char **err) |
| 32 | { |
| 33 | return smp_check_date_unit(args, err); |
| 34 | } |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 35 | |
| 36 | /* takes an UINT value on input supposed to represent the time since EPOCH, |
| 37 | * adds an optional offset found in args[0] and emits a string representing |
Damien Claisse | ae6f125 | 2019-10-30 15:57:28 +0000 | [diff] [blame] | 38 | * the date in RFC-1123/5322 format. If optional unit param in args[1] is |
| 39 | * provided, decode timestamp in milliseconds ("ms") or microseconds("us"), |
| 40 | * and use relevant output date format. |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 41 | */ |
| 42 | static int sample_conv_http_date(const struct arg *args, struct sample *smp, void *private) |
| 43 | { |
| 44 | const char day[7][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; |
| 45 | const char mon[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; |
| 46 | struct buffer *temp; |
| 47 | struct tm *tm; |
Damien Claisse | ae6f125 | 2019-10-30 15:57:28 +0000 | [diff] [blame] | 48 | int sec_frac = 0; |
| 49 | time_t curr_date; |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 50 | |
| 51 | /* add offset */ |
Christopher Faulet | 72dbcfe | 2021-01-29 11:25:02 +0100 | [diff] [blame] | 52 | if (args[0].type == ARGT_SINT) |
Damien Claisse | ae6f125 | 2019-10-30 15:57:28 +0000 | [diff] [blame] | 53 | smp->data.u.sint += args[0].data.sint; |
| 54 | |
| 55 | /* report in milliseconds */ |
Christopher Faulet | 72dbcfe | 2021-01-29 11:25:02 +0100 | [diff] [blame] | 56 | if (args[1].type == ARGT_SINT && args[1].data.sint == TIME_UNIT_MS) { |
Damien Claisse | ae6f125 | 2019-10-30 15:57:28 +0000 | [diff] [blame] | 57 | sec_frac = smp->data.u.sint % 1000; |
| 58 | smp->data.u.sint /= 1000; |
| 59 | } |
| 60 | /* report in microseconds */ |
Christopher Faulet | 72dbcfe | 2021-01-29 11:25:02 +0100 | [diff] [blame] | 61 | else if (args[1].type == ARGT_SINT && args[1].data.sint == TIME_UNIT_US) { |
Damien Claisse | ae6f125 | 2019-10-30 15:57:28 +0000 | [diff] [blame] | 62 | sec_frac = smp->data.u.sint % 1000000; |
| 63 | smp->data.u.sint /= 1000000; |
| 64 | } |
| 65 | |
| 66 | /* With high numbers, the date returned can be negative, the 55 bits mask prevent this. */ |
| 67 | curr_date = smp->data.u.sint & 0x007fffffffffffffLL; |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 68 | |
| 69 | tm = gmtime(&curr_date); |
| 70 | if (!tm) |
| 71 | return 0; |
| 72 | |
| 73 | temp = get_trash_chunk(); |
Christopher Faulet | 72dbcfe | 2021-01-29 11:25:02 +0100 | [diff] [blame] | 74 | if (args[1].type == ARGT_SINT && args[1].data.sint != TIME_UNIT_S) { |
Damien Claisse | ae6f125 | 2019-10-30 15:57:28 +0000 | [diff] [blame] | 75 | temp->data = snprintf(temp->area, temp->size - temp->data, |
| 76 | "%s, %02d %s %04d %02d:%02d:%02d.%d GMT", |
| 77 | day[tm->tm_wday], tm->tm_mday, mon[tm->tm_mon], |
| 78 | 1900+tm->tm_year, |
| 79 | tm->tm_hour, tm->tm_min, tm->tm_sec, sec_frac); |
| 80 | } else { |
| 81 | temp->data = snprintf(temp->area, temp->size - temp->data, |
| 82 | "%s, %02d %s %04d %02d:%02d:%02d GMT", |
| 83 | day[tm->tm_wday], tm->tm_mday, mon[tm->tm_mon], |
| 84 | 1900+tm->tm_year, |
| 85 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
| 86 | } |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 87 | |
| 88 | smp->data.u.str = *temp; |
| 89 | smp->data.type = SMP_T_STR; |
| 90 | return 1; |
| 91 | } |
| 92 | |
| 93 | /* Arguments: The list of expected value, the number of parts returned and the separator */ |
| 94 | static int sample_conv_q_preferred(const struct arg *args, struct sample *smp, void *private) |
| 95 | { |
| 96 | const char *al = smp->data.u.str.area; |
| 97 | const char *end = al + smp->data.u.str.data; |
| 98 | const char *token; |
| 99 | int toklen; |
| 100 | int qvalue; |
| 101 | const char *str; |
| 102 | const char *w; |
| 103 | int best_q = 0; |
| 104 | |
| 105 | /* Set the constant to the sample, because the output of the |
| 106 | * function will be peek in the constant configuration string. |
| 107 | */ |
| 108 | smp->flags |= SMP_F_CONST; |
| 109 | smp->data.u.str.size = 0; |
| 110 | smp->data.u.str.area = ""; |
| 111 | smp->data.u.str.data = 0; |
| 112 | |
| 113 | /* Parse the accept language */ |
| 114 | while (1) { |
| 115 | |
| 116 | /* Jump spaces, quit if the end is detected. */ |
| 117 | while (al < end && isspace((unsigned char)*al)) |
| 118 | al++; |
| 119 | if (al >= end) |
| 120 | break; |
| 121 | |
Ilya Shipitsin | 46a030c | 2020-07-05 16:36:08 +0500 | [diff] [blame] | 122 | /* Start of the first word. */ |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 123 | token = al; |
| 124 | |
| 125 | /* Look for separator: isspace(), ',' or ';'. Next value if 0 length word. */ |
| 126 | while (al < end && *al != ';' && *al != ',' && !isspace((unsigned char)*al)) |
| 127 | al++; |
| 128 | if (al == token) |
| 129 | goto expect_comma; |
| 130 | |
| 131 | /* Length of the token. */ |
| 132 | toklen = al - token; |
| 133 | qvalue = 1000; |
| 134 | |
| 135 | /* Check if the token exists in the list. If the token not exists, |
| 136 | * jump to the next token. |
| 137 | */ |
| 138 | str = args[0].data.str.area; |
| 139 | w = str; |
| 140 | while (1) { |
| 141 | if (*str == ';' || *str == '\0') { |
| 142 | if (http_language_range_match(token, toklen, w, str - w)) |
| 143 | goto look_for_q; |
| 144 | if (*str == '\0') |
| 145 | goto expect_comma; |
| 146 | w = str + 1; |
| 147 | } |
| 148 | str++; |
| 149 | } |
| 150 | goto expect_comma; |
| 151 | |
| 152 | look_for_q: |
| 153 | |
| 154 | /* Jump spaces, quit if the end is detected. */ |
| 155 | while (al < end && isspace((unsigned char)*al)) |
| 156 | al++; |
| 157 | if (al >= end) |
| 158 | goto process_value; |
| 159 | |
| 160 | /* If ',' is found, process the result */ |
| 161 | if (*al == ',') |
| 162 | goto process_value; |
| 163 | |
| 164 | /* If the character is different from ';', look |
| 165 | * for the end of the header part in best effort. |
| 166 | */ |
| 167 | if (*al != ';') |
| 168 | goto expect_comma; |
| 169 | |
| 170 | /* Assumes that the char is ';', now expect "q=". */ |
| 171 | al++; |
| 172 | |
| 173 | /* Jump spaces, process value if the end is detected. */ |
| 174 | while (al < end && isspace((unsigned char)*al)) |
| 175 | al++; |
| 176 | if (al >= end) |
| 177 | goto process_value; |
| 178 | |
| 179 | /* Expect 'q'. If no 'q', continue in best effort */ |
| 180 | if (*al != 'q') |
| 181 | goto process_value; |
| 182 | al++; |
| 183 | |
| 184 | /* Jump spaces, process value if the end is detected. */ |
| 185 | while (al < end && isspace((unsigned char)*al)) |
| 186 | al++; |
| 187 | if (al >= end) |
| 188 | goto process_value; |
| 189 | |
| 190 | /* Expect '='. If no '=', continue in best effort */ |
| 191 | if (*al != '=') |
| 192 | goto process_value; |
| 193 | al++; |
| 194 | |
| 195 | /* Jump spaces, process value if the end is detected. */ |
| 196 | while (al < end && isspace((unsigned char)*al)) |
| 197 | al++; |
| 198 | if (al >= end) |
| 199 | goto process_value; |
| 200 | |
| 201 | /* Parse the q value. */ |
| 202 | qvalue = http_parse_qvalue(al, &al); |
| 203 | |
| 204 | process_value: |
| 205 | |
| 206 | /* If the new q value is the best q value, then store the associated |
| 207 | * language in the response. If qvalue is the biggest value (1000), |
| 208 | * break the process. |
| 209 | */ |
| 210 | if (qvalue > best_q) { |
| 211 | smp->data.u.str.area = (char *)w; |
| 212 | smp->data.u.str.data = str - w; |
| 213 | if (qvalue >= 1000) |
| 214 | break; |
| 215 | best_q = qvalue; |
| 216 | } |
| 217 | |
| 218 | expect_comma: |
| 219 | |
| 220 | /* Expect comma or end. If the end is detected, quit the loop. */ |
| 221 | while (al < end && *al != ',') |
| 222 | al++; |
| 223 | if (al >= end) |
| 224 | break; |
| 225 | |
| 226 | /* Comma is found, jump it and restart the analyzer. */ |
| 227 | al++; |
| 228 | } |
| 229 | |
| 230 | /* Set default value if required. */ |
| 231 | if (smp->data.u.str.data == 0 && args[1].type == ARGT_STR) { |
| 232 | smp->data.u.str.area = args[1].data.str.area; |
| 233 | smp->data.u.str.data = args[1].data.str.data; |
| 234 | } |
| 235 | |
| 236 | /* Return true only if a matching language was found. */ |
| 237 | return smp->data.u.str.data != 0; |
| 238 | } |
| 239 | |
| 240 | /* This fetch url-decode any input string. */ |
| 241 | static int sample_conv_url_dec(const struct arg *args, struct sample *smp, void *private) |
| 242 | { |
Willy Tarreau | 62ba9ba | 2020-04-23 17:54:47 +0200 | [diff] [blame] | 243 | int in_form = 0; |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 244 | int len; |
| 245 | |
Joseph Herlant | 942eea3 | 2018-11-15 13:57:22 -0800 | [diff] [blame] | 246 | /* If the constant flag is set or if not size is available at |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 247 | * the end of the buffer, copy the string in other buffer |
| 248 | * before decoding. |
| 249 | */ |
| 250 | if (smp->flags & SMP_F_CONST || smp->data.u.str.size <= smp->data.u.str.data) { |
| 251 | struct buffer *str = get_trash_chunk(); |
| 252 | memcpy(str->area, smp->data.u.str.area, smp->data.u.str.data); |
| 253 | smp->data.u.str.area = str->area; |
| 254 | smp->data.u.str.size = str->size; |
| 255 | smp->flags &= ~SMP_F_CONST; |
| 256 | } |
| 257 | |
| 258 | /* Add final \0 required by url_decode(), and convert the input string. */ |
| 259 | smp->data.u.str.area[smp->data.u.str.data] = '\0'; |
Willy Tarreau | 62ba9ba | 2020-04-23 17:54:47 +0200 | [diff] [blame] | 260 | |
Christopher Faulet | 72dbcfe | 2021-01-29 11:25:02 +0100 | [diff] [blame] | 261 | if (args[0].type == ARGT_SINT) |
Willy Tarreau | 62ba9ba | 2020-04-23 17:54:47 +0200 | [diff] [blame] | 262 | in_form = !!args[0].data.sint; |
| 263 | |
| 264 | len = url_decode(smp->data.u.str.area, in_form); |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 265 | if (len < 0) |
| 266 | return 0; |
| 267 | smp->data.u.str.data = len; |
| 268 | return 1; |
| 269 | } |
| 270 | |
William Dauchy | 888b0ae | 2021-01-06 23:39:50 +0100 | [diff] [blame] | 271 | /* url-encode types and encode maps */ |
| 272 | enum encode_type { |
| 273 | ENC_QUERY = 0, |
| 274 | }; |
| 275 | long query_encode_map[(256 / 8) / sizeof(long)]; |
| 276 | |
| 277 | /* Check url-encode type */ |
| 278 | static int sample_conv_url_enc_check(struct arg *arg, struct sample_conv *conv, |
| 279 | const char *file, int line, char **err) |
| 280 | { |
| 281 | enum encode_type enc_type; |
| 282 | |
| 283 | if (strcmp(arg->data.str.area, "") == 0) |
| 284 | enc_type = ENC_QUERY; |
| 285 | else if (strcmp(arg->data.str.area, "query") == 0) |
| 286 | enc_type = ENC_QUERY; |
| 287 | else { |
| 288 | memprintf(err, "Unexpected encode type. " |
| 289 | "Allowed value is 'query'"); |
| 290 | return 0; |
| 291 | } |
| 292 | |
| 293 | chunk_destroy(&arg->data.str); |
| 294 | arg->type = ARGT_SINT; |
| 295 | arg->data.sint = enc_type; |
| 296 | return 1; |
| 297 | } |
| 298 | |
| 299 | /* Initializes some url encode data at boot */ |
| 300 | static void sample_conf_url_enc_init() |
| 301 | { |
| 302 | int i; |
| 303 | |
| 304 | memset(query_encode_map, 0, sizeof(query_encode_map)); |
| 305 | /* use rfc3986 to determine list of characters to keep unchanged for |
| 306 | * query string */ |
| 307 | for (i = 0; i < 256; i++) { |
| 308 | if (!((i >= 'a' && i <= 'z') || (i >= 'A' && i <= 'Z') |
| 309 | || (i >= '0' && i <= '9') || |
| 310 | i == '-' || i == '.' || i == '_' || i == '~')) |
| 311 | ha_bit_set(i, query_encode_map); |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | INITCALL0(STG_PREPARE, sample_conf_url_enc_init); |
| 316 | |
| 317 | /* This fetch url-encode any input string. Only support query string for now */ |
| 318 | static int sample_conv_url_enc(const struct arg *args, struct sample *smp, void |
| 319 | *private) |
| 320 | { |
| 321 | enum encode_type enc_type; |
| 322 | struct buffer *trash = get_trash_chunk(); |
| 323 | long *encode_map; |
| 324 | char *ret; |
| 325 | |
| 326 | enc_type = ENC_QUERY; |
Christopher Faulet | 72dbcfe | 2021-01-29 11:25:02 +0100 | [diff] [blame] | 327 | enc_type = args->data.sint; |
William Dauchy | 888b0ae | 2021-01-06 23:39:50 +0100 | [diff] [blame] | 328 | |
| 329 | /* Add final \0 required by encode_string() */ |
| 330 | smp->data.u.str.area[smp->data.u.str.data] = '\0'; |
| 331 | |
| 332 | if (enc_type == ENC_QUERY) |
| 333 | encode_map = query_encode_map; |
| 334 | else |
| 335 | return 0; |
| 336 | |
| 337 | ret = encode_string(trash->area, trash->area + trash->size, '%', |
| 338 | encode_map, smp->data.u.str.area); |
| 339 | if (ret == NULL || *ret != '\0') |
| 340 | return 0; |
| 341 | trash->data = ret - trash->area; |
| 342 | smp->data.u.str = *trash; |
| 343 | return 1; |
| 344 | } |
| 345 | |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 346 | static int smp_conv_req_capture(const struct arg *args, struct sample *smp, void *private) |
| 347 | { |
Willy Tarreau | 5575896 | 2020-04-29 11:22:08 +0200 | [diff] [blame] | 348 | struct proxy *fe; |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 349 | int idx, i; |
| 350 | struct cap_hdr *hdr; |
| 351 | int len; |
| 352 | |
Christopher Faulet | 72dbcfe | 2021-01-29 11:25:02 +0100 | [diff] [blame] | 353 | if (args->type != ARGT_SINT) |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 354 | return 0; |
| 355 | |
Willy Tarreau | 5575896 | 2020-04-29 11:22:08 +0200 | [diff] [blame] | 356 | if (!smp->strm) |
| 357 | return 0; |
| 358 | |
| 359 | fe = strm_fe(smp->strm); |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 360 | idx = args->data.sint; |
| 361 | |
| 362 | /* Check the availibity of the capture id. */ |
| 363 | if (idx > fe->nb_req_cap - 1) |
| 364 | return 0; |
| 365 | |
| 366 | /* Look for the original configuration. */ |
| 367 | for (hdr = fe->req_cap, i = fe->nb_req_cap - 1; |
| 368 | hdr != NULL && i != idx ; |
| 369 | i--, hdr = hdr->next); |
| 370 | if (!hdr) |
| 371 | return 0; |
| 372 | |
| 373 | /* check for the memory allocation */ |
| 374 | if (smp->strm->req_cap[hdr->index] == NULL) |
| 375 | smp->strm->req_cap[hdr->index] = pool_alloc(hdr->pool); |
| 376 | if (smp->strm->req_cap[hdr->index] == NULL) |
| 377 | return 0; |
| 378 | |
| 379 | /* Check length. */ |
| 380 | len = smp->data.u.str.data; |
| 381 | if (len > hdr->len) |
| 382 | len = hdr->len; |
| 383 | |
| 384 | /* Capture input data. */ |
| 385 | memcpy(smp->strm->req_cap[idx], smp->data.u.str.area, len); |
| 386 | smp->strm->req_cap[idx][len] = '\0'; |
| 387 | |
| 388 | return 1; |
| 389 | } |
| 390 | |
| 391 | static int smp_conv_res_capture(const struct arg *args, struct sample *smp, void *private) |
| 392 | { |
Willy Tarreau | 5575896 | 2020-04-29 11:22:08 +0200 | [diff] [blame] | 393 | struct proxy *fe; |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 394 | int idx, i; |
| 395 | struct cap_hdr *hdr; |
| 396 | int len; |
| 397 | |
Christopher Faulet | 72dbcfe | 2021-01-29 11:25:02 +0100 | [diff] [blame] | 398 | if (args->type != ARGT_SINT) |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 399 | return 0; |
| 400 | |
Willy Tarreau | 5575896 | 2020-04-29 11:22:08 +0200 | [diff] [blame] | 401 | if (!smp->strm) |
| 402 | return 0; |
| 403 | |
| 404 | fe = strm_fe(smp->strm); |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 405 | idx = args->data.sint; |
| 406 | |
| 407 | /* Check the availibity of the capture id. */ |
| 408 | if (idx > fe->nb_rsp_cap - 1) |
| 409 | return 0; |
| 410 | |
| 411 | /* Look for the original configuration. */ |
| 412 | for (hdr = fe->rsp_cap, i = fe->nb_rsp_cap - 1; |
| 413 | hdr != NULL && i != idx ; |
| 414 | i--, hdr = hdr->next); |
| 415 | if (!hdr) |
| 416 | return 0; |
| 417 | |
| 418 | /* check for the memory allocation */ |
| 419 | if (smp->strm->res_cap[hdr->index] == NULL) |
| 420 | smp->strm->res_cap[hdr->index] = pool_alloc(hdr->pool); |
| 421 | if (smp->strm->res_cap[hdr->index] == NULL) |
| 422 | return 0; |
| 423 | |
| 424 | /* Check length. */ |
| 425 | len = smp->data.u.str.data; |
| 426 | if (len > hdr->len) |
| 427 | len = hdr->len; |
| 428 | |
| 429 | /* Capture input data. */ |
| 430 | memcpy(smp->strm->res_cap[idx], smp->data.u.str.area, len); |
| 431 | smp->strm->res_cap[idx][len] = '\0'; |
| 432 | |
| 433 | return 1; |
| 434 | } |
| 435 | |
| 436 | /************************************************************************/ |
| 437 | /* All supported converter keywords must be declared here. */ |
| 438 | /************************************************************************/ |
| 439 | |
| 440 | /* Note: must not be declared <const> as its list will be overwritten */ |
| 441 | static struct sample_conv_kw_list sample_conv_kws = {ILH, { |
Damien Claisse | ae6f125 | 2019-10-30 15:57:28 +0000 | [diff] [blame] | 442 | { "http_date", sample_conv_http_date, ARG2(0,SINT,STR), smp_check_http_date_unit, SMP_T_SINT, SMP_T_STR}, |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 443 | { "language", sample_conv_q_preferred, ARG2(1,STR,STR), NULL, SMP_T_STR, SMP_T_STR}, |
| 444 | { "capture-req", smp_conv_req_capture, ARG1(1,SINT), NULL, SMP_T_STR, SMP_T_STR}, |
| 445 | { "capture-res", smp_conv_res_capture, ARG1(1,SINT), NULL, SMP_T_STR, SMP_T_STR}, |
Willy Tarreau | 62ba9ba | 2020-04-23 17:54:47 +0200 | [diff] [blame] | 446 | { "url_dec", sample_conv_url_dec, ARG1(0,SINT), NULL, SMP_T_STR, SMP_T_STR}, |
William Dauchy | 888b0ae | 2021-01-06 23:39:50 +0100 | [diff] [blame] | 447 | { "url_enc", sample_conv_url_enc, ARG1(1,STR), sample_conv_url_enc_check, SMP_T_STR, SMP_T_STR}, |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 448 | { NULL, NULL, 0, 0, 0 }, |
| 449 | }}; |
| 450 | |
Willy Tarreau | 0108d90 | 2018-11-25 19:14:37 +0100 | [diff] [blame] | 451 | INITCALL1(STG_REGISTER, sample_register_convs, &sample_conv_kws); |
Willy Tarreau | 79e5733 | 2018-10-02 16:01:16 +0200 | [diff] [blame] | 452 | |
| 453 | /* |
| 454 | * Local variables: |
| 455 | * c-indent-level: 8 |
| 456 | * c-basic-offset: 8 |
| 457 | * End: |
| 458 | */ |