{"thread":{"id":"24168","subject":"[PATCH v3] Do not decode url protocol.","startedAt":"2010-06-22T11:58:17Z","lastAt":"2010-06-22T17:22:40Z","messageCount":5,"participants":["Pascal Obry","Matthieu Moy"],"isPatch":true,"patchVersion":3,"patchTotal":null},"messages":[{"id":"144038","messageId":"AANLkTik2M4Wxa-C6iRf7ShlcrwXu1ALNXtKwbA-mO5ge@mail.gmail.com","threadId":"24168","inReplyTo":null,"subject":"[PATCH v3] Do not decode url protocol.","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2010-06-22T11:58:17Z","receivedAt":"2010-06-22T11:58:17Z","isPatch":true,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"When using the protocol git+ssh:// for example we do not want to\ndecode the '+' as a space.\n\nThis fixes a regression introduced in 9d2e942.\n---\n url.c |    9 +++++++++\n 1 files changed, 9 insertions(+), 0 deletions(-)\n\ndiff --git a/url.c b/url.c\nindex cd32b92..94a42a5 100644\n--- a/url.c\n+++ b/url.c\n@@ -70,9 +70,18 @@ static int url_decode_char(const char *q)\n static char *url_decode_internal(const char **query, const char *stop_at)\n {\n \tconst char *q = *query;\n+\tconst char *first_slash;\n \tstruct strbuf out;\n\n \tstrbuf_init(&out, 16);\n+\n+\t/* Skip protocol. */\n+\tfirst_slash = strchr(*query, '/');\n+\n+\twhile (q < first_slash) {\n+\t\tstrbuf_addch(&out, *q++);\n+\t}\n+\n \tdo {\n \t\tunsigned char c = *q;\n\n-- \n1.7.1.524.g6df2f\n\nOk, given Matthieu comments here is another version of the patch which\nshould apply cleanly\nand won't clobber log message with my comments!\n\nNote that it is safe to do this in url_decode_internal as we know that\nhere we have an url\nwith a protocol specified.\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"144042","messageId":"vpq39wf82y3.fsf@bauges.imag.fr","threadId":"24168","inReplyTo":"AANLkTik2M4Wxa-C6iRf7ShlcrwXu1ALNXtKwbA-mO5ge@mail.gmail.com","subject":"Re: [PATCH v3] Do not decode url protocol.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-06-22T16:08:52Z","receivedAt":"2010-06-22T16:08:52Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Pascal Obry <pascal@obry.net> writes:\n\n> -- \n> 1.7.1.524.g6df2f\n>\n> Ok, given Matthieu comments here is another version of the patch which\n> should apply cleanly\n> and won't clobber log message with my comments!\n\nThanks for making the life of our maintainer easier :-).\n\nUnfortunately, it's still not the right place for comments ;-). That's\nOK with Git AFAICT, but readers expect them between the --- (tripple)\nand the diffstat.\n\nUnless I missed something, this version doesn't address my earlier\ncomment:\n\nMatthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Pascal Obry <pascal@obry.net> writes:\n>\n>> @@ -70,9 +70,18 @@ static int url_decode_char(const char *q)\n>>  static char *url_decode_internal(const char **query, const char *stop_at)\n>>  {\n>\n> This function is called from multiple places :\n\n[...]\n\n> I don't think you want to avoid escaping until the first slash in\n> url_decode_parameter_name and url_decode_parameter_value. I think you\n> want to patch url_decode, not url_decode_internal.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"144043","messageId":"4C20E92B.1030405@obry.net","threadId":"24168","inReplyTo":"vpq39wf82y3.fsf@bauges.imag.fr","subject":"Re: [PATCH v3] Do not decode url protocol.","fromName":"Pascal Obry","fromEmail":"pascal.obry@gmail.com","sentAt":"2010-06-22T16:47:39Z","receivedAt":"2010-06-22T16:47:39Z","isPatch":true,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Matthieu,\n\n> Unless I missed something, this version doesn't address my earlier\n> comment:\n\nBecause I do not agree. The three procedures:\n\nchar *url_decode(const char *url)\nchar *url_decode_parameter_name(const char **query)\nchar *url_decode_parameter_value(const char **query)\n\nare all passed a full url (with protocol). We do not want to decode the\nprotocol in all three cases. The difference is only that the later two\nare stopping the decoding at a given point in the url.\n\nSo to me, until I'm proved to be wrong, I think that v3 of my path is\ncorrect.\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|    http://www.obry.net  -  http://v2p.fr.eu.org\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B\n"},{"id":"144044","messageId":"vpqfx0fxaeo.fsf@bauges.imag.fr","threadId":"24168","inReplyTo":"4C20E92B.1030405@obry.net","subject":"Re: [PATCH v3] Do not decode url protocol.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-06-22T17:08:31Z","receivedAt":"2010-06-22T17:08:31Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Pascal Obry <pascal.obry@gmail.com> writes:\n\n> Matthieu,\n>\n>> Unless I missed something, this version doesn't address my earlier\n>> comment:\n>\n> Because I do not agree.\n\nI'm fine with disagreeing, but then you should argue. This would allow\neither Junio to be convinced, or me to argue back.\n\n> The three procedures:\n>\n> char *url_decode(const char *url)\n> char *url_decode_parameter_name(const char **query)\n> char *url_decode_parameter_value(const char **query)\n>\n> are all passed a full url (with protocol).\n\nThe caller is this (http-backend.c):\n\nstatic struct string_list *get_parameters(void)\n{\n[...]\n\t\twhile (query && *query) {\n\t\t\tchar *name = url_decode_parameter_name(&query);\n\t\t\tchar *value = url_decode_parameter_value(&query);\n\t\t\t[...]\n\t\t}\n\nwhich advances \"query\" as the URL is decoded, hence passing query as a\npointer to the argument being parsed, not to the full URL.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"144045","messageId":"4C20F160.2010203@obry.net","threadId":"24168","inReplyTo":"vpqfx0fxaeo.fsf@bauges.imag.fr","subject":"Re: [PATCH v3] Do not decode url protocol.","fromName":"Pascal Obry","fromEmail":"pascal.obry@gmail.com","sentAt":"2010-06-22T17:22:40Z","receivedAt":"2010-06-22T17:22:40Z","isPatch":true,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Matthieu,\n\n> which advances \"query\" as the URL is decoded, hence passing query as a\n> pointer to the argument being parsed, not to the full URL.\n\nOk, I've missed that and I'm wrong :) Will propose another patch.\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|    http://www.obry.net  -  http://v2p.fr.eu.org\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B\n"}]}