From 5e0b24f3a921081162706598d1ebea9d403d3187 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 23 Mar 2014 01:11:15 +0100 Subject: [PATCH] move nc to struct uclient_http Signed-off-by: Felix Fietkau --- uclient-http.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/uclient-http.c b/uclient-http.c index b7c64c8..1cc60e3 100644 --- a/uclient-http.c +++ b/uclient-http.c @@ -12,8 +12,6 @@ #include "uclient-utils.h" #include "uclient-backend.h" -static uint32_t nc; - enum auth_type { AUTH_TYPE_UNKNOWN, AUTH_TYPE_NONE, @@ -64,6 +62,8 @@ struct uclient_http { long read_chunked; long content_length; + uint32_t nc; + struct blob_buf headers; struct blob_buf meta; }; @@ -275,7 +275,7 @@ static bool strmatch(char **str, const char *prefix) static void get_cnonce(char *dest) { - uint32_t val = nc; + uint32_t val = 0; FILE *f; f = fopen("/dev/urandom", "r"); @@ -376,7 +376,7 @@ uclient_http_add_auth_digest(struct uclient_http *uh) if (!realm || !data.qop || !data.nonce) return; - sprintf(nc_str, "%08x", nc++); + sprintf(nc_str, "%08x", uh->nc++); get_cnonce(cnonce_str); data.qop = "auth"; -- 2.30.2