Skip to content

Commit 3192e92

Browse files
Merge branch 'release/4.4.2'
2 parents 8042adf + c47dc81 commit 3192e92

File tree

6 files changed

+126
-50
lines changed

6 files changed

+126
-50
lines changed

docs/release-notes/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Release Notes
55
.. toctree::
66
:maxdepth: 2
77

8+
version-4.4.2.rst
89
version-4.4.1.rst
910
version-4.4.0.rst
1011

docs/release-notes/version-4.4.2.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
=============
2+
Version 4.4.2
3+
=============
4+
5+
Version 4.4.2 of mod_wsgi can be obtained from:
6+
7+
https://codeload.github.com/GrahamDumpleton/mod_wsgi/tar.gz/4.4.2
8+
9+
Known Issues
10+
------------
11+
12+
1. Although the makefiles for building mod_wsgi on Windows have now been
13+
updated for the new source code layout, some issues are being seen with
14+
mod_wsgi on Apache 2.4. These issues are still being investigated. As
15+
most new changes in 4.X relate to mod_wsgi daemon mode, which is not
16+
supported under Windows, you should keep using the last available binary
17+
for version 3.X on Windows instead. Binaries compiled by a third party
18+
can be obtained from:
19+
20+
* http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi
21+
22+
Features Changed
23+
----------------
24+
25+
1. The ``--ssl-port`` option has been deprecated in favour of the option
26+
``--https-port``. Strictly speaking SSL no longer exists and has been
27+
supplanted with TLS. The 'S' in 'HTTPS' is actually meant to mean secure
28+
and not 'SSL'. So change name of option to properly match terminoligy.
29+
30+
Bugs Fixed
31+
----------
32+
33+
1. When a default language was specified using the ``locale`` option to
34+
the ``WSGIDaemonProcess`` directive or the ``--locale`` option to
35+
``mod_wsgi-express``, if it did not actually match a locale supported by
36+
the operating system, that the locale couldn't be set wasn't logged. Such
37+
a message is now logged along with a suggestion to use ``C.UTF-8`` as a
38+
fallback locale if the intent is to have ``UTF-8`` support.
39+
40+
2. When using the ``--https-only`` option with ``mod_wsgi-express``, a HTTP
41+
request was not being redirected to be a HTTPS request when there were no
42+
server aliases specified.

src/server/__init__.py

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def find_mimetypes():
354354
WSGIChunkedRequest On
355355
</IfDefine>
356356
357-
<IfDefine WSGI_WITH_SSL>
357+
<IfDefine WSGI_WITH_HTTPS>
358358
<IfModule !ssl_module>
359359
LoadModule ssl_module %(modules_directory)s/mod_ssl.so
360360
</IfModule>
@@ -458,10 +458,10 @@ def find_mimetypes():
458458
ServerName %(server_name)s
459459
<IfDefine WSGI_SERVER_ALIAS>
460460
ServerAlias %(server_aliases)s
461+
</IfDefine>
461462
RewriteEngine On
462463
RewriteCond %%{HTTPS} off
463464
RewriteRule (.*) https://%%{HTTP_HOST}%%{REQUEST_URI}
464-
</IfDefine>
465465
</VirtualHost>
466466
<IfDefine WSGI_REDIRECT_WWW>
467467
<VirtualHost *:%(port)s>
@@ -477,17 +477,17 @@ def find_mimetypes():
477477
478478
<IfDefine WSGI_VIRTUAL_HOST>
479479
480-
<IfDefine WSGI_WITH_SSL>
480+
<IfDefine WSGI_WITH_HTTPS>
481481
<IfDefine WSGI_LISTENER_HOST>
482-
Listen %(host)s:%(ssl_port)s
482+
Listen %(host)s:%(https_port)s
483483
</IfDefine>
484484
<IfDefine !WSGI_LISTENER_HOST>
485-
Listen %(ssl_port)s
485+
Listen %(https_port)s
486486
</IfDefine>
487487
<IfVersion < 2.4>
488-
NameVirtualHost *:%(ssl_port)s
488+
NameVirtualHost *:%(https_port)s
489489
</IfVersion>
490-
<VirtualHost _default_:%(ssl_port)s>
490+
<VirtualHost _default_:%(https_port)s>
491491
<Location />
492492
Order deny,allow
493493
Deny from all
@@ -499,7 +499,7 @@ def find_mimetypes():
499499
SSLCertificateFile %(ssl_certificate)s.crt
500500
SSLCertificateKeyFile %(ssl_certificate)s.key
501501
</VirtualHost>
502-
<VirtualHost *:%(ssl_port)s>
502+
<VirtualHost *:%(https_port)s>
503503
ServerName %(server_name)s
504504
<IfDefine WSGI_SERVER_ALIAS>
505505
ServerAlias %(server_aliases)s
@@ -509,9 +509,9 @@ def find_mimetypes():
509509
SSLCertificateKeyFile %(ssl_certificate)s.key
510510
</VirtualHost>
511511
<IfDefine WSGI_REDIRECT_WWW>
512-
<VirtualHost *:%(ssl_port)s>
512+
<VirtualHost *:%(https_port)s>
513513
ServerName %(parent_domain)s
514-
Redirect permanent / https://%(server_name)s:%(ssl_port)s/
514+
Redirect permanent / https://%(server_name)s:%(https_port)s/
515515
SSLEngine On
516516
SSLCertificateFile %(ssl_certificate)s.crt
517517
SSLCertificateKeyFile %(ssl_certificate)s.key
@@ -1356,7 +1356,7 @@ def generate_server_metrics_script(options):
13561356
LC_ALL='%(locale)s'
13571357
13581358
export LANG
1359-
export LOCALE
1359+
export LC_ALL
13601360
13611361
ACMD="$1"
13621362
ARGV="$@"
@@ -1433,9 +1433,12 @@ def check_percentage(option, opt_str, value, parser):
14331433
metavar='NUMBER', help='The specific port to bind to and '
14341434
'on which requests are to be accepted. Defaults to port 8000.'),
14351435

1436+
optparse.make_option('--https-port', type='int', metavar='NUMBER',
1437+
help='The specific port to bind to and on which secure '
1438+
'requests are to be accepted.'),
14361439
optparse.make_option('--ssl-port', type='int', metavar='NUMBER',
1437-
help='The specific port to bind to and on which requests are '
1438-
'to be accepted for SSL connections.'),
1440+
dest='https_port', help=optparse.SUPPRESS_HELP),
1441+
14391442
optparse.make_option('--ssl-certificate', default=None,
14401443
metavar='FILE-PATH', help='Specify the path to the SSL '
14411444
'certificate files. It is expected that the files have \'.crt\' '
@@ -1444,9 +1447,9 @@ def check_percentage(option, opt_str, value, parser):
14441447
'the extension.'),
14451448
optparse.make_option('--https-only', action='store_true',
14461449
default=False, help='Flag indicating whether any requests '
1447-
'made using a HTTP request over the non SSL connection should '
1448-
'be redirected automatically to use a HTTPS request over the '
1449-
'SSL connection.'),
1450+
'made using a HTTP request over the non connection connection '
1451+
'should be redirected automatically to use a HTTPS request '
1452+
'over the secure connection.'),
14501453

14511454
optparse.make_option('--server-name', default=None, metavar='HOSTNAME',
14521455
help='The primary host name of the web server. If this name '
@@ -1737,13 +1740,13 @@ def check_percentage(option, opt_str, value, parser):
17371740
help='Specify an alternate script file for user defined web '
17381741
'server environment variables. Defaults to using the '
17391742
'\'envvars\' stored under the server root directory.'),
1740-
optparse.make_option('--lang', default='en_US.UTF-8', metavar='NAME',
1743+
optparse.make_option('--lang', default='C.UTF-8', metavar='NAME',
17411744
help='Specify the default language locale as normally defined '
1742-
'by the LANG environment variable. Defaults to \'en_US.UTF-8\'.'),
1743-
optparse.make_option('--locale', default='en_US.UTF-8', metavar='NAME',
1745+
'by the LANG environment variable. Defaults to \'C.UTF-8\'.'),
1746+
optparse.make_option('--locale', default='C.UTF-8', metavar='NAME',
17441747
help='Specify the default natural language formatting style '
17451748
'as normally defined by the LC_ALL environment variable. '
1746-
'Defaults to \'en_US.UTF-8\'.'),
1749+
'Defaults to \'C.UTF-8\'.'),
17471750

17481751
optparse.make_option('--setenv', action='append', nargs=2,
17491752
dest='setenv_variables', metavar='KEY VALUE', help='Specify '
@@ -2265,12 +2268,12 @@ def _cmd_setup_server(command, args, options):
22652268
else:
22662269
options['url'] = 'http://%s:%s/' % (host, options['port'])
22672270

2268-
if options['ssl_port'] == 443:
2269-
options['ssl_url'] = 'https://%s/' % host
2270-
elif options['ssl_port'] is not None:
2271-
options['ssl_url'] = 'https://%s:%s/' % (host, options['ssl_port'])
2271+
if options['https_port'] == 443:
2272+
options['https_url'] = 'https://%s/' % host
2273+
elif options['https_port'] is not None:
2274+
options['https_url'] = 'https://%s:%s/' % (host, options['https_port'])
22722275
else:
2273-
options['ssl_url'] = None
2276+
options['https_url'] = None
22742277

22752278
if options['debug_mode']:
22762279
options['httpd_arguments_list'].append('-DONE_PROCESS')
@@ -2329,8 +2332,8 @@ def _cmd_setup_server(command, args, options):
23292332
options['httpd_arguments_list'].append('-DWSGI_REDIRECT_WWW')
23302333
options['parent_domain'] = options['server_name'][4:]
23312334

2332-
if options['ssl_port'] and options['ssl_certificate']:
2333-
options['httpd_arguments_list'].append('-DWSGI_WITH_SSL')
2335+
if options['https_port'] and options['ssl_certificate']:
2336+
options['httpd_arguments_list'].append('-DWSGI_WITH_HTTPS')
23342337
if options['https_only']:
23352338
options['httpd_arguments_list'].append('-DWSGI_HTTPS_ONLY')
23362339

@@ -2393,42 +2396,42 @@ def _cmd_setup_server(command, args, options):
23932396
generate_apache_config(options)
23942397
generate_control_scripts(options)
23952398

2396-
print('Server URL :', options['url'])
2399+
print('Server URL :', options['url'])
23972400

2398-
if options['ssl_url']:
2399-
print('Server URL (SSL) :', options['ssl_url'])
2401+
if options['https_url']:
2402+
print('Server URL (HTTPS) :', options['https_url'])
24002403

24012404
if options['server_status']:
2402-
print('Server Status :', '%sserver-status' % options['url'])
2405+
print('Server Status :', '%sserver-status' % options['url'])
24032406

2404-
print('Server Root :', options['server_root'])
2405-
print('Server Conf :', options['httpd_conf'])
2407+
print('Server Root :', options['server_root'])
2408+
print('Server Conf :', options['httpd_conf'])
24062409

2407-
print('Error Log File :', options['error_log_file'])
2410+
print('Error Log File :', options['error_log_file'])
24082411

24092412
if options['access_log']:
2410-
print('Access Log File :', options['access_log_file'])
2413+
print('Access Log File :', options['access_log_file'])
24112414

24122415
if options['startup_log']:
2413-
print('Startup Log File :', options['startup_log_file'])
2416+
print('Startup Log File :', options['startup_log_file'])
24142417

24152418
if options['enable_coverage']:
2416-
print('Coverage Output :', os.path.join(
2419+
print('Coverage Output :', os.path.join(
24172420
options['coverage_directory'], 'index.html'))
24182421

24192422
if options['enable_profiler']:
2420-
print('Profiler Output :', options['profiler_directory'])
2423+
print('Profiler Output :', options['profiler_directory'])
24212424

24222425
if options['enable_recorder']:
2423-
print('Recorder Output :', options['recorder_directory'])
2426+
print('Recorder Output :', options['recorder_directory'])
24242427

24252428
if options['envvars_script']:
2426-
print('Environ Variables :', options['envvars_script'])
2429+
print('Environ Variables :', options['envvars_script'])
24272430

24282431
if command == 'setup-server' or options['setup_only']:
24292432
if not options['envvars_script']:
2430-
print('Environ Variables :', options['server_root'] + '/envvars')
2431-
print('Control Script :', options['server_root'] + '/apachectl')
2433+
print('Environ Variables :', options['server_root'] + '/envvars')
2434+
print('Control Script :', options['server_root'] + '/apachectl')
24322435

24332436
return options
24342437

src/server/mod_wsgi.c

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9194,18 +9194,35 @@ static int wsgi_start_process(apr_pool_t *p, WSGIDaemonProcess *daemon)
91949194
/* Set lang/locale if specified for daemon process. */
91959195

91969196
if (daemon->group->lang) {
9197-
char *envvar = apr_pstrcat(p, "LANG=", daemon->group->lang, NULL);
9197+
char *envvar;
9198+
91989199
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, wsgi_server,
9199-
"mod_wsgi (pid=%d): Setting lang to %s.",
9200-
getpid(), daemon->group->lang);
9200+
"mod_wsgi (pid=%d): Setting lang to %s for "
9201+
"daemon process group %s.", getpid(),
9202+
daemon->group->lang, daemon->group->name);
9203+
9204+
envvar = apr_pstrcat(p, "LANG=", daemon->group->lang, NULL);
92019205
putenv(envvar);
92029206
}
92039207

92049208
if (daemon->group->locale) {
9209+
char *result;
9210+
92059211
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, wsgi_server,
9206-
"mod_wsgi (pid=%d): Setting locale to %s.",
9207-
getpid(), daemon->group->locale);
9208-
setlocale(LC_ALL, daemon->group->locale);
9212+
"mod_wsgi (pid=%d): Setting locale to %s for "
9213+
"daemon process group %s.", getpid(),
9214+
daemon->group->locale, daemon->group->name);
9215+
9216+
result = setlocale(LC_ALL, daemon->group->locale);
9217+
9218+
if (!result) {
9219+
ap_log_error(APLOG_MARK, APLOG_ERR, 0, wsgi_server,
9220+
"mod_wsgi (pid=%d): Unsupported locale setting "
9221+
"%s specified for daemon process group %s. "
9222+
"Consider using 'C.UTF-8' as fallback setting.",
9223+
getpid(), daemon->group->locale,
9224+
daemon->group->name);
9225+
}
92099226
}
92109227

92119228
/*

src/server/wsgi_version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525

2626
#define MOD_WSGI_MAJORVERSION_NUMBER 4
2727
#define MOD_WSGI_MINORVERSION_NUMBER 4
28-
#define MOD_WSGI_MICROVERSION_NUMBER 1
29-
#define MOD_WSGI_VERSION_STRING "4.4.1"
28+
#define MOD_WSGI_MICROVERSION_NUMBER 2
29+
#define MOD_WSGI_VERSION_STRING "4.4.2"
3030

3131
/* ------------------------------------------------------------------------- */
3232

tests/environ.wsgi

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ from __future__ import print_function
22

33
import os
44
import sys
5+
import locale
56

67
try:
78
from cStringIO import StringIO
@@ -67,6 +68,18 @@ def application(environ, start_response):
6768
print('PATH: %s' % sys.path, file=output)
6869
print(file=output)
6970

71+
print('LANG: %s' % os.environ.get('LANG'), file=output)
72+
print('LC_ALL: %s' % os.environ.get('LC_ALL'), file=output)
73+
print('sys.getdefaultencoding(): %s' % sys.getdefaultencoding(),
74+
file=output)
75+
print('locale.getlocale(): %s' % (locale.getlocale(),),
76+
file=output)
77+
print('locale.getdefaultlocale(): %s' % (locale.getdefaultlocale(),),
78+
file=output)
79+
print('locale.getpreferredencoding(): %s' % locale.getpreferredencoding(),
80+
file=output)
81+
print(file=output)
82+
7083
keys = sorted(environ.keys())
7184
for key in keys:
7285
print('%s: %s' % (key, repr(environ[key])), file=output)

0 commit comments

Comments
 (0)