-
Notifications
You must be signed in to change notification settings - Fork 27
Work around Google HTTP client giving null content for HEAD requests #116
Comments
Do you mean it returns it in the body or the headers? The body should be null or empty, and if the Google HTTP client is returning null headers that's a bug we need to report upstream. |
The Google HTTP client intentionally wipes empty the body for the response of any HEAD request. This follows the RFC specs for HEAD requests, but the Docker registry can send content bodies back as responses to HEAD requests. |
I suspect Docker is violating the HTTP spec. We probably shouldn't depend on that. |
This would be a violation of HTTP. Per the HTTP 1.1 spec: "The HEAD method is identical to GET except that the server MUST NOT |
Yeah, it is. This issue might not be something we can fix. Also, the only benefit of fixing this issue would be more fine-grained error messages. We can just keep it as is and assume any HTTP Not Found error when performing the BLOB-check HEAD request means the BLOB doesn't exist. |
If they are really doing this, we need to file a bug against them. That's very broken. A 404 should be fully sufficient to demonstrate non-existence. |
The 404 response for a BLOB check can contain other error codes in the response body besides |
If that's what you want you need a GET, not a HEAD. Seriously, I cannot emphasize how broken this is. The Google HTTP client library is hardly the only thing out there on the Internet that is going strip bodies from HEAD responses. If Docker is doing this we need to file a bug against them. |
You can't do a HEAD then a GET to get the reason? |
Yes, you can do that. Just don't ever expect to see a body in a HEAD response. |
@loosebazooka Yep, that sounds like a reasonable way to get around this issue. |
Moved to GoogleContainerTools/jib#21 |
The Google HTTP client gives null content for HEAD requests. Docker registry can return useful content for HEAD responses. In
BlobChecker
, this content can contain useful registry error codes to parse.The text was updated successfully, but these errors were encountered: