HTTPServerResponse

Represents a HTTP response as sent from the server side.

struct HTTPServerResponse {}

Constructors

this
this(HTTPServerResponseData* data)
Undocumented in source.
this
this(Stream conn, ConnectionStream raw_connection, HTTPServerSettings settings, IAllocator req_alloc)
Undocumented in source.
this
this(InterfaceProxy!Stream conn, InterfaceProxy!ConnectionStream raw_connection, HTTPServerSettings settings, IAllocator req_alloc)
Undocumented in source.

Members

Functions

connectProxy
ConnectionStream connectProxy()
void connectProxy(void delegate(scope ConnectionStream) @(safe) del)

Special method for handling CONNECT proxy tunnel

finalize
void finalize()

Finalizes the response. This is usually called automatically by the server.

opCast
auto opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
redirect
void redirect(T url, int status)

Sends a redirect request to the client.

sendBadRequest
void sendBadRequest()
Undocumented in source. Be warned that the author may not have intended to support it.
setCookie
Cookie setCookie(string name, string value, string path, Cookie.Encoding encoding)

Sets the specified cookie value.

setStatusCode
void setStatusCode(int v)
Undocumented in source. Be warned that the author may not have intended to support it.
startSession
Session startSession(string path, SessionOption options)

Initiates a new session.

switchProtocol
ConnectionStream switchProtocol(string protocol)
void switchProtocol(string protocol, void delegate(scope ConnectionStream) @(safe) del)
switchToHTTP2
void switchToHTTP2(HANDLER handler, HTTP2ServerContext context)

Special method sending a SWITCHING_PROTOCOLS response to the client.

terminateSession
void terminateSession()

Terminates the current session (if any).

waitForConnectionClose
bool waitForConnectionClose(Duration timeout)

Waits until either the connection closes, data arrives, or until the given timeout is reached.

writeBody
void writeBody(ubyte[] data, string contentType)
Undocumented in source. Be warned that the author may not have intended to support it.
writeBody
void writeBody(InputStream data, string content_type)
Undocumented in source. Be warned that the author may not have intended to support it.
writeBody
void writeBody(string data, string content_type)
Undocumented in source. Be warned that the author may not have intended to support it.
writeBody
void writeBody(string data, int status, string content_type)
Undocumented in source. Be warned that the author may not have intended to support it.
writeJsonBody
void writeJsonBody(T data, int status, bool allow_chunked)
void writeJsonBody(T data, int status, string content_type, bool allow_chunked)
void writeJsonBody(T data, string content_type, bool allow_chunked)
void writeJsonBody(T data, bool allow_chunked)
writePrettyJsonBody
void writePrettyJsonBody(T data, bool allow_chunked)

Writes a JSON message with the specified status

writeRawBody
void writeRawBody(RandomAccessStream stream)
Undocumented in source. Be warned that the author may not have intended to support it.
writeRawBody
void writeRawBody(InputStream stream, size_t num_bytes)
void writeRawBody(RandomAccessStream stream, int status)
void writeRawBody(InputStream stream, int status, size_t num_bytes)

ditto

Properties

bodyWriter
InterfaceProxy!OutputStream bodyWriter [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
bodyWriterH2
void bodyWriterH2(T writer, bool writeH)
Undocumented in source. Be warned that the author may not have intended to support it.
bytesWritten
ulong bytesWritten [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
connected
bool connected [@property getter]

Determines if the underlying connection is still alive.

contentType
string contentType [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
contentType
string contentType [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
cookies
Cookie[string] cookies [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
data
data [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
headerWritten
bool headerWritten [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
headers
InetHeaderMap headers [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
headers
InetHeaderMap headers [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
httpVersion
HTTPVersion httpVersion [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
httpVersion
HTTPVersion httpVersion [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
isHeadResponse
bool isHeadResponse [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
m_isHeadResponse
bool m_isHeadResponse [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
m_session
Session m_session [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
m_settings
HTTPServerSettings m_settings [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
statusCode
int statusCode [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
statusCode
HTTPStatus statusCode [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
statusCode
int statusCode [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
statusPhrase
string statusPhrase [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
timeFinalized
SysTime timeFinalized [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
tls
bool tls [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
tls
bool tls [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
writeVoidBody
void writeVoidBody [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
writeVoidBody
Stream writeVoidBody [@property setter]

Writes a JSON message with the specified status

Meta