![]() |
# 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 |
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

[ show source ]
# 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

Returns a string array of client-supported MIME accept types.
[ show source ]
# File lib/asp/request.rb, line 107 def acceptTypes ## -> string[] return @oApacheRequest.headers_in["Accept"].split( %r{,\s*} ) end

Returns the ASP application’s virtual application root path on the server.
[ show source ]
# File lib/asp/request.rb, line 113 def applicationPath ## -> string return @oApacheRequest.server.path end

Performs a binary read of a specified number of bytes from the current input stream. (Not Implemented)
[ show source ]
# File lib/asp/request.rb, line 267 def binaryRead( iCount ) ## -> bytes[] end

Returns information about the requesting client’s browser capabilities. (Not Implemented)
[ show source ]
# File lib/asp/request.rb, line 120 def browser ## -> System.Web.HttpBrowserCapabilities end

Returns the current request’s client security certificate. (Not Implemented)
[ show source ]
# File lib/asp/request.rb, line 126 def clientCertificate ## -> System.Web.HttpClientCertificate end

Returns the character set of the entity-body.
[ show source ]
# File lib/asp/request.rb, line 131 def contentEncoding ## -> System.Text.Encoding return @oApacheRequest.content_encoding end

Alias for totalBytes

Returns the MIME content type of the incoming request.
[ show source ]
# File lib/asp/request.rb, line 137 def contentType ## -> string return @oApacheRequest.content_type end

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.
[ show source ]
# 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

Returns the virtual path of the current request.
[ show source ]
# File lib/asp/request.rb, line 143 def currentExecutionFilePath ## -> string TO BE CORRECTED return serverVariables( 'REQUEST_URI' ) end

Alias for currentExecutionFilePath

Returns the collection of client-uploaded files (Multipart MIME format). (Not Implemented)
[ show source ]
# File lib/asp/request.rb, line 153 def files ## -> System.Web.HttpFileCollection end

Returns or sets the filter to use when reading the current input stream. (Not Implemented)
[ show source ]
# File lib/asp/request.rb, line 159 def filter ## -> stream end

Returns the value of the input of name used in a form with POST method.
[ show source ]
# 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

Returns a collection of HTTP headers.
[ show source ]
# 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

Alias for method

Returns the contents of the incoming HTTP entity body. (Not Implemented)
[ show source ]
# File lib/asp/request.rb, line 178 def inputStream ## -> stream end

Returns a value indicating whether the user has been authenticated.
[ show source ]
# File lib/asp/request.rb, line 183 def isAuthenticated( ) ## -> bool if @oApacheRequest.auth_name return true end return false end

Returns a value indicting whether the HTTP connection uses secure sockets (that is, HTTPS). (Not Implemented)
[ show source ]
# File lib/asp/request.rb, line 194 def isSecureConnection( ) ## -> bool end

Gets the specified object in the Cookies, Form, QueryString or ServerVariables collections. (To be Implemented)
[ show source ]
# File lib/asp/request.rb, line 200 def item( xKey ) ## -> string end

Maps an incoming image-field form parameter to appropriate x/y coordinate values. (Not Implemented)
[ show source ]
# File lib/asp/request.rb, line 273 def mapImageCoordinates( xImageFileName ) ## -> int[] end

Maps the specified virtual path to a physical path. (Not Implemented)
[ show source ]
# File lib/asp/request.rb, line 279 def mapPath( xVirtualPath, xBaseVirtualDir = nil, bAllowCrossAppMapping = nil ) ## -> string end

API extension. Returns the client HTTP request method, as in GET or POST.
[ show source ]
# File lib/asp/request.rb, line 76 def method return @oApacheRequest.request_method end

Returns a combined collection of QueryString, Form, ServerVariables, and Cookies items. (To be Implemented)
[ show source ]
# File lib/asp/request.rb, line 206 def params( ) ## -> System.Collections.Specialized.NameValueCollection end

Alias for currentExecutionFilePath

Returns additional path information for a resource with a URL extension. (Not Implemented)
[ show source ]
# File lib/asp/request.rb, line 212 def pathInfo ## -> string end

Returns the physical file system path of the currently executing server application’s root directory. (Not Implemented)
[ show source ]
# File lib/asp/request.rb, line 218 def physicalApplicationPath ## -> string end

Returns the physical file system path corresponding to the requested URL.
[ show source ]
# File lib/asp/request.rb, line 223 def physicalPath ## -> string TO BE CORRECTED return( Dir.pwd( ) + "/" + serverVariables( "SCRIPT_NAME" ).gsub( /^.*\//, '' ) ) end

API extension. Returns the unparsed query string.
[ show source ]
# File lib/asp/request.rb, line 57 def query @param.getQuery( ) end

Returns the value of the input of name used in a form with GET method.
[ show source ]
# 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

Alias for currentExecutionFilePath

Alias for method

Saves an HTTP request to disk. (Not Implemented)
[ show source ]
# File lib/asp/request.rb, line 285 def saveAs( xFilename, bIncludeHeaders ) ## -> void end

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.
[ show source ]
# 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

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')
[ show source ]
# File lib/asp/request.rb, line 85 def totalBytes return @oApacheRequest.headers_in["Content-Length"] || 0 end

Returns Information about the URL of the current request. (Not Implemented)
[ show source ]
# File lib/asp/request.rb, line 230 def url ## -> System.Uri end

Returns information about the URL of the client’s previous request that linked to the current URL.
[ show source ]
# File lib/asp/request.rb, line 235 def urlReferrer ## -> System.Uri return( serverVariables( 'HTTP_REFERER' ) ) end

Returns the raw user agent string of the client browser.
[ show source ]
# File lib/asp/request.rb, line 241 def userAgent ## -> string return @oApacheRequest.headers_in['User-Agent'] end

Returns the IP host address of the remote client.
[ show source ]
# File lib/asp/request.rb, line 247 def userHostAddress ## -> string # return @oApacheRequest.remote_host( ) return @oApacheRequest.connection.remote_ip end

Returns the DNS name of the remote client.
[ show source ]
# File lib/asp/request.rb, line 254 def userHostName # return @oApacheRequest.headers_in['Host'] return @oApacheRequest.connection.remote_host end

Returns a sorted string array of client language preferences.
[ show source ]
# File lib/asp/request.rb, line 260 def userLanguages ## -> string[] return @oApacheRequest.headers_in["Accept-Language"].split( %r{,\s*} ) end

Validates data submitted by a client browser and raises an exception if potentially dangerous data is present. (Not Implemented)
[ show source ]
# File lib/asp/request.rb, line 291 def validateInput( ) ## -> void end