changeset 7563:bbcd2dea19fe

hgweb: send HTTP unauthorized error when denying pull
author Mark Edgington <edgimar@gmail.com>
date Sat, 03 Jan 2009 20:50:06 +0100
parents b663b5563de7
children f1af59451c0c 4f58147ea829
files mercurial/hgweb/hgweb_mod.py tests/test-pull-http.out
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Sat Jan 03 20:33:19 2009 +0100
+++ b/mercurial/hgweb/hgweb_mod.py	Sat Jan 03 20:50:06 2009 +0100
@@ -289,7 +289,7 @@
             raise ErrorResponse(HTTP_UNAUTHORIZED, 'read not authorized')
 
         if op == 'pull' and not self.allowpull:
-            raise ErrorResponse(HTTP_OK, '')
+            raise ErrorResponse(HTTP_UNAUTHORIZED, 'pull not authorized')
         # op is None when checking allow/deny_read permissions for a web-browser request
         elif op == 'pull' or op is None:
             return
--- a/tests/test-pull-http.out	Sat Jan 03 20:33:19 2009 +0100
+++ b/tests/test-pull-http.out	Sat Jan 03 20:50:06 2009 +0100
@@ -2,11 +2,11 @@
 updating working directory
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % expect error, cloning not allowed
-abort: error: 
+abort: authorization failed
 requesting all changes
 % serve errors
 % expect error, pulling not allowed
-abort: error: 
+abort: authorization failed
 pulling from http://localhost/
 searching for changes
 % serve errors