Part of twisted.web2 View Source
The second coming.
Maintainer: James Y Knight
Function | splitHostPort | Split the host in "host:port" format into host and port fields. |
Function | parseVersion | Parse version strings of the form Protocol '/' Major '.' Minor. E.g. 'HTTP/1.1'. |
Class | HTTPError | No class docstring; 1/2 methods documented |
Class | Response | An object representing an HTTP Response to be sent to the client. |
Class | StatusResponse | A Response
object which simply contains a status code and a description of |
Class | RedirectResponse | A Response
object that contains a redirect to another network location. |
Function | NotModifiedResponse | Undocumented |
Function | checkPreconditions | Check to see if this request passes the conditional checks specified |
Function | checkIfRange | Checks for the If-Range header, and if it exists, checks if the |
Class | Request | A HTTP request. |
Class | _NotifyingProducerStream | Undocumented |
NOT_MODIFIED
or PRECONDITION_FAILED
, as
appropriate.
This function is called automatically as an output filter for GET and HEAD requests. With GET/HEAD, it is not important for the precondition check to occur before doing the action, as the method is non-destructive.
However, if you are implementing other request methods, like PUT for your resource, you will need to call this after determining the etag and last-modified time of the existing resource but before actually doing the requested action. In that case,
This examines the appropriate request headers for conditionals, (If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range), compares with the etag and last and and then sets the response code as necessary.
Parameters | response | This should be provided for GET/HEAD methods. If it is specified, the etag and lastModified arguments will be retrieved automatically from the response headers and shouldn't be separately specified. Not providing the response with a GET request may cause the emitted "Not Modified" responses to be non-conformant. |
entityExists | Set to False if the entity in question doesn't yet exist. Necessary for PUT support with 'If-None-Match: *'. | |
etag | The etag of the resource to check against, or None. | |
lastModified | The last modified date of the resource to check against, or None. | |
Raises | HTTPError: Raised when the preconditions fail, in order to abort processing and emit an error page. |