Re: Cloning from sites with 404 overridden

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: Cloning from sites with 404 overridden

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:22

Nick Hengeveld [off-list ref] writes:
Some HTTP server environments return a 200 status and text/html error
document or a redirect to one rather than a 404 status if a loose
object does not exist.  This patch detects and reports this condition
to differentiate between a misconfigured server and an actual corrupt
object on the server.
quoted hunk
61069cc348640fef2b8c503b8b8f00f689872cab
diff --git a/http-fetch.c b/http-fetch.c
index dc67218..ee5b585 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -41,6 +41,7 @@ struct object_request
 	CURLcode curl_result;
...
+	char *content_type;
 	unsigned char real_sha1[20];
...
You probably need only one bit here,...
quoted hunk
@@ -258,9 +259,15 @@ static void finish_object_request(struct
 
 static void process_object_response(void *callback_data)
...  
+	curl_easy_getinfo(obj_req->slot->curl, CURLINFO_CONTENT_TYPE,
+			  &content_type);
+	if (content_type)
+		obj_req->content_type = strdup(content_type);
+
... and note if that is an HTML document or not.

We do bend backwards to support ISP HTTP servers, but this might
be going a bit too far.  Also I wonder if ISP runs a really
dumb-friendly configured server that defaults to text/html
unless the mimemap says otherwise.  Loose object files do not
have suffixes and I am expecting these servers would give
whatever the server default is.

Re: Cloning from sites with 404 overridden

From: Radoslaw Szkodzinski <hidden>
Date: 2016-06-15 22:42:22

On Wednesday 22 March 2006 20:05, Junio C Hamano wrote yet:
.. and note if that is an HTML document or not.
Better yet, see first if the object is corrupt. If it is and its Content-Type 
is text/html, error out.
We do bend backwards to support ISP HTTP servers, but this might
be going a bit too far.  Also I wonder if ISP runs a really
dumb-friendly configured server that defaults to text/html
unless the mimemap says otherwise.  Loose object files do not
have suffixes and I am expecting these servers would give
whatever the server default is.
That server would break a *lot* of file types. That admin should be hanged, 
shot, then burned.

I think of only one reason for doing that: to restrict file types posted on 
the server to, say, zip and html.

-- 
GPG Key id:  0xD1F10BA2
Fingerprint: 96E2 304A B9C4 949A 10A0  9105 9543 0453 D1F1 0BA2

AstralStorm
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help