Skip to content

Web module

pedrofaria edited this page Feb 25, 2012 · 3 revisions

List of implemented functions:

web.request

  • 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.

Example

#!/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>");
Clone this wiki locally