Mercurial > kallithea
diff rhodecode/lib/middleware/simplegit.py @ 2668:f0851f37d6be beta
Implementes #509 require SSL flag now works for both git and mercurial.
- check is done at earlies possible stage
- if detected protocol is not https and flag require is there RhodeCode will
return HTTP Error 406: Not Acceptable, before even checking credentials
- removed push_ssl flag from mercurial UI objects since that would duplicate logic
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 26 Jul 2012 23:03:26 +0200 |
parents | d24c70ec9312 |
children | 4c71667160e5 |
line wrap: on
line diff
--- a/rhodecode/lib/middleware/simplegit.py Thu Jul 26 22:22:31 2012 +0200 +++ b/rhodecode/lib/middleware/simplegit.py Thu Jul 26 23:03:26 2012 +0200 @@ -74,6 +74,8 @@ #from dulwich.web import make_wsgi_chain from paste.httpheaders import REMOTE_USER, AUTH_TYPE +from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError, \ + HTTPBadRequest, HTTPNotAcceptable from rhodecode.lib.utils2 import safe_str from rhodecode.lib.base import BaseVCSController @@ -81,8 +83,6 @@ from rhodecode.lib.utils import is_valid_repo, make_ui from rhodecode.model.db import User, RhodeCodeUi -from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError - log = logging.getLogger(__name__) @@ -104,7 +104,8 @@ if not is_git(environ): return self.application(environ, start_response) - + if not self._check_ssl(environ, start_response): + return HTTPNotAcceptable('SSL REQUIRED !')(environ, start_response) ipaddr = self._get_ip_addr(environ) username = None self._git_first_op = False