]> source.dussan.org Git - jgit.git/commitdiff
Use '406 Not Acceptable' when info/refs is disabled 47/7847/1
authorShawn O. Pearce <spearce@spearce.org>
Thu, 20 Sep 2012 02:19:20 +0000 (19:19 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Thu, 20 Sep 2012 02:19:20 +0000 (19:19 -0700)
Instead of a confusing 403 Forbidden error indicating the dumb file
service is disabled on this server, use 406 Not Acceptable to mean
the client sent a request for content (the plain info/refs file)
that this server does not want to provide.

The stock C Git client will report HTTP 406 error if it predates
1.6.6 or something goes wrong with the smart request and it tried
falling back to the dumb request. This may help to debug cases where
a broken proxy server exists between the client and the server and
has mangled a prior smart info/refs response.

Change-Id: Ic2b78ba9502e4bbdff7cc3ba1fd284cf7616412b

org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java

index 980d246d2dd5ef130d21d3749ae3c6aebb55b43f..529b8391fa59470cdaf268e5762037708cd30bd2 100644 (file)
@@ -225,7 +225,7 @@ public class GitFilter extends MetaFilter {
                        refs = refs.through(new AsIsFileFilter(asIs));
                        refs.with(new InfoRefsServlet());
                } else
-                       refs.with(new ErrorServlet(HttpServletResponse.SC_FORBIDDEN));
+                       refs.with(new ErrorServlet(HttpServletResponse.SC_NOT_ACCEPTABLE));
 
                if (asIs != AsIsFileService.DISABLED) {
                        final IsLocalFilter mustBeLocal = new IsLocalFilter();