diff --git a/development.ini b/development.ini --- a/development.ini +++ b/development.ini @@ -46,6 +46,7 @@ lang=en cache_dir = %(here)s/data index_dir = %(here)s/data/index cut_off_limit = 256000 +force_https = false #################################### ### CELERY CONFIG #### diff --git a/docs/changelog.rst b/docs/changelog.rst --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -3,6 +3,25 @@ Changelog ========= +1.1.1 (**2011-01-06**) +---------------------- + +news +++++ + +- added force https option into ini files for easier https usage (no need to + set server headers with this options) +- small css updates + +fixes +++++ + +- fixed #96 redirect loop on files view on repositories without changesets +- fixed #97 unicode string passed into server header in special cases (mod_wsgi) + and server crashed with errors +- fixed large tooltips problems on main page +- fixed #92 whoosh indexer is more error proof + 1.1.0 (**2010-12-18**) ---------------------- diff --git a/docs/setup.rst b/docs/setup.rst --- a/docs/setup.rst +++ b/docs/setup.rst @@ -157,6 +157,16 @@ In order to make start using celery run: paster celeryd +HTTPS support +------------- + +There are two ways to enable https, first is to set HTTP_X_URL_SCHEME in +Your http server headers, than rhodecode will recognise this headers and make +proper https redirections, another way is to set `force_https = true` +in the ini cofiguration to force using https, no headers are needed than to +enable https + + Nginx virtual host example -------------------------- @@ -210,9 +220,36 @@ in production.ini file:: To not have the statics served by the application. And improve speed. -Apache reverse proxy --------------------- -Tutorial can be found here + +Apache virtual host example +--------------------------- + +Sample config for apache using proxy:: + + + ServerName hg.myserver.com + ServerAlias hg.myserver.com + + + Order allow,deny + Allow from all + + + #important ! + #Directive to properly generate url (clone url) for pylons + ProxyPreserveHost On + + #rhodecode instance + ProxyPass / http://127.0.0.1:5000/ + ProxyPassReverse / http://127.0.0.1:5000/ + + #to enable https use line below + #SetEnvIf X-Url-Scheme https HTTPS=1 + + + + +Additional tutorial http://wiki.pylonshq.com/display/pylonscookbook/Apache+as+a+reverse+proxy+for+Pylons diff --git a/production.ini b/production.ini --- a/production.ini +++ b/production.ini @@ -46,6 +46,7 @@ lang=en cache_dir = %(here)s/data index_dir = %(here)s/data/index cut_off_limit = 256000 +force_https = false #################################### ### CELERY CONFIG #### diff --git a/rhodecode/config/deployment.ini_tmpl b/rhodecode/config/deployment.ini_tmpl --- a/rhodecode/config/deployment.ini_tmpl +++ b/rhodecode/config/deployment.ini_tmpl @@ -47,6 +47,7 @@ cache_dir = %(here)s/data index_dir = %(here)s/data/index app_instance_uuid = ${app_instance_uuid} cut_off_limit = 256000 +force_https = false #################################### ### CELERY CONFIG #### diff --git a/rhodecode/controllers/files.py b/rhodecode/controllers/files.py --- a/rhodecode/controllers/files.py +++ b/rhodecode/controllers/files.py @@ -39,7 +39,8 @@ from rhodecode.lib.base import BaseContr from rhodecode.lib.utils import EmptyChangeset from rhodecode.model.scm import ScmModel -from vcs.exceptions import RepositoryError, ChangesetError +from vcs.exceptions import RepositoryError, ChangesetError, \ + ChangesetDoesNotExistError, EmptyRepositoryError from vcs.nodes import FileNode from vcs.utils import diffs as differ @@ -91,6 +92,10 @@ class FilesController(BaseController): h.flash(str(e), category='warning') redirect(h.url('files_home', repo_name=repo_name, revision=revision)) + except EmptyRepositoryError, e: + h.flash(_('There are no files yet'), category='warning') + redirect(h.url('summary_home', repo_name=repo_name)) + except RepositoryError, e: h.flash(str(e), category='warning') redirect(h.url('files_home', repo_name=repo_name, revision='tip')) diff --git a/rhodecode/lib/indexers/daemon.py b/rhodecode/lib/indexers/daemon.py --- a/rhodecode/lib/indexers/daemon.py +++ b/rhodecode/lib/indexers/daemon.py @@ -116,10 +116,17 @@ class WhooshIndexingDaemon(object): the instance of vcs backend""" node = self.get_node(repo, path) - #we just index the content of chosen files - if node.extension in INDEX_EXTENSIONS: - log.debug(' >> %s [WITH CONTENT]' % path) + #we just index the content of chosen files, and skip binary files + if node.extension in INDEX_EXTENSIONS and not node.is_binary: + u_content = node.content + if not isinstance(u_content, unicode): + log.warning(' >> %s Could not get this content as unicode ' + 'replacing with empty content', path) + u_content = u'' + else: + log.debug(' >> %s [WITH CONTENT]' % path) + else: log.debug(' >> %s' % path) #just index file name without it's content diff --git a/rhodecode/lib/middleware/https_fixup.py b/rhodecode/lib/middleware/https_fixup.py --- a/rhodecode/lib/middleware/https_fixup.py +++ b/rhodecode/lib/middleware/https_fixup.py @@ -1,8 +1,15 @@ -#!/usr/bin/env python -# encoding: utf-8 -# middleware to handle https correctly -# Copyright (C) 2009-2010 Marcin Kuzminski - +# -*- coding: utf-8 -*- +""" + rhodecode.lib.middleware.https_fixup + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + middleware to handle https correctly + + :created_on: May 23, 2010 + :author: marcink + :copyright: (C) 2009-2011 Marcin Kuzminski + :license: GPLv3, see COPYING for more details. +""" # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 @@ -18,28 +25,28 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. -""" -Created on May 23, 2010 - -@author: marcink -""" +from rhodecode.lib import str2bool class HttpsFixup(object): - def __init__(self, app): + def __init__(self, app, config): self.application = app - + self.config = config + def __call__(self, environ, start_response): self.__fixup(environ) return self.application(environ, start_response) - - + + def __fixup(self, environ): """Function to fixup the environ as needed. In order to use this middleware you should set this header inside your proxy ie. nginx, apache etc. """ proto = environ.get('HTTP_X_URL_SCHEME') - + + if str2bool(self.config.get('force_https')): + proto = 'https' + if proto == 'https': environ['wsgi.url_scheme'] = proto else: diff --git a/rhodecode/lib/middleware/simplehg.py b/rhodecode/lib/middleware/simplehg.py --- a/rhodecode/lib/middleware/simplehg.py +++ b/rhodecode/lib/middleware/simplehg.py @@ -69,6 +69,8 @@ class SimpleHg(object): proxy_key = 'HTTP_X_REAL_IP' def_key = 'REMOTE_ADDR' self.ipaddr = environ.get(proxy_key, environ.get(def_key, '0.0.0.0')) + # skip passing error to error controller + environ['pylons.status_code_redirect'] = True #=================================================================== # AUTHENTICATE THIS MERCURIAL REQUEST @@ -76,7 +78,7 @@ class SimpleHg(object): username = REMOTE_USER(environ) if not username: - self.authenticate.realm = self.config['rhodecode_realm'] + self.authenticate.realm = str(self.config['rhodecode_realm']) result = self.authenticate(environ) if isinstance(result, str): AUTH_TYPE.update(environ, 'basic') diff --git a/rhodecode/public/css/style.css b/rhodecode/public/css/style.css --- a/rhodecode/public/css/style.css +++ b/rhodecode/public/css/style.css @@ -905,20 +905,6 @@ margin:0; padding:4px 8px; } -#content div.box div.form div.fields div.field div.input a.ui-input-file { -width:28px; -height:28px; -display:inline; -position:absolute; -overflow:hidden; -cursor:pointer; -background:#e5e3e3 url("../images/button_browse.png") no-repeat; -border:none; -text-decoration:none; -margin:0 0 0 6px; -padding:0; -} - #content div.box div.form div.fields div.field div.textarea { border-top:1px solid #b3b3b3; border-left:1px solid #b3b3b3; @@ -978,15 +964,6 @@ font-size:11px; padding:5px 5px 5px 0; } -#content div.box div.form div.fields div.field div.textarea table td table td a.mceButtonActive { -background:#b1b1b1; -} - -#content div.box div.form div.fields div.field div.select a.ui-selectmenu { -color:#565656; -text-decoration:none; -} - #content div.box div.form div.fields div.field input[type=text]:focus,#content div.box div.form div.fields div.field input[type=password]:focus,#content div.box div.form div.fields div.field input[type=file]:focus,#content div.box div.form div.fields div.field textarea:focus,#content div.box div.form div.fields div.field select:focus { background:#f6f6f6; border-color:#666; @@ -997,7 +974,7 @@ margin:0; padding:0 0 0 8px; } -div.form div.fields div.field div.highlight .ui-state-default { +div.form div.fields div.field div.highlight .ui-button { background:#4e85bb url("../images/button_highlight.png") repeat-x; border-top:1px solid #5c91a4; border-left:1px solid #2a6f89; @@ -1019,7 +996,7 @@ margin:0; padding:6px 12px; } -#content div.box div.form div.fields div.buttons div.highlight input.ui-state-default { +#content div.box div.form div.fields div.buttons div.highlight input.ui-button { background:#4e85bb url("../../images/button_highlight.png") repeat-x; border-top:1px solid #5c91a4; border-left:1px solid #2a6f89; @@ -1408,7 +1385,7 @@ margin:0; padding:10px 0 0 150px; } -#register div.form div.fields div.buttons div.highlight input.ui-state-default { +#register div.form div.fields div.buttons div.highlight input.ui-button { background:url("../images/button_highlight.png") repeat-x scroll 0 0 #4E85BB; color:#FFF; border-color:#5C91A4 #2B7089 #1A6480 #2A6F89; @@ -1614,10 +1591,18 @@ padding:0; } div.browserblock .browser-header { -border-bottom:1px solid #CCC; background:#FFF; -color:blue; padding:10px 0; +float:left; +} + +div.browserblock .browser-branch { +background:#FFF; +padding:20px 0 0 0; +float:left; +} +div.browserblock .browser-branch label { +color:#4A4A4A; } div.browserblock .browser-header span { @@ -1627,6 +1612,7 @@ font-weight:700; div.browserblock .browser-body { background:#EEE; +border-top:1px solid #CCC; } table.code-browser { @@ -1754,6 +1740,10 @@ width:auto; opacity:1px; padding:8px; white-space: pre; +-webkit-border-radius: 8px 8px 8px 8px; +-khtml-border-radius: 8px 8px 8px 8px; +-moz-border-radius: 8px 8px 8px 8px; +border-radius: 8px 8px 8px 8px; } .ac { @@ -2052,7 +2042,7 @@ border-left:1px solid #316293; border:1px solid #316293; } -#content div.box div.title div.search div.button input.ui-state-default { +#content div.box div.title div.search div.button input.ui-button { background:#4e85bb url("../../images/button_highlight.png") repeat-x; border:1px solid #316293; border-left:none; @@ -2066,7 +2056,7 @@ border-left:none; color:#FFF; } -#content div.box div.form div.fields div.field div.highlight .ui-state-default { +#content div.box div.form div.fields div.field div.highlight .ui-button { background:#4e85bb url("../../images/button_highlight.png") repeat-x; border-top:1px solid #5c91a4; border-left:1px solid #2a6f89; @@ -2211,7 +2201,7 @@ font-weight:700; margin:0; } -div.form div.fields div.field div.button .ui-state-default,#content div.box div.form div.fields div.buttons input.ui-state-default { +div.form div.fields div.field div.button .ui-button,#content div.box div.form div.fields div.buttons input.ui-button { background:#e5e3e3 url("../images/button.png") repeat-x; border-top:1px solid #DDD; border-left:1px solid #c6c6c6; @@ -2259,7 +2249,7 @@ margin:6px 0 0; padding:0; } -#content div.box div.action div.button input.ui-state-default,#login div.form div.fields div.buttons input.ui-state-default,#register div.form div.fields div.buttons input.ui-state-default { +#content div.box div.action div.button input.ui-button,#login div.form div.fields div.buttons input.ui-button,#register div.form div.fields div.buttons input.ui-button { background:#e5e3e3 url("../images/button.png") repeat-x; border-top:1px solid #DDD; border-left:1px solid #c6c6c6; diff --git a/rhodecode/templates/index.html b/rhodecode/templates/index.html --- a/rhodecode/templates/index.html +++ b/rhodecode/templates/index.html @@ -87,7 +87,7 @@ ##DESCRIPTION - + ${h.truncate(repo['description'],60)} ##LAST CHANGE diff --git a/test.ini b/test.ini --- a/test.ini +++ b/test.ini @@ -45,6 +45,7 @@ lang=en cache_dir = %(here)s/data index_dir = /tmp/index cut_off_limit = 256000 +force_https = false #################################### ### CELERY CONFIG ####