# Class: Asp::Request
[ "README", "lib/asp/server.rb", "lib/asp/application.rb", "lib/asp/request.rb", "lib/asp/response.rb", "lib/asp/session.rb", nil].each do
Asp.view_html
Asp::Session.view_html
Asp::Response.view_html
Asp::Application.view_html
Asp::Server.view_html
Asp::Request.view_html
Asp::Eval.view_html
end

Class Asp::Request < Object

(in files lib/asp/request.rb )

Copyright (C) 2003, 2004 Gregoire Lejeune <gregoire.lejeune@free.fr>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Methods

Public Class method: new( r, oAspError, aspHandler )

# File lib/asp/request.rb, line 318
    def initialize( r, oAspError, aspHandler )
      @oApacheRequest = r
      @oAspError = oAspError
      @oAspHandler = aspHandler
      
      @param = Asp::Params::new( @oApacheRequest )
      @params = @param.params
      @cookies = getCookies
    end

Public Instance method: acceptTypes()

Returns a string array of client-supported MIME accept types.

# File lib/asp/request.rb, line 107
    def acceptTypes 
      ## -> string[]
      return @oApacheRequest.headers_in["Accept"].split( %r{,\s*} )
    end

Public Instance method: applicationPath()

Returns the ASP application’s virtual application root path on the server.

# File lib/asp/request.rb, line 113
    def applicationPath 
      ## -> string
      return @oApacheRequest.server.path
    end

Public Instance method: binaryRead( iCount )

Performs a binary read of a specified number of bytes from the current input stream. (Not Implemented)

# File lib/asp/request.rb, line 267
    def binaryRead( iCount )
      ## -> bytes[]
    end

Public Instance method: browser()

Returns information about the requesting client’s browser capabilities. (Not Implemented)

# File lib/asp/request.rb, line 120
    def browser
      ## -> System.Web.HttpBrowserCapabilities
    end

Public Instance method: clientCertificate()

Returns the current request’s client security certificate. (Not Implemented)

# File lib/asp/request.rb, line 126
    def clientCertificate
      ## -> System.Web.HttpClientCertificate
    end

Public Instance method: contentEncoding()

Returns the character set of the entity-body.

# File lib/asp/request.rb, line 131
    def contentEncoding
      ## -> System.Text.Encoding
      return @oApacheRequest.content_encoding
    end

Public Instance method: contentLength()

Alias for totalBytes

Public Instance method: contentType()

Returns the MIME content type of the incoming request.

# File lib/asp/request.rb, line 137
    def contentType
      ## -> string
      return @oApacheRequest.content_type
    end

Public Instance method: cookies( name=nil, key=nil )

Returns the value of the Cookie with name. If a key is specified, then a lookup will be done on the cookie as if it were a query string.

# File lib/asp/request.rb, line 63
    def cookies( name=nil, key=nil )
      if name.nil? == true
        return @cookies
      elsif key.nil? == true and @cookies[name].nil? == false
        return @cookies[name]
      elsif String( @cookies[name].class ) == "Hash" and @cookies[name][key].nil? == false
        return @cookies[name][key]
      end

      return nil
    end

Public Instance method: currentExecutionFilePath()

Returns the virtual path of the current request.

# File lib/asp/request.rb, line 143
    def currentExecutionFilePath
      ## -> string TO BE CORRECTED
      return serverVariables( 'REQUEST_URI' )
    end

Public Instance method: filePath()

Alias for currentExecutionFilePath

Public Instance method: files()

Returns the collection of client-uploaded files (Multipart MIME format). (Not Implemented)

# File lib/asp/request.rb, line 153
    def files
      ## -> System.Web.HttpFileCollection
    end

Public Instance method: filter()

Returns or sets the filter to use when reading the current input stream. (Not Implemented)

# File lib/asp/request.rb, line 159
    def filter
      ## -> stream
    end

Public Instance method: form( key )

Returns the value of the input of name used in a form with POST method.

# File lib/asp/request.rb, line 26
    def form( key )
      if @oApacheRequest.request_method == "POST" 
        if @params[key].nil? == false and @params[key].size > 0
          if @params[key].size == 1
            return @params[key][0]
          else
            return @params[key]
          end
        else
          return nil
        end
      end
    end

Public Instance method: headers( xName = nil )

Returns a collection of HTTP headers.

# File lib/asp/request.rb, line 164
    def headers( xName = nil )
      if xName.nil? == false 
        if @oApacheRequest.headers_in[xName]
          return @oApacheRequest.headers_in[xName]
        else
          return nil
        end
      end  
      
      return @oApacheRequest.headers_in
    end

Public Instance method: httpMethod()

Alias for method

Public Instance method: inputStream()

Returns the contents of the incoming HTTP entity body. (Not Implemented)

# File lib/asp/request.rb, line 178
    def inputStream
      ## -> stream
    end

Public Instance method: isAuthenticated( )

Returns a value indicating whether the user has been authenticated.

# File lib/asp/request.rb, line 183
    def isAuthenticated( )
      ## -> bool
      if @oApacheRequest.auth_name
        return true
      end
      
      return false
    end

Public Instance method: isSecureConnection( )

Returns a value indicting whether the HTTP connection uses secure sockets (that is, HTTPS). (Not Implemented)

# File lib/asp/request.rb, line 194
    def isSecureConnection( )
      ## -> bool
    end

Public Instance method: item( xKey )

Gets the specified object in the Cookies, Form, QueryString or ServerVariables collections. (To be Implemented)

# File lib/asp/request.rb, line 200
    def item( xKey )
      ## -> string
    end

Public Instance method: mapImageCoordinates( xImageFileName )

Maps an incoming image-field form parameter to appropriate x/y coordinate values. (Not Implemented)

# File lib/asp/request.rb, line 273
    def mapImageCoordinates( xImageFileName )
      ## -> int[]
    end

Public Instance method: mapPath( xVirtualPath, xBaseVirtualDir = nil, bAllowCrossAppMapping = nil )

Maps the specified virtual path to a physical path. (Not Implemented)

# File lib/asp/request.rb, line 279
    def mapPath( xVirtualPath, xBaseVirtualDir = nil, bAllowCrossAppMapping = nil )
      ## -> string
    end

Public Instance method: method()

API extension. Returns the client HTTP request method, as in GET or POST.

# File lib/asp/request.rb, line 76
    def method
      return @oApacheRequest.request_method
    end

Public Instance method: params( )

Returns a combined collection of QueryString, Form, ServerVariables, and Cookies items. (To be Implemented)

# File lib/asp/request.rb, line 206
    def params( )
      ## -> System.Collections.Specialized.NameValueCollection
    end

Public Instance method: path()

Alias for currentExecutionFilePath

Public Instance method: pathInfo()

Returns additional path information for a resource with a URL extension. (Not Implemented)

# File lib/asp/request.rb, line 212
    def pathInfo
      ## -> string
    end

Public Instance method: physicalApplicationPath()

Returns the physical file system path of the currently executing server application’s root directory. (Not Implemented)

# File lib/asp/request.rb, line 218
    def physicalApplicationPath
      ## -> string
    end

Public Instance method: physicalPath()

Returns the physical file system path corresponding to the requested URL.

# File lib/asp/request.rb, line 223
    def physicalPath
      ## -> string TO BE CORRECTED
      return( Dir.pwd( ) + "/" + serverVariables( "SCRIPT_NAME" ).gsub( /^.*\//, '' ) )
    end

Public Instance method: query()

API extension. Returns the unparsed query string.

# File lib/asp/request.rb, line 57
    def query
      @param.getQuery( )
    end

Public Instance method: queryString( key )

Returns the value of the input of name used in a form with GET method.

# File lib/asp/request.rb, line 41
    def queryString( key )
      if @oApacheRequest.request_method == "GET" or
         @oApacheRequest.request_method == "HEAD"
        if @params[key].nil? == false and @params[key].size > 0
          if @params[key].size == 1
            return @params[key][0]
          else
            return @params[key]
          end
        else
          return nil
        end
      end
    end

Public Instance method: rawUrl()

Alias for currentExecutionFilePath

Public Instance method: requestType()

Alias for method

Public Instance method: saveAs( xFilename, bIncludeHeaders )

Saves an HTTP request to disk. (Not Implemented)

# File lib/asp/request.rb, line 285
    def saveAs( xFilename, bIncludeHeaders )
      ## -> void
    end

Public Instance method: serverVariables( name=nil )

Returns the value of the server variable / environment variable with name name. If name is not specified, returns a ref to a hash of all the server / environment variables data. The following would be a common use of this method:

    env = $Request.serverVariables();
    # env here would be equivalent to the ENV.
# File lib/asp/request.rb, line 96
    def serverVariables( name=nil )
      if name.nil? == true
        return @oApacheRequest.subprocess_env
        #return ENV.untaint
      else
        return @oApacheRequest.subprocess_env.get( name )
        #return ENV[name].untaint
      end
    end

Public Instance method: totalBytes()

The amount of data sent by the client in the body of the request, usually the length of the form data. This is the same value as

    $Request.serverVariables('CONTENT_LENGTH')
# File lib/asp/request.rb, line 85
    def totalBytes
      return @oApacheRequest.headers_in["Content-Length"] || 0
    end

Public Instance method: url()

Returns Information about the URL of the current request. (Not Implemented)

# File lib/asp/request.rb, line 230
    def url
      ## -> System.Uri
    end

Public Instance method: urlReferrer()

Returns information about the URL of the client’s previous request that linked to the current URL.

# File lib/asp/request.rb, line 235
    def urlReferrer
      ## -> System.Uri
      return( serverVariables( 'HTTP_REFERER' ) )
    end

Public Instance method: userAgent()

Returns the raw user agent string of the client browser.

# File lib/asp/request.rb, line 241
    def userAgent
      ## -> string
      return @oApacheRequest.headers_in['User-Agent']
    end

Public Instance method: userHostAddress()

Returns the IP host address of the remote client.

# File lib/asp/request.rb, line 247
    def userHostAddress
      ## -> string
      # return @oApacheRequest.remote_host( )
      return @oApacheRequest.connection.remote_ip
    end

Public Instance method: userHostName()

Returns the DNS name of the remote client.

# File lib/asp/request.rb, line 254
    def userHostName
      # return @oApacheRequest.headers_in['Host']
      return @oApacheRequest.connection.remote_host
    end

Public Instance method: userLanguages()

Returns a sorted string array of client language preferences.

# File lib/asp/request.rb, line 260
    def userLanguages
      ## -> string[]
      return @oApacheRequest.headers_in["Accept-Language"].split( %r{,\s*} )
    end

Public Instance method: validateInput( )

Validates data submitted by a client browser and raises an exception if potentially dangerous data is present. (Not Implemented)

# File lib/asp/request.rb, line 291
    def validateInput( )
      ## -> void
    end