git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Lea Wiemann <lewiemann@gmail.com>
Cc: Jakub Narebski <jnareb@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] gitweb: return correct HTTP status codes
Date: Mon, 16 Jun 2008 15:38:50 -0700	[thread overview]
Message-ID: <7vy75580p1.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <48568D5C.5090909@gmail.com> (Lea Wiemann's message of "Mon, 16 Jun 2008 17:57:16 +0200")

Lea Wiemann <lewiemann@gmail.com> writes:

> Jakub Narebski wrote:
>...
>>> I recommend that you apply [PATCH] gitweb: remove git_blame
>>
>> I think it is not possible, as IIRC [it] got already applied.
>
> It isn't applied on master (at the time I'm writing this), only on next.
> Should I be working on the next branch?

I think it was sensible for you to mention the patch dependency, and if
you said the same thing with a different phrasing "this depends on remove
git_blame patch" you wouldn't have opened yourself up to such a nitpick
;-)

Since you are working on something that is outside the current 1.5.6
freeze, and removal of the unused "other" blame sub was something nobody
seemed to have objected to, I think it is Ok to assume that the removal
will happen when this new code is ready and after 1.5.6 ships.

It's up to you to work on 'next' or 'master with extra patches'.  Just
state what you are basing your development on and with what extra patches
if there is a risk of confusion among your readers.

>>>  	open my $fd, "-|", git_cmd(), "ls-tree", $base, "--", $path
>>> -		or die_error(undef, "Open git-ls-tree failed");
>>> +		or die_error(500, "Open git-ls-tree failed");
>>
>> Should we really use "500 Internal Server Error" here?  Usually this
>> would be not an error at all, but wrong parameters to git command,
>> i.e. it is _user_ who erred, not some error on _server_ side.
>
> You cannot tell for sure -- all you know here is that the command
> somehow failed when it shouldn't have, and so all you can give is 500;
> see below.  I don't think we should apply reasoning like "most commonly
> it's a wrong hash, so let's return 404" -- we don't know, and we
> shouldn't assume.
>
>>> ... I suspect that the error could be triggered by non-existent hashes
>>> as well, in which case the more specific 404 would be more appropriate
>>> -- however, the current implementation oftentimes doesn't allow for
>>> more fine-granulared checking
>>
>> ...that is why I'd rather have "403 Forbidden" as catch-all error, as
>> it was done in gitweb.  But that also seems not very good idea.
>
> [IANA HTTP expert, but:] All we have in cases like the one above is "I
> cannot deliver the content you requested, but I'm so confused that I
> don't even know why" -- which sounds like 500 to me (definitely not
> 403).  403 would be used for some deactivated feature (commonly for
> disabled directory listings I think) or something that shouldn't be
> accessible to the public.

Hmph... if we cared deeply enough about this issue, isn't it possible for
you to unconfuse yourself in a slow path and figure out exactly why it
failed?

        unless (open $fd, '-|', ls-tree $base -- $path) {
                # Oh, an error?  why?
                if (!object_exists($base)) {
                        die_error(404, "No such object $base");
                } elsif (!is_a_treeish($base)) {
                        die_error(404, "No such tree-ish $base");
                } else {
                        die_error();
                }
        }

  parent reply	other threads:[~2008-06-16 22:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-15 21:15 [PATCH] gitweb: return correct HTTP status codes Lea Wiemann
2008-06-15 22:48 ` Jakub Narebski
2008-06-16 15:57   ` Lea Wiemann
2008-06-16 16:43     ` Jakub Narebski
2008-06-16 21:49       ` Lea Wiemann
2008-06-16 22:34         ` Jakub Narebski
2008-06-17 13:53           ` Lea Wiemann
2008-06-16 22:38     ` Junio C Hamano [this message]
2008-06-17 14:04       ` Lea Wiemann
2008-06-17 14:33         ` Jakub Narebski
2008-06-17 22:28           ` Lea Wiemann
2008-06-17 22:54             ` Jakub Narebski
2008-06-17 23:47               ` Lea Wiemann
2008-06-18  0:12                 ` Jakub Narebski
2008-06-18  1:25                   ` Lea Wiemann
2008-06-18  7:35                     ` Jakub Narebski
2008-06-16 23:37     ` Jakub Narebski
2008-06-18  0:15 ` [PATCH] gitweb: standarize " Lea Wiemann
2008-06-19  0:51   ` [PATCH v2] " Jakub Narebski
2008-06-19 19:08     ` Lea Wiemann
2008-06-19 20:03       ` [PATCH v3] " Lea Wiemann
2008-06-19 20:25         ` Lea Wiemann
2008-06-19 22:37           ` Jakub Narebski
2008-06-20  0:48         ` Junio C Hamano
2008-06-19 22:22       ` [PATCH v2] " Jakub Narebski

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=7vy75580p1.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=lewiemann@gmail.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).