A HTTP response.
Response headers.
| Type: | list |
|---|
Indicates if the response has begun.
Check if output (http headers & possible body) has been sent to the client.
Read-only.
True if begin() has been called and output has started, otherwise False.
| Type: | bool |
|---|
Respond with a series of byte strings.
This is equivalent of calling writelines(strings), thus if begin() has not yet been called, it will be. Calling without any arguments has no effect. Note that the arguments must be strings, as this method actually uses writelines.
Send a file to the client by using the host server sendfile-header technique.
| Parameters: |
|
|---|---|
| Raises EnvironmentError: | |
If smisk does not know how to perform sendfile through the current host server or if response has already started. |
|
| Raises IOError: | |
Begin response - send headers.
Automatically called by mechanisms like write() and Application.run().
| Raises EnvironmentError: | |
|---|---|
| if response has already started. | |
Write str bytes to out output stream.
begin() will be called if response has not yet begun.
| Parameters: |
|
|---|---|
| Raises IOError: |
Write a sequence of byte strings to the output stream.
The sequence lines can be any iterable object producing strings, typically a list or tuple of strings. There is no return value. (This interface matches that of the Python file object readlines() and writelines())
Does not add line separators or modify the strings in any way.
This method esentially calls begin() if not has_begun, then calls out.writelines(lines). The difference between calling writelines() (this method) and out.writelines() (Stream.writelines()) is that the latter will not call begin() if needed. You should always use this method instead of out.writelines(), unless you are certain begin() has been called. (begin() is automatically called upon after a service() call if it has not been called, so you can not count on it not being called at all.)
| Parameters: |
|
|---|---|
| Raises IOError: |
Find a header in the list of :attr:’headers’ matching prefix in a case-insensitive manner.
| Parameters: |
|
|---|---|
| Returns: | Index in :attr:’headers’ or -1 if not found. |
Set a cookie.
Setting a cookie effectively appends a header to headers. The cookie set will not be made available in Request.cookies.
| Parameters: |
|
|---|
Note
Setting a cookie will cause the response not to be cached by proxies and peer browsers.
See also
RFC 2109 - HTTP State Management Mechanism