{"thread":{"id":"16894","subject":"[PATCH] gitweb: Handle actions with no project in evaluate_path_info","startedAt":"2008-12-28T07:26:52Z","lastAt":"2009-01-02T12:09:29Z","messageCount":5,"participants":["Devin Doucette","Jakub Narebski","Giuseppe Bilotta"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"98833","messageId":"a899d7ef0812272326j1a407c30k936bf8d8975c9063@mail.gmail.com","threadId":"16894","inReplyTo":null,"subject":"[PATCH] gitweb: Handle actions with no project in evaluate_path_info","fromName":"Devin Doucette","fromEmail":"devin@doucette.cc","sentAt":"2008-12-28T07:26:52Z","receivedAt":"2008-12-28T07:26:52Z","isPatch":true,"sender":{"key":"devin@doucette.cc","avatar":"https://gravatar.com/avatar/d5f21493801a4a508fd101dd9e432b02ac95fb58226f3d3f3417fbf147c8a1e3?d=mp&s=160"},"body":"The action would not be set if no valid project was found in\npath_info. Removing the return if the project was not specified fixes\nthe project_index and opml actions when using path_info.\n\nSigned-off-by: Devin Doucette <devin@doucette.cc>\n---\n gitweb/gitweb.perl |    3 +--\n 1 files changed, 1 insertions(+), 2 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 8f574c7..b6a8ea9 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -552,8 +552,7 @@ sub evaluate_path_info {\n \twhile ($project && !check_head_link(\"$projectroot/$project\")) {\n \t\t$project =~ s,/*[^/]*$,,;\n \t}\n-\treturn unless $project;\n-\t$input_params{'project'} = $project;\n+\t$input_params{'project'} = $project if $project;\n\n \t# do not change any parameters if an action is given using the query string\n \treturn if $input_params{'action'};\n-- \n1.6.1.rc4\n"},{"id":"99131","messageId":"200901020058.30748.jnareb@gmail.com","threadId":"16894","inReplyTo":"a899d7ef0812272326j1a407c30k936bf8d8975c9063@mail.gmail.com","subject":"Re: [PATCH] gitweb: Handle actions with no project in evaluate_path_info","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-01-01T23:58:29Z","receivedAt":"2009-01-01T23:58:29Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Sun, 28 Dec 2008, Devin Doucette wrote:\n\n> The action would not be set if no valid project was found in\n> path_info. Removing the return if the project was not specified fixes\n> the project_index and opml actions when using path_info.\n>\n\nThanks for catching this.\n\nTruth to be told we parse action parameter in path_info only since\nd8c2882 (gitweb: parse project/action/hash_base:filename PATH_INFO)\nby Giuseppe Bilotta (CC-ed; I think he is correct person to give\nAck for this patch). Earlier only \"default\" actions could be expressed\nusing only path_info, and project-less 'opml' and 'project_index'\nactions are not default actions for projectless URL, so there was no\nsuch problem then.\n \n> Signed-off-by: Devin Doucette <devin@doucette.cc>\n> ---\n>  gitweb/gitweb.perl |    3 +--\n>  1 files changed, 1 insertions(+), 2 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 8f574c7..b6a8ea9 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -552,8 +552,7 @@ sub evaluate_path_info {\n>  \twhile ($project && !check_head_link(\"$projectroot/$project\")) {\n>  \t\t$project =~ s,/*[^/]*$,,;\n>  \t}\n> -\treturn unless $project;\n> -\t$input_params{'project'} = $project;\n> +\t$input_params{'project'} = $project if $project;\n> \n>  \t# do not change any parameters if an action is given using the query string\n>  \treturn if $input_params{'action'};\n> -- \n> 1.6.1.rc4\n> \n\n-- \nJakub Narebski\nPoland\n"},{"id":"99137","messageId":"cb7bb73a0901011646n6a1368caq797a5f2849daec77@mail.gmail.com","threadId":"16894","inReplyTo":"200901020058.30748.jnareb@gmail.com","subject":"Re: [PATCH] gitweb: Handle actions with no project in evaluate_path_info","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-01-02T00:46:36Z","receivedAt":"2009-01-02T00:46:36Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Fri, Jan 2, 2009 at 12:58 AM, Jakub Narebski <jnareb@gmail.com> wrote:\n> Truth to be told we parse action parameter in path_info only since\n> d8c2882 (gitweb: parse project/action/hash_base:filename PATH_INFO)\n> by Giuseppe Bilotta (CC-ed; I think he is correct person to give\n> Ack for this patch). Earlier only \"default\" actions could be expressed\n> using only path_info, and project-less 'opml' and 'project_index'\n> actions are not default actions for projectless URL, so there was no\n> such problem then.\n\nActually, the early bailout was sort of intentional. The problem is\nthe ambiguity: does git.example.com/opml refer to the opml project, or\ndoes it refer to the opml action?\n\nHOWEVER, href() *does* create the opml action as git.example.com/opml,\nso gitweb is currently broken in the sense that ti doesn't correctly\nparse its own pathinfo output. So the question is: shall we go with\nthis patch, preventing pathinfo from working for projects named like a\nno-project gitweb action, or should we fix href() to not generate\npathinfo unless project is defined?\n\n>> -     return unless $project;\n>> -     $input_params{'project'} = $project;\n>> +     $input_params{'project'} = $project if $project;\n\nNote that if this patch is accepted, we probably need an appropriate\npatch in href() anyway to use query params for projects named like\nno-project actions.\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"99142","messageId":"a899d7ef0901011821x166f173dx47bdb41326391696@mail.gmail.com","threadId":"16894","inReplyTo":"cb7bb73a0901011646n6a1368caq797a5f2849daec77@mail.gmail.com","subject":"Re: [PATCH] gitweb: Handle actions with no project in evaluate_path_info","fromName":"Devin Doucette","fromEmail":"devin@doucette.cc","sentAt":"2009-01-02T02:21:55Z","receivedAt":"2009-01-02T02:21:55Z","isPatch":true,"sender":{"key":"devin@doucette.cc","avatar":"https://gravatar.com/avatar/d5f21493801a4a508fd101dd9e432b02ac95fb58226f3d3f3417fbf147c8a1e3?d=mp&s=160"},"body":"On Thu, Jan 1, 2009 at 5:46 PM, Giuseppe Bilotta\n<giuseppe.bilotta@gmail.com> wrote:\n> Actually, the early bailout was sort of intentional. The problem is\n> the ambiguity: does git.example.com/opml refer to the opml project, or\n> does it refer to the opml action?\n\nGood point. Though my patch does not break any existing functionality,\nit does not fix the case where a project matches the action.\n\n> HOWEVER, href() *does* create the opml action as git.example.com/opml,\n> so gitweb is currently broken in the sense that ti doesn't correctly\n> parse its own pathinfo output. So the question is: shall we go with\n> this patch, preventing pathinfo from working for projects named like a\n> no-project gitweb action, or should we fix href() to not generate\n> pathinfo unless project is defined?\n\nA variation of the latter approach is to modify href() to use pathinfo\nif there is a project or there is no project matching the name of the\naction. The only downside to this approach is that a URI that refers to\nan action when first generated could resolve to a project in the future,\nif a project of the same name were added.\n\n--\nDevin Doucette\n"},{"id":"99160","messageId":"cb7bb73a0901020409u304e6344x13b6090732c2d5cd@mail.gmail.com","threadId":"16894","inReplyTo":"a899d7ef0901011821x166f173dx47bdb41326391696@mail.gmail.com","subject":"Re: [PATCH] gitweb: Handle actions with no project in evaluate_path_info","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-01-02T12:09:29Z","receivedAt":"2009-01-02T12:09:29Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Fri, Jan 2, 2009 at 3:21 AM, Devin Doucette <devin@doucette.cc> wrote:\n> On Thu, Jan 1, 2009 at 5:46 PM, Giuseppe Bilotta\n> <giuseppe.bilotta@gmail.com> wrote:\n>> Actually, the early bailout was sort of intentional. The problem is\n>> the ambiguity: does git.example.com/opml refer to the opml project, or\n>> does it refer to the opml action?\n>\n> Good point. Though my patch does not break any existing functionality,\n> it does not fix the case where a project matches the action.\n>\n>> HOWEVER, href() *does* create the opml action as git.example.com/opml,\n>> so gitweb is currently broken in the sense that ti doesn't correctly\n>> parse its own pathinfo output. So the question is: shall we go with\n>> this patch, preventing pathinfo from working for projects named like a\n>> no-project gitweb action, or should we fix href() to not generate\n>> pathinfo unless project is defined?\n>\n> A variation of the latter approach is to modify href() to use pathinfo\n> if there is a project or there is no project matching the name of the\n> action. The only downside to this approach is that a URI that refers to\n> an action when first generated could resolve to a project in the future,\n> if a project of the same name were added.\n\nAnd don't forget the case of a new action being introduced which is\nnamed like an existing project.\n\nI suspect we'd be much better off by not using pathinfo at all for\nglobal actions. Other possible solutions would be to have something\nlike an ADDITIONAL prefix to the path (like project/projectname vs\naction/actionname, so we would have git.example.com/action/opml or\ngit.example.com/project/example-project) but this is WAY too verbose.\n\nAt most, we could add a suffix to global actions to reduce the chance\nof name conflict, such as using\n\ngit.example.com/opml.xml\n\nor\n\ngit.example.com/project_index.txt\n\nbut I don't like these solution either: I'd rather have these be\nprovided as filenames in the response header.\n\nIncoming patch to not make use of path_info without project.\n\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"}]}