~tgc/mailman/2.1-da

« back to all changes in this revision

Viewing changes to scripts/driver

  • Committer: Mark Sapiro
  • Date: 2013-04-07 05:54:18 UTC
  • Revision ID: msapiro@value.net-20130407055418-3ocsw3ajga2vv82l
Defended against buggy web servers that don't include an empty
QUERY_STRING in the CGI environment.  (LP: 1160647)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- python -*-
2
2
 
3
 
# Copyright (C) 1998-2010 by the Free Software Foundation, Inc.
 
3
# Copyright (C) 1998-2013 by the Free Software Foundation, Inc.
4
4
#
5
5
# This program is free software; you can redistribute it and/or
6
6
# modify it under the terms of the GNU General Public License
92
92
        # Mailman.Cgi package.  That module must have a main() function, which
93
93
        # we dig out and call.
94
94
        scriptname = sys.argv[1]
 
95
        # Then we truncate sys.argv because buggy web servers have been
 
96
        # observed which do not provide an empty QUERY_STRING in the
 
97
        # environment which causes cgi.FieldStorage() to add sys.argv[1:] to
 
98
        # the constructed instance.
 
99
        del sys.argv[1:]
95
100
        # See the reference manual for why we have to do things this way.
96
101
        # Note that importing should have no side-effects!
97
102
        pkg = __import__('Mailman.Cgi', globals(), locals(), [scriptname])