[docs] [issue30160] BaseHTTPRequestHandler.wfile: supported usage unclear

Mike report at bugs.python.org
Tue Apr 25 10:44:44 EDT 2017


New submission from Mike:

The documentation for BaseHTTPRequestHandler explicitly prohibits protocol
violations when writing to the `wfile` stream:

> BaseHTTPRequestHandler has the following instance variables:
>
> [...]
>
> **`wfile`**
>
> > Contains the output stream for writing a response back to the client.
> > Proper adherence to the HTTP protocol must be used when writing to this
> > stream.

I am interested in testing web browser behavior in response to protocol
violations, and my initial interpretation of this text (and the term "must" in
particular) is that such conditions are not guaranteed to achievable with this
module. However, my colleague believes the text is simply intended to
communicate that there is no safety mechanism in place, and that protocol
violations will not be corrected. [1]

Local testing and a quick reading of the source tends to confirm the latter
interpretation, but this may simply be coincidental and not necessarily stable
behavior.

If it is in fact stable, then I would like to request a modification to the
documentation. Changing the word "must" to "should" would help, although it
might be better to be more explicit--something like, "Bytes are transmitted
'as-is'; HTTP protocol violations will not be corrected."

Thanks!

[1] https://github.com/w3c/web-platform-tests/issues/5668

----------
assignee: docs at python
components: Documentation
messages: 292263
nosy: docs at python, jugglinmike
priority: normal
severity: normal
status: open
title: BaseHTTPRequestHandler.wfile: supported usage unclear

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30160>
_______________________________________


More information about the docs mailing list