From d277e80771a1a5cae19d21bfd895b4e16b3ca959 Mon Sep 17 00:00:00 2001 From: bptato Date: Tue, 2 Feb 2021 23:59:42 +0100 Subject: Some cleanup for base64_encode --- file.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'file.c') diff --git a/file.c b/file.c index 0e6a79a..04d7c8f 100644 --- a/file.c +++ b/file.c @@ -1175,7 +1175,11 @@ AuthBasicCred(struct http_auth *ha, Str uname, Str pw, ParsedURL *pu, Str s = Strdup(uname); Strcat_char(s, ':'); Strcat(s, pw); - return Strnew_m_charp("Basic ", base64_encode(s->ptr, s->length), NULL); + char *base64 = base64_encode(s->ptr, s->length); + if (!base64) + return Strnew_charp("Basic "); + else + return Strnew_m_charp("Basic ", base64, NULL); } #ifdef USE_DIGEST_AUTH -- cgit v1.2.3