twisted.web.test.injectionhelpers.URIInjectionTestsMixin(object)
class documentationtwisted.web.test.injectionhelpers
(View In Hierarchy)
Known subclasses: twisted.web.test.test_agent.AgentURIInjectionTests, twisted.web.test.test_agent.RequestURIInjectionTests, twisted.web.test.test_agent.RequestWriteToURIInjectionTests, twisted.web.test.test_webclient.DownloadPageURIInjectionTests, twisted.web.test.test_webclient.GetPageURIInjectionTests, twisted.web.test.test_webclient.HTTPClientFactorySetURLURIInjectionTests, twisted.web.test.test_webclient.HTTPClientFactoryURIInjectionTests, twisted.web.test.test_webclient.HTTPDownloaderSetURLURIInjectionTests, twisted.web.test.test_webclient.HTTPDownloaderURIInjectionTests, twisted.web.test.test_webclient.HTTPPageGetterURIInjectionTests
A mixin that runs HTTP URI injection tests. Define
MethodInjectionTestsMixin.attemptRequestWithMaliciousURI
in a
twisted.trial.unittest.SynchronousTestCase
subclass to test how HTTP client code behaves when presented with malicious
HTTP URIs.
Method | attemptRequestWithMaliciousURI | Attempt to send a request with the given URI. This should synchronously
raise a ValueError
if either is invalid. |
Method | test_hostWithCRLFRejected | Issuing a request with a URI whose host contains a carriage return and
line feed fails with a ValueError . |
Method | test_hostWithWithUnprintableASCIIRejected | Issuing a request with a URI whose host contains unprintable ASCII
characters fails with a ValueError . |
Method | test_hostWithNonASCIIRejected | Issuing a request with a URI whose host contains non-ASCII characters
fails with a ValueError . |
Method | test_pathWithCRLFRejected | Issuing a request with a URI whose path contains a carriage return and
line feed fails with a ValueError . |
Method | test_pathWithWithUnprintableASCIIRejected | Issuing a request with a URI whose path contains unprintable ASCII
characters fails with a ValueError . |
Method | test_pathWithNonASCIIRejected | Issuing a request with a URI whose path contains non-ASCII characters
fails with a ValueError . |
Attempt to send a request with the given URI. This should synchronously
raise a ValueError
if either is invalid.
Parameters | uri | the URI. |
Issuing a request with a URI whose host contains a carriage return and
line feed fails with a ValueError
.
Issuing a request with a URI whose host contains unprintable ASCII
characters fails with a ValueError
.
Issuing a request with a URI whose host contains non-ASCII characters
fails with a ValueError
.
Issuing a request with a URI whose path contains a carriage return and
line feed fails with a ValueError
.
Issuing a request with a URI whose path contains unprintable ASCII
characters fails with a ValueError
.
Issuing a request with a URI whose path contains non-ASCII characters
fails with a ValueError
.