From 2d0a174cecd0ad606d4d0d1b3767ca2f9580fead Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Wed, 7 Apr 2021 10:59:28 +0900 Subject: [PATCH] webclient: 304 and 305 are not really redirects Eg. The docker API sometimes returns 304 even for requests without etags. https://docs.docker.com/engine/api/v1.40/#operation/ContainerStop --- netutils/webclient/webclient.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/netutils/webclient/webclient.c b/netutils/webclient/webclient.c index abed0261c..1379d8eda 100644 --- a/netutils/webclient/webclient.c +++ b/netutils/webclient/webclient.c @@ -423,9 +423,15 @@ static inline int wget_parsestatus(struct webclient_context *ctx, /* Check for 3xx (Redirection) * Location: header line will contain the new location. + * + * Note: the following 3xx are not redirects. + * 304 not modified + * 305 use proxy */ - else if ((http_status / 100) == 3) + else if ((http_status / 100) == 3 && + (http_status != 304) && + (http_status != 305)) { ws->httpstatus = HTTPSTATUS_MOVED; }