Re: [PATCH] Trivial support for cloning and fetching via ftp://.
- From
Junio C Hamano <junkio@cox.net>
- Date
- Sep 16, 2006, 09:12 UTC
- Message-ID
- <7vwt849nv6.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <20060916023717.GA13570@sashak.voltaire.com>
Sasha Khapyorsky <sashak@voltaire.com> writes:
> Something like this? > > With this change I'm able to clone > ftp://ftp.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git
I think without you would have, just with extra error messages that http codepath filters out.
Show 12 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...
Show 9 quoted lines
> @@ -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)) {