Cgi.this
this
(string[] args, void delegate(const(ubyte)[]) _rawDataOutput = null)Initializes it with command line arguments (for easy testing)
this
(long maxContentLength = defaultMaxContentLength,
// use this to override the environment variable listing
in string[string] env = null,
// and this should return a chunk of data. return empty when done
const(ubyte)[] delegate() readdata = null,
// finally, use this to do custom output if needed
void delegate(const(ubyte)[]) _rawDataOutput = null,
// to flush teh custom output
void delegate() _flush = null
)Initializes it using a CGI or CGI-like interface
this
(BufferedInputRange ir, bool * closeConnection)Initializes the cgi from completely raw HTTP data. The ir must have a Socket source. *closeConnection will be set to true if you should close the connection after handling this request
this
(
BufferedInputRange inputData,
// string[] headers, immutable(ubyte)[] data,
string address, ushort _port,
int pathInfoStarts = 0, // use this if you know the script name, like if this is in a folder in a bigger web environment
bool _https = false,
void delegate(const(ubyte)[]) _rawDataOutput = null,
void delegate() _flush = null,
// this pointer tells if the connection is supposed to be closed after we handle this
bool * closeConnection = null)Initializes it from raw HTTP request data. GenericMain uses this when you compile with -version=embedded_httpd.
NOTE: If you are behind a reverse proxy, the values here might not be what you expect.... it will use X-Forwarded-For for remote IP and X-Forwarded-Host for host
Parameters
inputData | the incoming data, including headers and other raw http data. When the constructor exits, it will leave this range exactly at the start of the next request on the connection (if there is one). |
address | the IP address of the remote user |
_port | the port number of the connection |
pathInfoStarts | the offset into the path component of the http header where the SCRIPT_NAME ends and the PATH_INFO begins. |
_https | if this connection is encrypted (note that the input data must not actually be encrypted) |
_rawDataOutput | delegate to accept response data. It should write to the socket or whatever; Cgi does all the needed processing to speak http. |
_flush | if _rawDataOutput buffers, this delegate should flush the buffer down the wire |
closeConnection | if the request asks to close the connection, *closeConnection == true. |