This is an archive of the discontinued Mercurial Phabricator instance.

hgweb: validate WSGI environment dict
ClosedPublic

Authored by indygreg on Mar 8 2018, 8:06 PM.

Details

Summary

The wsgiref.validate module contains useful functions for validating
that various WSGI data structures are proper.

This commit adds validation of the environment dict to our built-in
HTTP server, which turns an HTTP request into an environment dict.

The check discovered that we weren't always setting QUERY_STRING,
which would cause the cgi module to fall back to sys.argv. So we
change things to always set QUERY_STRING.

The check passes on Python 2 and 3.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

indygreg created this revision.Mar 8 2018, 8:06 PM
durin42 accepted this revision.Mar 9 2018, 1:55 PM
This revision is now accepted and ready to land.Mar 9 2018, 1:55 PM
This revision was automatically updated to reflect the committed changes.