Author demian.brecht
Recipients demian.brecht, jimr
Date 2015-02-27.21:11:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1743B1D9-8CC0-42BE-BF49-4512E20D39EA@gmail.com>
In-reply-to <1425068936.71.0.920378022888.issue23539@psf.upfronthosting.co.za>
Content
> The logic now is as it was before, except that we set a content length of zero if the body is None and the method is one of OPTIONS, PATCH, PUT, or POST.

I see we definitely have similar thinking on the modifications required for this, but I don’t think I’m in favour of the approach in the patch. Consider the case where you have a GET request without a body. Now, instead of simply circumventing the _set_content_length method altogether as would have been done previously, the code path will now go into _set_content_length, have a TypeError exception raised on (str(len([None])) and then an AttributeError exception raised on os.fstat([None].fileno()). That seems to be quite a bit of additional overhead when it could be avoided altogether by an earlier check as I have in my example.

What do you think?
History
Date User Action Args
2015-02-27 21:11:37demian.brechtsetrecipients: + demian.brecht, jimr
2015-02-27 21:11:37demian.brechtlinkissue23539 messages
2015-02-27 21:11:36demian.brechtcreate