From: Mark Rada <hidden> Date: 2016-06-15 22:47:18
In the first block of checks to validate a snapshot request, the last
check is never executed because the second last check is a superset of
the last check.
This change will switch the order of the last two checks, it has the
advantage of giving clients a more specific reason why they cannot get
a specific snapshot format instead of giving them the more generic
response.
Signed-off-by: Mark Rada <redacted>
---
gitweb/gitweb.perl | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
@@ -5174,10 +5174,10 @@ sub git_snapshot {die_error(400,"Invalid snapshot format parameter");}elsif(!exists($known_snapshot_formats{$format})){die_error(400,"Unknown snapshot format");-}elsif(!grep($_eq$format,@snapshot_fmts)){-die_error(403,"Unsupported snapshot format");}elsif($known_snapshot_formats{$format}{'disabled'}){die_error(403,"Snapshot format not allowed");+}elsif(!grep($_eq$format,@snapshot_fmts)){+die_error(403,"Unsupported snapshot format");}if(!defined$hash){
From: Mark Rada <hidden> Date: 2016-06-15 22:47:18
On 23/08/09 6:10 PM, Sam Vilain wrote:
Mark Rada wrote:
quoted
Subject: [RFC/PATCH 1/3] gitweb: make suspenders more useful
Suspenders? Really?
Sam
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Context:
On 21/08/09 5:43 PM, Junio C Hamano wrote:
Mark A Rada [off-list ref] writes:
quoted
Unless I missed a case, the tests show that the extra condition check
that was added in the &git_snapshot routine is never actually executed,
because a disabled snapshot format is not added to @snapshot_fmts, which
is checked first.
snippet:
5178 } elsif (!grep($_ eq $format, @snapshot_fmts)) {
5179 die_error(403, "Unsupported snapshot format");
5180 } elsif ($known_snapshot_formats{$format}{'disabled'}) {
5181 die_error(403, "Snapshot format not allowed");
5182 }
5183
True; filter_snapshot_fmts looks at 'disabled' first.
I do not mind keeping these two lines as belt-and-suspender, though.
Yup...I couldn't think of an appropriate title and I expect this
patch to be edited (for another reason) or thrown out anyways.
--
Mark A Rada (ferrous26)
marada@uwaterloo.ca
From: Sam Vilain <hidden> Date: 2016-06-15 22:47:18
Mark Rada wrote:
quoted
quoted
Subject: [RFC/PATCH 1/3] gitweb: make suspenders more useful
Suspenders? Really?
Context:
On 21/08/09 5:43 PM, Junio C Hamano wrote:
quoted
I do not mind keeping these two lines as belt-and-suspender, though.
Yup...I couldn't think of an appropriate title and I expect this
patch to be edited (for another reason) or thrown out anyways.
Please don't do that. Use of metaphors makes the code harder to follow,
especially for non-native speakers. In this case you confused me, a
British/NZ native speaker because you only used half of the idiom; so
all I was left with was a word which in the English where I speak refers
to a piece of clothing worn most often by prostitutes and people at the
Rocky Horror Picture Show.
Can I suggest "snapshot error handling" as a more neutral term...
Sam
From: Mark Rada <hidden> Date: 2016-06-15 22:47:18
Ok, this is just a resend of the first patch in my set from
earlier, but with some of the commit message reworded, namely
the subject (as suggested by Sam Vilain).
--
Mark Rada (ferrous26)
marada@uwaterloo.ca
--->8---
In the second block of checks to validate a snapshot request, the last
check is never executed because the second last check is a superset of
the last check.
This change will switch the order of the last two checks, it has the
advantage of giving clients a more specific reason why they cannot get
a snapshot format if the format they have chosen is disabled.
Signed-off-by: Mark Rada <redacted>
---
gitweb/gitweb.perl | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
@@ -5174,10 +5174,10 @@ sub git_snapshot {die_error(400,"Invalid snapshot format parameter");}elsif(!exists($known_snapshot_formats{$format})){die_error(400,"Unknown snapshot format");-}elsif(!grep($_eq$format,@snapshot_fmts)){-die_error(403,"Unsupported snapshot format");}elsif($known_snapshot_formats{$format}{'disabled'}){die_error(403,"Snapshot format not allowed");+}elsif(!grep($_eq$format,@snapshot_fmts)){+die_error(403,"Unsupported snapshot format");}if(!defined$hash){