git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Hommey <mh@glandium.org>
To: "Kirill A. Korinskiy" <catap@catap.ru>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] http-push: support full URI in handle_remote_ls_ctx()
Date: Mon, 29 Dec 2008 08:17:10 +0100	[thread overview]
Message-ID: <20081229071710.GA19175@glandium.org> (raw)
In-Reply-To: <1230517935-11299-1-git-send-email-catap@catap.ru>

On Mon, Dec 29, 2008 at 05:32:15AM +0300, Kirill A. Korinskiy wrote:
> The program calls remote_ls() to get list of files from the server
> over HTTP; handle_remote_ls_ctx() is used to parse its response to
> populate "struct remote_ls_ctx" that is returned from remote_ls().
> 
> The handle_remote_ls_ctx() function assumed that the server returns a
> local path in href field, but RFC 4918 (14.7) demand of support full
> URI (e.g. "http://localhost:8080/repo.git").
> 
> This resulted in push failure (e.g. git-http-push issues a PROPFIND
> request to "/repo.git/alhost:8080/repo.git/refs/" to the server).
> 
> Signed-off-by: Kirill A. Korinskiy <catap@catap.ru>
> ---
>  http-push.c |   25 +++++++++++++++++++------
>  1 files changed, 19 insertions(+), 6 deletions(-)
> 
> diff --git a/http-push.c b/http-push.c
> index 7c6460919bf3eba10c46cede11ffdd9c53fd2dd2..a4b7d08663504a57008f66a39fffe293f62c1d08 100644
> --- a/http-push.c
> +++ b/http-push.c
> @@ -87,6 +87,7 @@ static struct object_list *objects;
>  struct repo
>  {
>  	char *url;
> +	char *path;
>  	int path_len;
>  	int has_info_refs;
>  	int can_update_info_refs;
> @@ -1424,9 +1425,19 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)
>  				ls->userFunc(ls);
>  			}
>  		} else if (!strcmp(ctx->name, DAV_PROPFIND_NAME) && ctx->cdata) {
> -			ls->dentry_name = xmalloc(strlen(ctx->cdata) -
> +			char *path = ctx->cdata;
> +			if (*ctx->cdata == 'h') {
> +				path = strstr(path, "//");

I would make that a "://"

> +				if (path) {
> +					path = strchr(path+2, '/');

and s/2/3/, accordingly.

But I realize the existing code already does something like what your
are doing...

Mike

  reply	other threads:[~2008-12-29  7:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <7v3aghnv1t.fsf@gitster.siamese.dyndns.org>
2008-12-23  8:31 ` [PATCH] handle_remote_ls_ctx can parsing href starting at http:// Kirill A. Korinskiy
2008-12-25  7:04   ` Junio C Hamano
2008-12-29  2:32     ` [PATCH] http-push: support full URI in handle_remote_ls_ctx() Kirill A. Korinskiy
2008-12-29  7:17       ` Mike Hommey [this message]
2008-12-29  8:36       ` Junio C Hamano
2009-01-02  6:53       ` Kirill A. Korinskiy
2009-01-02  7:26         ` Junio C Hamano
2009-01-18 11:28 Kirill A. Korinskiy
2009-01-18 14:51 ` Johannes Schindelin
2009-01-18 21:28 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081229071710.GA19175@glandium.org \
    --to=mh@glandium.org \
    --cc=catap@catap.ru \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).