From: Junio C Hamano <gitster@pobox.com>
To: "Kirill A. Korinskiy" <catap@catap.ru>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] http-push: support full URI in handle_remote_ls_ctx()
Date: Thu, 01 Jan 2009 23:26:45 -0800 [thread overview]
Message-ID: <7v7i5edv7u.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1230879195-8567-1-git-send-email-catap@catap.ru> (Kirill A. Korinskiy's message of "Fri, 2 Jan 2009 09:53:15 +0300")
"Kirill A. Korinskiy" <catap@catap.ru> writes:
> @@ -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, "://");
> + if (path) {
> + path = strchr(path+3, '/');
> + }
> + }
Is this "://" (and +3) the only change from the previous one that has
already been queued? I didn't have a problem with the old "//" one.
The check to see if it begins with 'h' bothers me much much more.
If you want to be defensively tight, you should be checking if it begins
with either "http://" or "https://", the only two protocols you are
prepared to handle, and nothing else, so that you won't trigger this
codepath when the other end gave you "hqrt://..", on the basis that your
code won't know if hqrt:// protocol works the same way as http and https.
On the other hand, if you want to be optimistically loose, expecting
whatever people would implement that can be handled with the existing DAV
code would behave the same way as http and https, you shouldn't be
limiting yourself to an unknown protocol name that happens to begin with
an 'h', only accepting "hqrt://" but not "ittp://" URLs.
Your "first byte of the protocol name must be 'h'" does not do either.
next prev parent reply other threads:[~2009-01-02 7:28 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
2008-12-29 8:36 ` Junio C Hamano
2009-01-02 6:53 ` Kirill A. Korinskiy
2009-01-02 7:26 ` Junio C Hamano [this message]
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=7v7i5edv7u.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=catap@catap.ru \
--cc=git@vger.kernel.org \
/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).