From: Alberto Leiva Popper Date: Sun, 16 Jan 2022 22:24:14 +0000 (-0600) Subject: HTTP: Result code 304 quick fix X-Git-Tag: 1.5.4~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5464579f5950a70c4c19dd0ab359a2b413ccadfe;p=thirdparty%2FFORT-validator.git HTTP: Result code 304 quick fix Dirty version of the equivalent patch from the rrdp-refactor branch. 304 is neither an error nor a redirect. It needs to be handled as a skip. --- diff --git a/src/http/http.c b/src/http/http.c index b63a008a..d210f1d1 100644 --- a/src/http/http.c +++ b/src/http/http.c @@ -277,6 +277,10 @@ http_fetch(struct http_handler *handler, char const *uri, long *response_code, pr_val_err("HTTP result code: %ld", http_code); return handle_http_response_code(http_code); } + if (http_code == 304) { + pr_val_debug("Not modified."); + return 0; + } if (http_code >= 300) { /* * If you're ever forced to implement this, please remember that @@ -406,6 +410,8 @@ __http_download_file(struct rpki_uri *uri, long *response_code, long ims_value, http_easy_cleanup(&handler); file_close(out); + if ((*response_code) == 304) + goto end; if (error) goto delete_dir; @@ -418,6 +424,7 @@ __http_download_file(struct rpki_uri *uri, long *response_code, long ims_value, goto delete_dir; } +end: free(tmp_file); return 0; close_file: