]> source.dussan.org Git - jgit.git/commit
Use message from ServiceNotAuthorizedException, ServiceNotEnabledException 79/49279/1
authorJonathan Nieder <jrn@google.com>
Tue, 2 Jun 2015 23:40:23 +0000 (16:40 -0700)
committerJonathan Nieder <jrn@google.com>
Tue, 2 Jun 2015 23:54:08 +0000 (16:54 -0700)
commitcc4f4f2fe14cb56611d42af34b0baa51bd6632aa
treed67eae8c2af00ed679079f84acd73a2486fa2d93
parent761e61f1ede1ec3ddeca9b7a6f959f43bb6ee8bb
Use message from ServiceNotAuthorizedException, ServiceNotEnabledException

When sending an error response due to ServiceNotAuthorizedException or
ServiceNotEnabledException, usually we send a default message.  In the
ServiceNotEnabledException case, we use

403 Git access forbidden

except in a dumb-HTTP-specific filter where we use the servlet
container's default 403 response:

403 Forbidden

In the ServiceNotAuthorizedException case, we use the servlet
container's default 401 response:

401 Unauthorized

There is one exception: a ServiceNotEnabledException when handling a
smart HTTP /info/refs request uses the message from the exception:

403 Service not enabled

Be more consistent by always using the message from the exception.  This
way, authors of a RepositoryResolver, UploadPackFactory, or
ReceivePackFactory can provide a more detailed message when appropriate.
The defaults are

401 Unauthorized
403 Service not enabled

Change-Id: Id1fe1c2042fb96487c3671c1965c8a65c4b8e1b8
Signed-off-by: Jonathan Nieder <jrn@google.com>
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/AsIsFileFilter.java
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java