Treat HTTP 304 codes as non-fatal

We set the If-Modified-Since header field for each GET request, and if
the condition fails, the server will respond with HTTP 304.

The 304 means the cached debuginfo is up-to-date, not requiring a fresh
download. Since this condition is non-fatal, avoid swapping the download
URLs in this case.
This commit is contained in:
Patrick McCarty
2015-10-02 12:15:02 -07:00
parent af4a3f64f0
commit ab0e59628f
+7 -1
View File
@@ -122,7 +122,13 @@ static int curl_get_file(const char *url, const char *prefix, time_t timestamp)
fflush(file);
// printf("HTTP return code is %i\n", ret);
if (ret != 200 && ret != 404)
/* HTTP 304 is returned if (a) the cached debuginfo has the same
* timestamp or is newer than that on the server and (b) we haven't
* already added the URL to the hash table. So, the first crash for a
* boot may result in a 304 if the debuginfo had been downloaded in a
* previous boot.
*/
if (ret != 200 && ret != 404 && ret != 304)
urlcounter++;
if (ret == 200) {