[Twisted-Python] Request.getClient
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Wed Jul 2 12:55:24 MDT 2014
On 06:26 pm, dustin at v.igoro.us wrote:
>Actually, the apidocs say "Undocumented", so I think you could make it
>return u"The 🌕 is made of green 酪 " and still be in spec.
>
>http://twistedmatrix.com/documents/14.0.0/api/twisted.web.http.Request.html#getClient
The interface is documented:
https://twistedmatrix.com/documents/14.0.0/api/twisted.web.iweb.IRequest.html#getClient
(as deprecated, already).
Also, we generally give some weight to how an implementation actually
behaves - even if the documentation is lacking or contradictory.
If you ignore incorrect docs and figure out how to use an API so it
works, you could conceivably have working software. Twisted tries not
to break such code.
If you ignore how the implementation actually behaves and blindly trust
the documentation (sorry, wish you could do that) then your software
probably doesn't work. Since it's probably already broken, Twisted
isn't as concerned making changes that might break it more or
differently.
Jean-Paul
>Dustin
>
>On Wed, Jul 2, 2014 at 12:26 PM, <exarkun at twistedmatrix.com> wrote:
>>Hello all,
>>
>>twisted.web.http.Request.getClient has a terrible implementation. It
>>does
>>blocking network I/O (DNS). Fortunately it is only used in one place
>>in
>>Twisted - the CGI implementation. Unfortunately this makes the CGI
>>implementation somewhat unsuited for real-world use.
>>
>>`Request.getClient` has always been allowed to return `None` under
>>certain
>>circumstances. I propose making it always return `None` and
>>deprecating it.
>>
>>This is implemented in the branch linked to <https://tm.tl/2252>.
>>
>>Chris Armstrong suggested that this change might not be strictly
>>keeping
>>with our backwards compatibility policy.
>>
>>I suggest that either it is - because `None` was always a possible
>>return
>>value - or that removing the possibility of blocking I/O from
>>applications
>>that are mistakenly using this API makes it worth the not-
>>strictly-compatible change.
>>
>>A minor adjustment might be to make it always return the IP address
>>instead,
>>as this was another behavior it previously had.
>>
>>Please comment. Thanks.
>>
>>Jean-Paul
>>
>>_______________________________________________
>>Twisted-Python mailing list
>>Twisted-Python at twistedmatrix.com
>>http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>_______________________________________________
>Twisted-Python mailing list
>Twisted-Python at twistedmatrix.com
>http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
More information about the Twisted-Python
mailing list