[Twisted-Python] Aborting a connection attempt when HTTPS client detected on HTTP only server?
itamar at futurefoundries.com
Mon Feb 11 09:51:59 EST 2013
On Mon, Feb 11, 2013 at 9:24 AM, Michael Schlenker <msc at contact.de> wrote:
> Is there some pre-made solution, or would i have to hook into the
> connection setup of twisted.web and check the first few bytes for the
> signs of an SSL Handshake signature?
Subclassing the HTTP protocol class and just adding a check in dataReceived
is probably the easiest thing to do, yes. Might be worth filing a ticket
for this as well. My guess is the logic would be something like "in
dataReceived, if you've not hit first line, and any byte is non-ASCII,
close connection", which has the nice property of being more general than
just SSL. Or perhaps check what Apache does exactly.
Itamar Turner-Trauring, Future Foundries LLC
http://futurefoundries.com/ — Twisted consulting, training and support.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python