extern struct chunk http_err_chunks[HTTP_ERR_SIZE];
extern const char *HTTP_302;
extern const char *HTTP_303;
+extern char *get_http_auth_buff;
#define HTTP_IS_CTL(x) (http_is_ctl[(unsigned char)(x)])
#define HTTP_IS_SEP(x) (http_is_sep[(unsigned char)(x)])
#include <types/sample.h>
#include <types/stick_table.h>
+/* only exported for late memory allocation, do not use */
+extern char *sample_trash_buf1;
+extern char *sample_trash_buf2;
+
struct sample_expr *sample_parse_expr(char **str, int *idx, char *err, int err_size);
struct sample *sample_process(struct proxy *px, struct session *l4,
void *l7, unsigned int dir, struct sample_expr *expr,
global.nbproc = 1;
swap_buffer = (char *)calloc(1, global.tune.bufsize);
+ sample_trash_buf1 = (char *)calloc(1, global.tune.bufsize);
+ sample_trash_buf2 = (char *)calloc(1, global.tune.bufsize);
+ get_http_auth_buff = (char *)calloc(1, global.tune.bufsize);
+
fdinfo = (struct fdinfo *)calloc(1,
sizeof(struct fdinfo) * (global.maxsock));
* searching again for something we are unable to find anyway.
*/
-char get_http_auth_buff[BUFSIZE];
+char *get_http_auth_buff;
int
get_http_auth(struct session *s)
if (!strncasecmp("Basic", auth_method.str, auth_method.len)) {
len = base64dec(txn->auth.method_data.str, txn->auth.method_data.len,
- get_http_auth_buff, BUFSIZE - 1);
+ get_http_auth_buff, global.tune.bufsize - 1);
if (len < 0)
return 0;
#include <arpa/inet.h>
#include <stdio.h>
+#include <types/global.h>
+
#include <common/chunk.h>
#include <common/standard.h>
static struct chunk trash_chunk;
/* trash buffers used or sample conversions */
-static char sample_trash_buf1[BUFSIZE];
-static char sample_trash_buf2[BUFSIZE];
-
-/* sample_trash_buf point on used buffer*/
-static char *sample_trash_buf = sample_trash_buf1;
+char *sample_trash_buf1;
+char *sample_trash_buf2;
/* list head of all known sample fetch keywords */
static struct sample_fetch_kw_list sample_fetches = {
*/
struct chunk *sample_get_trash_chunk(void)
{
- if (sample_trash_buf == sample_trash_buf1)
- sample_trash_buf = sample_trash_buf2;
- else
- sample_trash_buf = sample_trash_buf1;
+ char *sample_trash_buf;
+
+ sample_trash_buf = sample_trash_buf1;
+ sample_trash_buf1 = sample_trash_buf2;
+ sample_trash_buf2 = sample_trash_buf1;
- chunk_init(&trash_chunk, sample_trash_buf, BUFSIZE);
+ chunk_init(&trash_chunk, sample_trash_buf, global.tune.bufsize);
return &trash_chunk;
}