summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Dumpleton <Graham.Dumpleton@gmail.com>2014-12-18 17:15:49 +1100
committerGraham Dumpleton <Graham.Dumpleton@gmail.com>2014-12-18 17:15:49 +1100
commit3192e92876a52af87d546186ca52a7594a474fa2 (patch)
treee8e9bac56d31f542c8d658d7405bc4a6c9bf021e
parent8042adfb585d7f4a1dd6f4e9c77030778d63d2b4 (diff)
parentc47dc8155bcf7978d0abedd6d439f86d8cddeaa6 (diff)
downloadmod_wsgi-4.4.2.tar.gz
Merge branch 'release/4.4.2'4.4.2
-rw-r--r--docs/release-notes/index.rst1
-rw-r--r--docs/release-notes/version-4.4.2.rst42
-rw-r--r--src/server/__init__.py87
-rw-r--r--src/server/mod_wsgi.c29
-rw-r--r--src/server/wsgi_version.h4
-rw-r--r--tests/environ.wsgi13
6 files changed, 126 insertions, 50 deletions
diff --git a/docs/release-notes/index.rst b/docs/release-notes/index.rst
index 36b981a..25abbcd 100644
--- a/docs/release-notes/index.rst
+++ b/docs/release-notes/index.rst
@@ -5,6 +5,7 @@ Release Notes
.. toctree::
:maxdepth: 2
+ version-4.4.2.rst
version-4.4.1.rst
version-4.4.0.rst
diff --git a/docs/release-notes/version-4.4.2.rst b/docs/release-notes/version-4.4.2.rst
new file mode 100644
index 0000000..de07a50
--- /dev/null
+++ b/docs/release-notes/version-4.4.2.rst
@@ -0,0 +1,42 @@
+=============
+Version 4.4.2
+=============
+
+Version 4.4.2 of mod_wsgi can be obtained from:
+
+ https://codeload.github.com/GrahamDumpleton/mod_wsgi/tar.gz/4.4.2
+
+Known Issues
+------------
+
+1. Although the makefiles for building mod_wsgi on Windows have now been
+updated for the new source code layout, some issues are being seen with
+mod_wsgi on Apache 2.4. These issues are still being investigated. As
+most new changes in 4.X relate to mod_wsgi daemon mode, which is not
+supported under Windows, you should keep using the last available binary
+for version 3.X on Windows instead. Binaries compiled by a third party
+can be obtained from:
+
+* http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi
+
+Features Changed
+----------------
+
+1. The ``--ssl-port`` option has been deprecated in favour of the option
+``--https-port``. Strictly speaking SSL no longer exists and has been
+supplanted with TLS. The 'S' in 'HTTPS' is actually meant to mean secure
+and not 'SSL'. So change name of option to properly match terminoligy.
+
+Bugs Fixed
+----------
+
+1. When a default language was specified using the ``locale`` option to
+the ``WSGIDaemonProcess`` directive or the ``--locale`` option to
+``mod_wsgi-express``, if it did not actually match a locale supported by
+the operating system, that the locale couldn't be set wasn't logged. Such
+a message is now logged along with a suggestion to use ``C.UTF-8`` as a
+fallback locale if the intent is to have ``UTF-8`` support.
+
+2. When using the ``--https-only`` option with ``mod_wsgi-express``, a HTTP
+request was not being redirected to be a HTTPS request when there were no
+server aliases specified.
diff --git a/src/server/__init__.py b/src/server/__init__.py
index 239ceb9..d68b020 100644
--- a/src/server/__init__.py
+++ b/src/server/__init__.py
@@ -354,7 +354,7 @@ CustomLog "%(access_log_file)s" %(log_format_nickname)s
WSGIChunkedRequest On
</IfDefine>
-<IfDefine WSGI_WITH_SSL>
+<IfDefine WSGI_WITH_HTTPS>
<IfModule !ssl_module>
LoadModule ssl_module %(modules_directory)s/mod_ssl.so
</IfModule>
@@ -458,10 +458,10 @@ Redirect permanent / http://%(server_name)s:%(port)s/
ServerName %(server_name)s
<IfDefine WSGI_SERVER_ALIAS>
ServerAlias %(server_aliases)s
+</IfDefine>
RewriteEngine On
RewriteCond %%{HTTPS} off
RewriteRule (.*) https://%%{HTTP_HOST}%%{REQUEST_URI}
-</IfDefine>
</VirtualHost>
<IfDefine WSGI_REDIRECT_WWW>
<VirtualHost *:%(port)s>
@@ -477,17 +477,17 @@ RewriteRule (.*) https://%%{HTTP_HOST}%%{REQUEST_URI}
<IfDefine WSGI_VIRTUAL_HOST>
-<IfDefine WSGI_WITH_SSL>
+<IfDefine WSGI_WITH_HTTPS>
<IfDefine WSGI_LISTENER_HOST>
-Listen %(host)s:%(ssl_port)s
+Listen %(host)s:%(https_port)s
</IfDefine>
<IfDefine !WSGI_LISTENER_HOST>
-Listen %(ssl_port)s
+Listen %(https_port)s
</IfDefine>
<IfVersion < 2.4>
-NameVirtualHost *:%(ssl_port)s
+NameVirtualHost *:%(https_port)s
</IfVersion>
-<VirtualHost _default_:%(ssl_port)s>
+<VirtualHost _default_:%(https_port)s>
<Location />
Order deny,allow
Deny from all
@@ -499,7 +499,7 @@ SSLEngine On
SSLCertificateFile %(ssl_certificate)s.crt
SSLCertificateKeyFile %(ssl_certificate)s.key
</VirtualHost>
-<VirtualHost *:%(ssl_port)s>
+<VirtualHost *:%(https_port)s>
ServerName %(server_name)s
<IfDefine WSGI_SERVER_ALIAS>
ServerAlias %(server_aliases)s
@@ -509,9 +509,9 @@ SSLCertificateFile %(ssl_certificate)s.crt
SSLCertificateKeyFile %(ssl_certificate)s.key
</VirtualHost>
<IfDefine WSGI_REDIRECT_WWW>
-<VirtualHost *:%(ssl_port)s>
+<VirtualHost *:%(https_port)s>
ServerName %(parent_domain)s
-Redirect permanent / https://%(server_name)s:%(ssl_port)s/
+Redirect permanent / https://%(server_name)s:%(https_port)s/
SSLEngine On
SSLCertificateFile %(ssl_certificate)s.crt
SSLCertificateKeyFile %(ssl_certificate)s.key
@@ -1356,7 +1356,7 @@ LANG='%(lang)s'
LC_ALL='%(locale)s'
export LANG
-export LOCALE
+export LC_ALL
ACMD="$1"
ARGV="$@"
@@ -1433,9 +1433,12 @@ option_list = (
metavar='NUMBER', help='The specific port to bind to and '
'on which requests are to be accepted. Defaults to port 8000.'),
+ optparse.make_option('--https-port', type='int', metavar='NUMBER',
+ help='The specific port to bind to and on which secure '
+ 'requests are to be accepted.'),
optparse.make_option('--ssl-port', type='int', metavar='NUMBER',
- help='The specific port to bind to and on which requests are '
- 'to be accepted for SSL connections.'),
+ dest='https_port', help=optparse.SUPPRESS_HELP),
+
optparse.make_option('--ssl-certificate', default=None,
metavar='FILE-PATH', help='Specify the path to the SSL '
'certificate files. It is expected that the files have \'.crt\' '
@@ -1444,9 +1447,9 @@ option_list = (
'the extension.'),
optparse.make_option('--https-only', action='store_true',
default=False, help='Flag indicating whether any requests '
- 'made using a HTTP request over the non SSL connection should '
- 'be redirected automatically to use a HTTPS request over the '
- 'SSL connection.'),
+ 'made using a HTTP request over the non connection connection '
+ 'should be redirected automatically to use a HTTPS request '
+ 'over the secure connection.'),
optparse.make_option('--server-name', default=None, metavar='HOSTNAME',
help='The primary host name of the web server. If this name '
@@ -1737,13 +1740,13 @@ option_list = (
help='Specify an alternate script file for user defined web '
'server environment variables. Defaults to using the '
'\'envvars\' stored under the server root directory.'),
- optparse.make_option('--lang', default='en_US.UTF-8', metavar='NAME',
+ optparse.make_option('--lang', default='C.UTF-8', metavar='NAME',
help='Specify the default language locale as normally defined '
- 'by the LANG environment variable. Defaults to \'en_US.UTF-8\'.'),
- optparse.make_option('--locale', default='en_US.UTF-8', metavar='NAME',
+ 'by the LANG environment variable. Defaults to \'C.UTF-8\'.'),
+ optparse.make_option('--locale', default='C.UTF-8', metavar='NAME',
help='Specify the default natural language formatting style '
'as normally defined by the LC_ALL environment variable. '
- 'Defaults to \'en_US.UTF-8\'.'),
+ 'Defaults to \'C.UTF-8\'.'),
optparse.make_option('--setenv', action='append', nargs=2,
dest='setenv_variables', metavar='KEY VALUE', help='Specify '
@@ -2265,12 +2268,12 @@ def _cmd_setup_server(command, args, options):
else:
options['url'] = 'http://%s:%s/' % (host, options['port'])
- if options['ssl_port'] == 443:
- options['ssl_url'] = 'https://%s/' % host
- elif options['ssl_port'] is not None:
- options['ssl_url'] = 'https://%s:%s/' % (host, options['ssl_port'])
+ if options['https_port'] == 443:
+ options['https_url'] = 'https://%s/' % host
+ elif options['https_port'] is not None:
+ options['https_url'] = 'https://%s:%s/' % (host, options['https_port'])
else:
- options['ssl_url'] = None
+ options['https_url'] = None
if options['debug_mode']:
options['httpd_arguments_list'].append('-DONE_PROCESS')
@@ -2329,8 +2332,8 @@ def _cmd_setup_server(command, args, options):
options['httpd_arguments_list'].append('-DWSGI_REDIRECT_WWW')
options['parent_domain'] = options['server_name'][4:]
- if options['ssl_port'] and options['ssl_certificate']:
- options['httpd_arguments_list'].append('-DWSGI_WITH_SSL')
+ if options['https_port'] and options['ssl_certificate']:
+ options['httpd_arguments_list'].append('-DWSGI_WITH_HTTPS')
if options['https_only']:
options['httpd_arguments_list'].append('-DWSGI_HTTPS_ONLY')
@@ -2393,42 +2396,42 @@ def _cmd_setup_server(command, args, options):
generate_apache_config(options)
generate_control_scripts(options)
- print('Server URL :', options['url'])
+ print('Server URL :', options['url'])
- if options['ssl_url']:
- print('Server URL (SSL) :', options['ssl_url'])
+ if options['https_url']:
+ print('Server URL (HTTPS) :', options['https_url'])
if options['server_status']:
- print('Server Status :', '%sserver-status' % options['url'])
+ print('Server Status :', '%sserver-status' % options['url'])
- print('Server Root :', options['server_root'])
- print('Server Conf :', options['httpd_conf'])
+ print('Server Root :', options['server_root'])
+ print('Server Conf :', options['httpd_conf'])
- print('Error Log File :', options['error_log_file'])
+ print('Error Log File :', options['error_log_file'])
if options['access_log']:
- print('Access Log File :', options['access_log_file'])
+ print('Access Log File :', options['access_log_file'])
if options['startup_log']:
- print('Startup Log File :', options['startup_log_file'])
+ print('Startup Log File :', options['startup_log_file'])
if options['enable_coverage']:
- print('Coverage Output :', os.path.join(
+ print('Coverage Output :', os.path.join(
options['coverage_directory'], 'index.html'))
if options['enable_profiler']:
- print('Profiler Output :', options['profiler_directory'])
+ print('Profiler Output :', options['profiler_directory'])
if options['enable_recorder']:
- print('Recorder Output :', options['recorder_directory'])
+ print('Recorder Output :', options['recorder_directory'])
if options['envvars_script']:
- print('Environ Variables :', options['envvars_script'])
+ print('Environ Variables :', options['envvars_script'])
if command == 'setup-server' or options['setup_only']:
if not options['envvars_script']:
- print('Environ Variables :', options['server_root'] + '/envvars')
- print('Control Script :', options['server_root'] + '/apachectl')
+ print('Environ Variables :', options['server_root'] + '/envvars')
+ print('Control Script :', options['server_root'] + '/apachectl')
return options
diff --git a/src/server/mod_wsgi.c b/src/server/mod_wsgi.c
index 5a90dd2..31170ce 100644
--- a/src/server/mod_wsgi.c
+++ b/src/server/mod_wsgi.c
@@ -9194,18 +9194,35 @@ static int wsgi_start_process(apr_pool_t *p, WSGIDaemonProcess *daemon)
/* Set lang/locale if specified for daemon process. */
if (daemon->group->lang) {
- char *envvar = apr_pstrcat(p, "LANG=", daemon->group->lang, NULL);
+ char *envvar;
+
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, wsgi_server,
- "mod_wsgi (pid=%d): Setting lang to %s.",
- getpid(), daemon->group->lang);
+ "mod_wsgi (pid=%d): Setting lang to %s for "
+ "daemon process group %s.", getpid(),
+ daemon->group->lang, daemon->group->name);
+
+ envvar = apr_pstrcat(p, "LANG=", daemon->group->lang, NULL);
putenv(envvar);
}
if (daemon->group->locale) {
+ char *result;
+
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, wsgi_server,
- "mod_wsgi (pid=%d): Setting locale to %s.",
- getpid(), daemon->group->locale);
- setlocale(LC_ALL, daemon->group->locale);
+ "mod_wsgi (pid=%d): Setting locale to %s for "
+ "daemon process group %s.", getpid(),
+ daemon->group->locale, daemon->group->name);
+
+ result = setlocale(LC_ALL, daemon->group->locale);
+
+ if (!result) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, wsgi_server,
+ "mod_wsgi (pid=%d): Unsupported locale setting "
+ "%s specified for daemon process group %s. "
+ "Consider using 'C.UTF-8' as fallback setting.",
+ getpid(), daemon->group->locale,
+ daemon->group->name);
+ }
}
/*
diff --git a/src/server/wsgi_version.h b/src/server/wsgi_version.h
index 8917d2c..1ce46ae 100644
--- a/src/server/wsgi_version.h
+++ b/src/server/wsgi_version.h
@@ -25,8 +25,8 @@
#define MOD_WSGI_MAJORVERSION_NUMBER 4
#define MOD_WSGI_MINORVERSION_NUMBER 4
-#define MOD_WSGI_MICROVERSION_NUMBER 1
-#define MOD_WSGI_VERSION_STRING "4.4.1"
+#define MOD_WSGI_MICROVERSION_NUMBER 2
+#define MOD_WSGI_VERSION_STRING "4.4.2"
/* ------------------------------------------------------------------------- */
diff --git a/tests/environ.wsgi b/tests/environ.wsgi
index 26ce97d..c50c88e 100644
--- a/tests/environ.wsgi
+++ b/tests/environ.wsgi
@@ -2,6 +2,7 @@ from __future__ import print_function
import os
import sys
+import locale
try:
from cStringIO import StringIO
@@ -67,6 +68,18 @@ def application(environ, start_response):
print('PATH: %s' % sys.path, file=output)
print(file=output)
+ print('LANG: %s' % os.environ.get('LANG'), file=output)
+ print('LC_ALL: %s' % os.environ.get('LC_ALL'), file=output)
+ print('sys.getdefaultencoding(): %s' % sys.getdefaultencoding(),
+ file=output)
+ print('locale.getlocale(): %s' % (locale.getlocale(),),
+ file=output)
+ print('locale.getdefaultlocale(): %s' % (locale.getdefaultlocale(),),
+ file=output)
+ print('locale.getpreferredencoding(): %s' % locale.getpreferredencoding(),
+ file=output)
+ print(file=output)
+
keys = sorted(environ.keys())
for key in keys:
print('%s: %s' % (key, repr(environ[key])), file=output)