git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Trivial support for cloning and fetching via ftp://.

From
Junio C Hamano <junkio@cox.net>
Date
Sep 16, 2006, 17:29 UTC
Message-ID
<7virjnafev.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20060916100147.GA17504@sashak.voltaire.com>
Sasha Khapyorsky <sashak@voltaire.com> writes:
Show 36 quoted lines
>> > diff --git a/http-fetch.c b/http-fetch.c
>> > index a113bb8..46d6029 100644
>> > --- a/http-fetch.c
>> > +++ b/http-fetch.c
>> > @@ -324,7 +324,9 @@ static void process_object_response(void
>> >  
>> >  	/* Use alternates if necessary */
>> >  	if (obj_req->http_code == 404 ||
>> > -	    obj_req->curl_result == CURLE_FILE_COULDNT_READ_FILE) {
>> > +	    obj_req->curl_result == CURLE_FILE_COULDNT_READ_FILE ||
>> > +	    (obj_req->http_code == 550 &&
>> > +	     obj_req->curl_result == CURLE_FTP_COULDNT_RETR_FILE)) {
>> 
>> Here you do the same as the code would for HTTP 404 when you get
>> 550 _and_ RETR failure...
>> 
>> > @@ -538,7 +540,9 @@ static void process_alternates_response(
>> >  		}
>> >  	} else if (slot->curl_result != CURLE_OK) {
>> >  		if (slot->http_code != 404 &&
>> > -		    slot->curl_result != CURLE_FILE_COULDNT_READ_FILE) {
>> > +		    slot->curl_result != CURLE_FILE_COULDNT_READ_FILE &&
>> > +		    (slot->http_code != 550 &&
>> > +		     slot->curl_result != CURLE_FTP_COULDNT_RETR_FILE)) {
>> >  			got_alternates = -1;
>> 
>> ... but you say, while the original code says "declare error if
>> it is not HTTP 404", "oh by the way, if it is 550 _or_ if it
>> is RETR failure then do not trigger this if()".  I suspect you
>> meant to say this?
>> 
>> 	    (slot->http_code != 550 ||
>> 	     slot->curl_result != CURLE_FTP_COULDNT_RETR_FILE)) {
>
> I think with less strict checking this could be done so, but with _and_
> this also ensures that we are really in FTP mode.
I was merely pointing out that in one place you have:
	(http_code == 550 && result == ERETR)
and another place that tries to say the opposite you have:
	(http_code != 550 && result != ERETR)
which is not the same thing as
	!(http_code == 550 && result == ERETR)

I understood, from the former "Use alternates if necessary" part, that you wanted to make sure that 550 is really from FTP_RETR and not other random HTTP error message, and I think that is a reasonable thing to do.

Previous: Sasha KhapyorskyNext: Sasha Khapyorsky
Message 7 of 11 in “Trivial support for cloning and fetching via ftp://.”
  1. Trivial support for cloning and fetching via ftp://.Sasha Khapyorsky, Sep 14, 2006
  2. Junio C HamanoSep 14, 2006
  3. Sasha KhapyorskySep 16, 2006
  4. Junio C HamanoSep 16, 2006
  5. Sasha KhapyorskySep 16, 2006
  6. Sasha KhapyorskySep 16, 2006
  7. Junio C HamanoSep 16, 2006
  8. Sasha KhapyorskySep 16, 2006
  9. Junio C HamanoSep 16, 2006
  10. Junio C HamanoSep 16, 2006
  11. Sasha KhapyorskySep 16, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.