diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h index e07b55003..0fe779090 100644 --- a/include/proto/proto_http.h +++ b/include/proto/proto_http.h @@ -95,7 +95,6 @@ extern const int http_err_codes[HTTP_ERR_SIZE]; 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; int process_cli(struct stream *s); int process_srv_data(struct stream *s); diff --git a/src/haproxy.c b/src/haproxy.c index 27d441735..488a07617 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -1718,7 +1718,6 @@ static void init(int argc, char **argv) exit(1); } - get_http_auth_buff = calloc(1, global.tune.bufsize); fdinfo = calloc(1, sizeof(struct fdinfo) * (global.maxsock)); fdtab = calloc(1, sizeof(struct fdtab) * (global.maxsock)); @@ -2122,7 +2121,6 @@ void deinit(void) free(fdinfo); fdinfo = NULL; free(fdtab); fdtab = NULL; free(oldpids); oldpids = NULL; - free(get_http_auth_buff); get_http_auth_buff = NULL; free(global_listener_queue_task); global_listener_queue_task = NULL; list_for_each_entry_safe(log, logb, &global.logsrvs, list) { diff --git a/src/proto_http.c b/src/proto_http.c index 439e57fce..ffa2f2a05 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -1663,11 +1663,6 @@ const char *http_parse_reqline(struct http_msg *msg, * have the credentials overwritten by another stream in parallel. */ -/* This bufffer is initialized in the file 'src/haproxy.c'. This length is - * set according to global.tune.bufsize. - */ -char *get_http_auth_buff; - int get_http_auth(struct stream *s) { @@ -1713,22 +1708,23 @@ 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)) { + struct chunk *http_auth = get_trash_chunk(); len = base64dec(txn->auth.method_data.str, txn->auth.method_data.len, - get_http_auth_buff, global.tune.bufsize - 1); + http_auth->str, global.tune.bufsize - 1); if (len < 0) return 0; - get_http_auth_buff[len] = '\0'; + http_auth->str[len] = '\0'; - p = strchr(get_http_auth_buff, ':'); + p = strchr(http_auth->str, ':'); if (!p) return 0; - txn->auth.user = get_http_auth_buff; + txn->auth.user = http_auth->str; *p = '\0'; txn->auth.pass = p+1;