-
Notifications
You must be signed in to change notification settings - Fork 16
Web module
pedrofaria edited this page Feb 25, 2012
·
3 revisions
List of implemented functions:
-
String param(String name)
- Returns the value of Query String parameter. -
String getServerSoftware()
- Returns the name and version of the HTTP server software. -
String getServerName()
- Returns the hostname, DNS name or IP address of the HTTP server. -
String getGatewayInterface()
- Returns the name and version of the gateway interface. -
String getServerProtocol()
- Returns the name and revision of the protocol used for this request. -
Int getServerPort()
- Returns the port number on the server to which this request was sent.
-
String getRequestMethod()
- Returns the request method used for this query. -
String getPathInfo()
- Returns the extra path information for this request, given by the client. -
String getPathTranslated()
- Returns the translated path information (virtual to physical mapping). -
String getScriptName()
- Returns the full path to this CGI application. -
String getQueryString()
- Returns the query string for this request. -
Int getContentLength()
- Returns the length of the data read from standard input, in chars. -
String getContentType()
- Returns the content type of the submitted information. -
String getPostData()
- Returns the data passed to the CGI application via standard input.
-
String getReferrer()
- Returns the URL of the page which called this CGI application.
-
String getRemoteHost()
- Returns the hostname of the remote machine making this request. -
String getRemoteAddr()
- Returns the IP address of the remote machine making this request. -
String getAuthType()
- Returns the protocol-specific user authentication method used. -
String getRemoteUser()
- Returns the authenticated remote user name. -
String getRemoteIdent()
- Returns the remote user name retrieved from the server. -
String getAccept()
- Returns the MIME data types accepted by the client's browser. -
String getUserAgent()
- Returns the name of the browser used for this CGI request.
#!/path/to/clever
import std.io;
import web;
web.session::header();
println("<http><head><title>Header Data</title></head><body>");
println("<h1>Header data</h1>");
println('getServerSoftware: ', web.request::getServerSoftware(), '<br />');
println('getServerName: ', web.request::getServerName(), '<br />');
println('getGatewayInterface: ', web.request::getGatewayInterface(), '<br />');
println('getServerProtocol: ', web.request::getServerProtocol(), '<br />');
println('getServerPort: ', web.request::getServerPort(), '<br />');
println('usingHTTPS: ', web.request::usingHTTPS(), '<br />');
println('<br />');
println('Path Info: ', web.request::getPathInfo(), '<br />');
println('Method: ', web.request::getRequestMethod(), '<br />');
println('Path Translated: ', web.request::getPathTranslated(), '<br />');
println('Script Name: ', web.request::getScriptName(), '<br />');
println('Query String: ', web.request::getQueryString(), '<br />');
println('Content Type: ', web.request::getContentType(), '<br />');
println('Post Data: ', web.request::getPostData(), '<br />');
println('Content Length: ', web.request::getContentLength(), '<br />');
println('<br />');
println('getReferrer: ', web.request::getReferrer(), '<br />');
println('<br />');
println('getRemoteHost: ', web.request::getRemoteHost(), '<br />');
println('getRemoteAddr: ', web.request::getRemoteAddr(), '<br />');
println('getAuthType: ', web.request::getAuthType(), '<br />');
println('getRemoteUser: ', web.request::getRemoteUser(), '<br />');
println('getRemoteIdent: ', web.request::getRemoteIdent(), '<br />');
println('getAccept: ', web.request::getAccept(), '<br />');
println('getUserAgent: ', web.request::getUserAgent(), '<br />');
println("</body></html>");