[Twisted-Python] Request.getClient

Dustin J. Mitchell dustin at v.igoro.us
Wed Jul 2 12:26:32 MDT 2014


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

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




More information about the Twisted-Python mailing list