Applying patch from Glyph & Alex Gaynor, reviewed by David Reid

git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/branches/releases/release-14.0.1-7646@43118 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb