| ... | ... | @@ -489,8 +489,15 @@ fn fetchAndUnpack( |
| 489 | 489 | try req.start(); |
| 490 | 490 | try req.wait(); |
| 491 | 491 | |
| 492 | if (req.response.status != .ok) { |
| 493 | return report.fail(dep.url_tok, "Expected response status '200 OK' got '{} {s}'", .{ |
| 494 | @enumToInt(req.response.status), |
| 495 | req.response.status.phrase() orelse "", |
| 496 | }); |
| 497 | } |
| 498 | |
| 492 | 499 | const content_type = req.response.headers.getFirstValue("Content-Type") orelse |
| 493 | | return report.fail(dep.url_tok, "missing Content-Type for '{s}'", .{uri.path}); |
| 500 | return report.fail(dep.url_tok, "Missing 'Content-Type' header", .{}); |
| 494 | 501 | |
| 495 | 502 | if (ascii.eqlIgnoreCase(content_type, "application/gzip") or |
| 496 | 503 | ascii.eqlIgnoreCase(content_type, "application/x-gzip") or |
| ... | ... | @@ -504,7 +511,7 @@ fn fetchAndUnpack( |
| 504 | 511 | // by default, so the same logic applies for buffering the reader as for gzip. |
| 505 | 512 | try unpackTarball(gpa, &req, tmp_directory.handle, std.compress.xz); |
| 506 | 513 | } else { |
| 507 | | return report.fail(dep.url_tok, "unknown file extension for path '{s}'", .{uri.path}); |
| 514 | return report.fail(dep.url_tok, "Unsupported 'Content-Type' header value: '{s}'", .{content_type}); |
| 508 | 515 | } |
| 509 | 516 | |
| 510 | 517 | // TODO: delete files not included in the package prior to computing the package hash. |