Class: Apache::Request

Inherits:
ModRubySimObject show all
Defined in:
lib/apache/fakerequest.rb

Overview

Apache::Request

Constant Summary collapse

INSTANCE_METHODS =
%w{
	<< add_cgi_vars add_common_vars all_params allow_options
          allow_overrides allowed allowed= args args= attributes auth_name
          auth_name= auth_type auth_type= binmode bytes_sent cache_resp
          cache_resp= cancel connection construct_url content_encoding
          content_encoding= content_languages content_languages=
          content_length content_type content_type= cookies cookies=
          custom_response default_charset default_type disable_uploads=
          disable_uploads? dispatch_handler dispatch_handler= eof eof?
          err_headers_out error_message escape_html exception filename
          filename= finfo get_basic_auth_pw get_client_block getc
          hard_timeout header_only? headers_in headers_out hostname
          initial? internal_redirect kill_timeout last log_reason
          lookup_file lookup_uri main main? method_number next
          note_auth_failure note_basic_auth_failure
          note_digest_auth_failure notes options output_buffer param
          params params_as_string paramtable parse path_info path_info=
          post_max post_max= prev print printf protocol proxy? proxy_pass?
          putc puts read register_cleanup remote_host remote_logname
          replace request_method request_time requires reset_timeout
          satisfies script_name script_path send_fd send_http_header
          sent_http_header? server server_name server_port setup_cgi_env
          setup_client_block should_client_block should_client_block?
          signature soft_timeout status status= status_line status_line=
          subprocess_env sync= sync_header sync_header= sync_output
          sync_output= temp_dir temp_dir= the_request unparsed_uri
          upload_hook upload_hook= upload_hook_data upload_hook_data=
          uploads uploads_disabled? uri uri= user user= write
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ModRubySimObject

inherited

Constructor Details

#initialize(uri = nil) ⇒ Request

Returns a new instance of Request.



330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/apache/fakerequest.rb', line 330

def initialize( uri=nil )
	@uri = uri
	@server = nil
	@allowed = Apache::M_GET | Apache::M_POST
	@paramtable = {}
	@sync_header = false
	@content_type = 'text/html'
	@hostname = 'localhost'
	@path_info = ''
	@headers_in = Apache::Table.new
	@headers_out = Apache::Table.new
	@options = {}
	@uploads = {}
	@method_number = Apache::M_GET
	@connection = Apache::Connection.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Apache::ModRubySimObject

Instance Attribute Details

#allowedObject

Returns the value of attribute allowed.



348
349
350
# File 'lib/apache/fakerequest.rb', line 348

def allowed
  @allowed
end

#connectionObject

Returns the value of attribute connection.



348
349
350
# File 'lib/apache/fakerequest.rb', line 348

def connection
  @connection
end

#content_typeObject

Returns the value of attribute content_type.



348
349
350
# File 'lib/apache/fakerequest.rb', line 348

def content_type
  @content_type
end

#cookiesObject

Returns the value of attribute cookies.



348
349
350
# File 'lib/apache/fakerequest.rb', line 348

def cookies
  @cookies
end

#headers_inObject

Returns the value of attribute headers_in.



348
349
350
# File 'lib/apache/fakerequest.rb', line 348

def headers_in
  @headers_in
end

#headers_outObject

Returns the value of attribute headers_out.



348
349
350
# File 'lib/apache/fakerequest.rb', line 348

def headers_out
  @headers_out
end

#hostnameObject

Returns the value of attribute hostname.



348
349
350
# File 'lib/apache/fakerequest.rb', line 348

def hostname
  @hostname
end

#method_numberObject

Returns the value of attribute method_number.



348
349
350
# File 'lib/apache/fakerequest.rb', line 348

def method_number
  @method_number
end

#optionsObject

Returns the value of attribute options.



348
349
350
# File 'lib/apache/fakerequest.rb', line 348

def options
  @options
end

#paramtableObject Also known as: params

Returns the value of attribute paramtable.



348
349
350
# File 'lib/apache/fakerequest.rb', line 348

def paramtable
  @paramtable
end

#path_infoObject

Returns the value of attribute path_info.



348
349
350
# File 'lib/apache/fakerequest.rb', line 348

def path_info
  @path_info
end

#serverObject



370
371
372
# File 'lib/apache/fakerequest.rb', line 370

def server
	@server ||= Apache::Server.new
end

#sync_headerObject

Returns the value of attribute sync_header.



348
349
350
# File 'lib/apache/fakerequest.rb', line 348

def sync_header
  @sync_header
end

#uploadsObject

Returns the value of attribute uploads.



348
349
350
# File 'lib/apache/fakerequest.rb', line 348

def uploads
  @uploads
end

#uriObject Also known as: unparsed_uri

Returns the value of attribute uri.



348
349
350
# File 'lib/apache/fakerequest.rb', line 348

def uri
  @uri
end

Class Method Details

.instance_methods(include_superclass = true) ⇒ Object



325
326
327
# File 'lib/apache/fakerequest.rb', line 325

def self::instance_methods( include_superclass=true )
	return INSTANCE_METHODS
end

Instance Method Details

#param(key) ⇒ Object



361
362
363
# File 'lib/apache/fakerequest.rb', line 361

def param( key )
	@paramtable[ key ]
end

#remote_host(lookup = nil) ⇒ Object



383
384
385
# File 'lib/apache/fakerequest.rb', line 383

def remote_host( lookup=nil )
	return '127.0.0.1'
end

#request_methodObject



374
375
376
# File 'lib/apache/fakerequest.rb', line 374

def request_method
	return Apache::METHOD_NUMBERS_TO_NAMES[ @method_number ]
end

#request_method=(methodname) ⇒ Object



378
379
380
381
# File 'lib/apache/fakerequest.rb', line 378

def request_method=( methodname )
	@method_number = Apache::METHOD_NAMES_TO_NUMBERS[ methodname ] or
		raise "No such HTTP method '%s'" % [methodname]
end

#statusObject



391
392
393
# File 'lib/apache/fakerequest.rb', line 391

def status
	return Apache::OK
end

#the_requestObject



387
388
389
# File 'lib/apache/fakerequest.rb', line 387

def the_request
	return 'GET / HTTP/1.1'
end