Skip to content

Conversation

patrickbr
Copy link

There seems to be a problem with the _get_post() method in the SAML2Plugin for repoze.who. When used with pyramid and repoze.who, all POST requests fail with code 500 as soon as pysaml2 is set as a repoze.who identifier plugin. This is because at the time pyramid is reading the environ dict, CONTENT_LENGTH is set to the size of the POST request, but environ[wsgi.input] is empty. My guess is that the restoring of environ['wsgi.input'] via

environ['wsgi.input'] = StringIO(body)

is ineffective because environ['wsgi.input'] is emptied/read again afterwards by cgi.FieldStorage().

I replaced _get_post() with a simplier method using parse_qs to get a dict of the POST parameters and removed the now unneeded cgi_field_storage method. environ['wsgi.input'] is restored immediately after reading it and is never touched again.

rohe pushed a commit that referenced this pull request Sep 29, 2014
Fix for POST requests failing with 500
@rohe rohe merged commit 66d13d0 into IdentityPython:master Sep 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants