2005-07-24 20:53:54 +00:00
|
|
|
require 'rex/socket'
|
|
|
|
require 'rex/proto/http'
|
|
|
|
|
|
|
|
module Rex
|
|
|
|
module Proto
|
|
|
|
module Http
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# Acts as a client to an HTTP server, sending requests and receiving
|
|
|
|
# responses. This is modeled somewhat after Net::HTTP.
|
|
|
|
#
|
|
|
|
###
|
|
|
|
class Client
|
|
|
|
|
2005-08-22 04:34:40 +00:00
|
|
|
include Proto
|
|
|
|
|
2005-07-24 20:53:54 +00:00
|
|
|
#
|
2005-11-15 05:22:13 +00:00
|
|
|
# Performs a block-based HTTP operation.
|
2005-07-24 20:53:54 +00:00
|
|
|
#
|
|
|
|
def self.start(host, &block)
|
|
|
|
c = Client.new(host)
|
|
|
|
|
|
|
|
begin
|
|
|
|
block.call(c)
|
|
|
|
ensure
|
|
|
|
c.stop
|
|
|
|
end
|
|
|
|
end
|
2005-09-15 23:37:38 +00:00
|
|
|
|
2005-08-22 04:34:40 +00:00
|
|
|
#
|
|
|
|
# Initializes a GET request and returns it to the caller.
|
|
|
|
#
|
2005-12-08 05:55:44 +00:00
|
|
|
def gen_get(uri = '/', proto = DefaultProtocol)
|
2005-07-24 20:53:54 +00:00
|
|
|
return init_request(Request::Get.new(uri, proto))
|
|
|
|
end
|
|
|
|
|
2005-12-08 05:55:44 +00:00
|
|
|
#
|
|
|
|
# Initializes a POST request and returns it to the caller.
|
|
|
|
#
|
|
|
|
def gen_post(uri = '/', proto = DefaultProtocol)
|
|
|
|
return init_request(Request::Post.new(uri, proto))
|
|
|
|
end
|
|
|
|
|
2006-01-20 18:59:24 +00:00
|
|
|
def initialize(host, port = 80, context = {}, ssl = nil)
|
2005-07-24 20:53:54 +00:00
|
|
|
self.hostname = host
|
|
|
|
self.port = port.to_i
|
2006-01-17 04:35:44 +00:00
|
|
|
self.context = context
|
2006-01-20 18:59:24 +00:00
|
|
|
self.ssl = ssl
|
2005-09-15 23:37:38 +00:00
|
|
|
self.request_config = {}
|
|
|
|
self.client_config = {}
|
2005-07-24 20:53:54 +00:00
|
|
|
end
|
|
|
|
|
2005-08-22 04:34:40 +00:00
|
|
|
#
|
|
|
|
# HTTP client.
|
|
|
|
#
|
|
|
|
def alias
|
|
|
|
"HTTP Client"
|
|
|
|
end
|
|
|
|
|
2005-09-15 23:37:38 +00:00
|
|
|
#
|
2005-11-15 05:22:13 +00:00
|
|
|
# Configures the Client object and the Request factory.
|
2005-09-15 23:37:38 +00:00
|
|
|
#
|
2006-04-30 19:49:27 +00:00
|
|
|
def config(chash)
|
2005-09-15 23:37:38 +00:00
|
|
|
req_opts = %w{ user-agent vhost cookie proto }
|
|
|
|
cli_opts = %w{ max-data }
|
|
|
|
chash.each_pair { |k,v|
|
|
|
|
req_opts.include?(k) ?
|
|
|
|
self.request_config[k] = v : self.client_config[k] = v
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
2005-11-15 05:22:13 +00:00
|
|
|
# Set parameters for the Request factory.
|
2005-09-15 23:37:38 +00:00
|
|
|
#
|
|
|
|
def request_option(k, v)
|
|
|
|
(v != nil) ? self.request_config[k] = v : self.request_config[k]
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
2005-11-15 05:22:13 +00:00
|
|
|
# Set parameters for the actual Client.
|
2005-09-15 23:37:38 +00:00
|
|
|
#
|
|
|
|
def client_option(k, v)
|
|
|
|
(v != nil) ? self.client_config[k] = v : self.client_config[k]
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
2005-11-15 05:22:13 +00:00
|
|
|
# The Request factory.
|
2005-09-15 23:37:38 +00:00
|
|
|
#
|
2006-04-30 19:49:27 +00:00
|
|
|
def request(chash)
|
2005-12-14 00:21:23 +00:00
|
|
|
method = chash['method'] || 'GET'
|
|
|
|
proto = chash['proto'] || self.request_config['proto'] || DefaultProtocol
|
|
|
|
uri = chash['uri'] || '/'
|
2005-09-15 23:37:38 +00:00
|
|
|
|
|
|
|
req = Rex::Proto::Http::Request.new(method, uri, proto)
|
* add junk pipelined request support
* fix socket creation on pipelined requests
* when a server says that the connection should be closed (Connection: closed), then close the connection, since its going to regardless, and we don't want to loose our state
* support non-standard line termination in headers. ie \n instead of \r\n
* add junk headers (X-rand: rand)
* add header folding (for evasion)
* add parse_header_re (still leaving parse_header around, though its dead code ATM) that does the right thing on non-standard line endings
* move 'gzip' to a 'compression' option
* add 'deflate' compression option (really, just raw zlib, and only firefox does deflate right)
* fix a bunch of TE:chunked decoding bugs based based on the fact that Apache doesn't always close chunks appropriately
* modify parse_body to not return state, since it doesn't always do that, and the return isn't used... self.state is.
* add TE:chunked request support
* normalize URIs in requests before saving them
* Move params out of the URI, but when the uri is requested, and the method is GET, and there are params, return a URI that has the params that are approrpiately encoded (needed for junk_params, see below)
* move request.to_s support of params to use the request params array when a POST, allows use of junk params support (see below). NOTE: If the body is provided, use the body instead of params, in case you want to hardcode the params in a POST request, eg: php_xmlrpc_eval.rb
* Add junk params when building a param list, eg: a=b becomes asdfasdf=asdrt32a&asdfad=okhgasd&a=b&hjklasdf=hkasgd
* add URI junk slash support (eg: /////foo.html)
* param splitting now supports both '&', and ';', which CGI.pm and PHP both allow
* add URI junk directory support, eg: /asdf/../foo.html
* add param encoding support, eg: param A with value '=' is A=%3d
* add URI junk self referring directory support, eg: /././foo.html
git-svn-id: file:///home/svn/incoming/trunk@3457 4d416f70-5f16-0410-b530-b9f4589650da
2006-01-27 21:57:44 +00:00
|
|
|
|
|
|
|
# pass on the junk_pipeline config
|
|
|
|
if self.junk_pipeline
|
|
|
|
req.junk_pipeline = self.junk_pipeline
|
|
|
|
end
|
2005-09-15 23:37:38 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Configure the request headers using the Client configuration
|
|
|
|
#
|
|
|
|
|
|
|
|
if self.request_config['cookie']
|
|
|
|
req['Cookie'] = self.request_config['cookie']
|
|
|
|
end
|
|
|
|
|
|
|
|
if self.request_config['user-agent']
|
|
|
|
req['User-Agent'] = self.request_config['user-agent']
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Configure the rest of the request based on config hash
|
|
|
|
#
|
|
|
|
req['Host'] = (self.request_config['vhost'] || self.hostname) + ':' + self.port.to_s
|
|
|
|
|
|
|
|
# Set the request body if a data chunk has been specified
|
|
|
|
if chash['data']
|
|
|
|
req.body = chash['data']
|
|
|
|
end
|
2006-10-11 08:31:54 +00:00
|
|
|
|
|
|
|
# Merge headers supplied by the caller.
|
|
|
|
if chash['headers']
|
2006-10-11 09:27:39 +00:00
|
|
|
req.headers.merge!(chash['headers'])
|
2006-10-11 08:31:54 +00:00
|
|
|
end
|
2005-09-15 23:37:38 +00:00
|
|
|
|
|
|
|
# Set the content-type
|
|
|
|
if chash['content-type']
|
|
|
|
req['Content-Type'] = chash['content-type']
|
|
|
|
end
|
|
|
|
|
|
|
|
req
|
|
|
|
end
|
|
|
|
|
2005-07-24 20:53:54 +00:00
|
|
|
#
|
|
|
|
# Connects to the remote server if possible.
|
|
|
|
#
|
|
|
|
def connect
|
|
|
|
# If we already have a connection and we aren't pipelining, close it.
|
* add junk pipelined request support
* fix socket creation on pipelined requests
* when a server says that the connection should be closed (Connection: closed), then close the connection, since its going to regardless, and we don't want to loose our state
* support non-standard line termination in headers. ie \n instead of \r\n
* add junk headers (X-rand: rand)
* add header folding (for evasion)
* add parse_header_re (still leaving parse_header around, though its dead code ATM) that does the right thing on non-standard line endings
* move 'gzip' to a 'compression' option
* add 'deflate' compression option (really, just raw zlib, and only firefox does deflate right)
* fix a bunch of TE:chunked decoding bugs based based on the fact that Apache doesn't always close chunks appropriately
* modify parse_body to not return state, since it doesn't always do that, and the return isn't used... self.state is.
* add TE:chunked request support
* normalize URIs in requests before saving them
* Move params out of the URI, but when the uri is requested, and the method is GET, and there are params, return a URI that has the params that are approrpiately encoded (needed for junk_params, see below)
* move request.to_s support of params to use the request params array when a POST, allows use of junk params support (see below). NOTE: If the body is provided, use the body instead of params, in case you want to hardcode the params in a POST request, eg: php_xmlrpc_eval.rb
* Add junk params when building a param list, eg: a=b becomes asdfasdf=asdrt32a&asdfad=okhgasd&a=b&hjklasdf=hkasgd
* add URI junk slash support (eg: /////foo.html)
* param splitting now supports both '&', and ';', which CGI.pm and PHP both allow
* add URI junk directory support, eg: /asdf/../foo.html
* add param encoding support, eg: param A with value '=' is A=%3d
* add URI junk self referring directory support, eg: /././foo.html
git-svn-id: file:///home/svn/incoming/trunk@3457 4d416f70-5f16-0410-b530-b9f4589650da
2006-01-27 21:57:44 +00:00
|
|
|
if (self.conn)
|
|
|
|
if !pipelining?
|
|
|
|
close
|
|
|
|
else
|
|
|
|
return self.conn
|
|
|
|
end
|
2005-07-24 20:53:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
self.conn = Rex::Socket::Tcp.create(
|
|
|
|
'PeerHost' => self.hostname,
|
|
|
|
'PeerPort' => self.port.to_i,
|
|
|
|
'LocalHost' => self.local_host,
|
2006-01-17 04:35:44 +00:00
|
|
|
'LocalPort' => self.local_port,
|
2006-01-20 18:59:24 +00:00
|
|
|
'Context' => self.context,
|
|
|
|
'SSL' => self.ssl
|
2006-01-17 04:35:44 +00:00
|
|
|
)
|
2005-07-24 20:53:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Closes the connection to the remote server.
|
|
|
|
#
|
|
|
|
def close
|
2005-09-22 03:24:32 +00:00
|
|
|
if (self.conn)
|
|
|
|
self.conn.shutdown
|
|
|
|
self.conn.close
|
|
|
|
end
|
|
|
|
|
2005-07-24 20:53:54 +00:00
|
|
|
self.conn = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Initializes a request by setting the host header and other cool things.
|
|
|
|
#
|
|
|
|
def init_request(req)
|
2005-09-15 23:37:38 +00:00
|
|
|
req['Host'] = "#{request_config.has_key?('vhost') ? request_config['vhost'] : hostname}:#{port}"
|
2005-07-24 20:53:54 +00:00
|
|
|
|
|
|
|
return req
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
2005-11-15 05:22:13 +00:00
|
|
|
# Transmits a request and reads in a response.
|
2005-07-24 20:53:54 +00:00
|
|
|
#
|
|
|
|
def send_request(req, t = -1)
|
|
|
|
resp = Response.new
|
2005-09-15 23:37:38 +00:00
|
|
|
resp.max_data = self.client_config['max-data']
|
|
|
|
|
2005-07-24 20:53:54 +00:00
|
|
|
# Connect to the server
|
|
|
|
connect
|
|
|
|
|
* add junk pipelined request support
* fix socket creation on pipelined requests
* when a server says that the connection should be closed (Connection: closed), then close the connection, since its going to regardless, and we don't want to loose our state
* support non-standard line termination in headers. ie \n instead of \r\n
* add junk headers (X-rand: rand)
* add header folding (for evasion)
* add parse_header_re (still leaving parse_header around, though its dead code ATM) that does the right thing on non-standard line endings
* move 'gzip' to a 'compression' option
* add 'deflate' compression option (really, just raw zlib, and only firefox does deflate right)
* fix a bunch of TE:chunked decoding bugs based based on the fact that Apache doesn't always close chunks appropriately
* modify parse_body to not return state, since it doesn't always do that, and the return isn't used... self.state is.
* add TE:chunked request support
* normalize URIs in requests before saving them
* Move params out of the URI, but when the uri is requested, and the method is GET, and there are params, return a URI that has the params that are approrpiately encoded (needed for junk_params, see below)
* move request.to_s support of params to use the request params array when a POST, allows use of junk params support (see below). NOTE: If the body is provided, use the body instead of params, in case you want to hardcode the params in a POST request, eg: php_xmlrpc_eval.rb
* Add junk params when building a param list, eg: a=b becomes asdfasdf=asdrt32a&asdfad=okhgasd&a=b&hjklasdf=hkasgd
* add URI junk slash support (eg: /////foo.html)
* param splitting now supports both '&', and ';', which CGI.pm and PHP both allow
* add URI junk directory support, eg: /asdf/../foo.html
* add param encoding support, eg: param A with value '=' is A=%3d
* add URI junk self referring directory support, eg: /././foo.html
git-svn-id: file:///home/svn/incoming/trunk@3457 4d416f70-5f16-0410-b530-b9f4589650da
2006-01-27 21:57:44 +00:00
|
|
|
# build the request
|
|
|
|
req_string = req.to_s
|
|
|
|
|
2005-07-24 20:53:54 +00:00
|
|
|
# Send it on over
|
* add junk pipelined request support
* fix socket creation on pipelined requests
* when a server says that the connection should be closed (Connection: closed), then close the connection, since its going to regardless, and we don't want to loose our state
* support non-standard line termination in headers. ie \n instead of \r\n
* add junk headers (X-rand: rand)
* add header folding (for evasion)
* add parse_header_re (still leaving parse_header around, though its dead code ATM) that does the right thing on non-standard line endings
* move 'gzip' to a 'compression' option
* add 'deflate' compression option (really, just raw zlib, and only firefox does deflate right)
* fix a bunch of TE:chunked decoding bugs based based on the fact that Apache doesn't always close chunks appropriately
* modify parse_body to not return state, since it doesn't always do that, and the return isn't used... self.state is.
* add TE:chunked request support
* normalize URIs in requests before saving them
* Move params out of the URI, but when the uri is requested, and the method is GET, and there are params, return a URI that has the params that are approrpiately encoded (needed for junk_params, see below)
* move request.to_s support of params to use the request params array when a POST, allows use of junk params support (see below). NOTE: If the body is provided, use the body instead of params, in case you want to hardcode the params in a POST request, eg: php_xmlrpc_eval.rb
* Add junk params when building a param list, eg: a=b becomes asdfasdf=asdrt32a&asdfad=okhgasd&a=b&hjklasdf=hkasgd
* add URI junk slash support (eg: /////foo.html)
* param splitting now supports both '&', and ';', which CGI.pm and PHP both allow
* add URI junk directory support, eg: /asdf/../foo.html
* add param encoding support, eg: param A with value '=' is A=%3d
* add URI junk self referring directory support, eg: /././foo.html
git-svn-id: file:///home/svn/incoming/trunk@3457 4d416f70-5f16-0410-b530-b9f4589650da
2006-01-27 21:57:44 +00:00
|
|
|
conn.put(req_string)
|
2005-07-24 20:53:54 +00:00
|
|
|
|
|
|
|
# Tell the remote side if we aren't pipelining
|
|
|
|
conn.shutdown(::Socket::SHUT_WR) if (!pipelining?)
|
|
|
|
|
|
|
|
# Wait at most t seconds for the full response to be read in. We only
|
|
|
|
# do this if t was specified as a negative value indicating an infinite
|
|
|
|
# wait cycle. If t were specified as nil it would indicate that no
|
|
|
|
# response parsing is required.
|
|
|
|
timeout((t < 0) ? nil : t) {
|
|
|
|
# Now, read in the response until we're good to go.
|
|
|
|
begin
|
* add junk pipelined request support
* fix socket creation on pipelined requests
* when a server says that the connection should be closed (Connection: closed), then close the connection, since its going to regardless, and we don't want to loose our state
* support non-standard line termination in headers. ie \n instead of \r\n
* add junk headers (X-rand: rand)
* add header folding (for evasion)
* add parse_header_re (still leaving parse_header around, though its dead code ATM) that does the right thing on non-standard line endings
* move 'gzip' to a 'compression' option
* add 'deflate' compression option (really, just raw zlib, and only firefox does deflate right)
* fix a bunch of TE:chunked decoding bugs based based on the fact that Apache doesn't always close chunks appropriately
* modify parse_body to not return state, since it doesn't always do that, and the return isn't used... self.state is.
* add TE:chunked request support
* normalize URIs in requests before saving them
* Move params out of the URI, but when the uri is requested, and the method is GET, and there are params, return a URI that has the params that are approrpiately encoded (needed for junk_params, see below)
* move request.to_s support of params to use the request params array when a POST, allows use of junk params support (see below). NOTE: If the body is provided, use the body instead of params, in case you want to hardcode the params in a POST request, eg: php_xmlrpc_eval.rb
* Add junk params when building a param list, eg: a=b becomes asdfasdf=asdrt32a&asdfad=okhgasd&a=b&hjklasdf=hkasgd
* add URI junk slash support (eg: /////foo.html)
* param splitting now supports both '&', and ';', which CGI.pm and PHP both allow
* add URI junk directory support, eg: /asdf/../foo.html
* add param encoding support, eg: param A with value '=' is A=%3d
* add URI junk self referring directory support, eg: /././foo.html
git-svn-id: file:///home/svn/incoming/trunk@3457 4d416f70-5f16-0410-b530-b9f4589650da
2006-01-27 21:57:44 +00:00
|
|
|
if self.junk_pipeline
|
|
|
|
i = 0
|
|
|
|
self.junk_pipeline.times {
|
|
|
|
i += 1
|
|
|
|
rv = nil
|
|
|
|
|
|
|
|
while rv != Packet::ParseCode::Completed
|
|
|
|
if (rv == Packet::ParseCode::Error)
|
|
|
|
warn "ERR : #{resp.error}"
|
|
|
|
raise RuntimeError, resp.error, caller
|
|
|
|
end
|
|
|
|
|
|
|
|
if resp.bufq.length > 0
|
|
|
|
rv = resp.parse('')
|
|
|
|
else
|
|
|
|
rv = resp.parse(conn.get)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if resp['Connection'] == 'close'
|
|
|
|
raise RuntimeError, "junk pipelined request ##{i} caused the server to close the connection", caller
|
|
|
|
end
|
|
|
|
|
|
|
|
buf = resp.bufq
|
|
|
|
resp.reset
|
|
|
|
resp.bufq = buf
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
rv = nil
|
|
|
|
if resp.bufq.length > 0
|
|
|
|
rv = resp.parse('')
|
|
|
|
end
|
|
|
|
|
|
|
|
if rv != Packet::ParseCode::Completed
|
|
|
|
# Keep running until we finish parsing or EOF is reached
|
|
|
|
while ((rv = resp.parse(conn.get)) != Packet::ParseCode::Completed)
|
|
|
|
# Parsing error? Raise an exception, our job is done.
|
|
|
|
if (rv == Packet::ParseCode::Error)
|
|
|
|
raise RuntimeError, resp.error, caller
|
|
|
|
end
|
2005-07-24 20:53:54 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
rescue EOFError
|
|
|
|
end
|
|
|
|
} if (t)
|
|
|
|
|
|
|
|
# Close our side if we aren't pipelining
|
|
|
|
close if (!pipelining?)
|
|
|
|
|
* add junk pipelined request support
* fix socket creation on pipelined requests
* when a server says that the connection should be closed (Connection: closed), then close the connection, since its going to regardless, and we don't want to loose our state
* support non-standard line termination in headers. ie \n instead of \r\n
* add junk headers (X-rand: rand)
* add header folding (for evasion)
* add parse_header_re (still leaving parse_header around, though its dead code ATM) that does the right thing on non-standard line endings
* move 'gzip' to a 'compression' option
* add 'deflate' compression option (really, just raw zlib, and only firefox does deflate right)
* fix a bunch of TE:chunked decoding bugs based based on the fact that Apache doesn't always close chunks appropriately
* modify parse_body to not return state, since it doesn't always do that, and the return isn't used... self.state is.
* add TE:chunked request support
* normalize URIs in requests before saving them
* Move params out of the URI, but when the uri is requested, and the method is GET, and there are params, return a URI that has the params that are approrpiately encoded (needed for junk_params, see below)
* move request.to_s support of params to use the request params array when a POST, allows use of junk params support (see below). NOTE: If the body is provided, use the body instead of params, in case you want to hardcode the params in a POST request, eg: php_xmlrpc_eval.rb
* Add junk params when building a param list, eg: a=b becomes asdfasdf=asdrt32a&asdfad=okhgasd&a=b&hjklasdf=hkasgd
* add URI junk slash support (eg: /////foo.html)
* param splitting now supports both '&', and ';', which CGI.pm and PHP both allow
* add URI junk directory support, eg: /asdf/../foo.html
* add param encoding support, eg: param A with value '=' is A=%3d
* add URI junk self referring directory support, eg: /././foo.html
git-svn-id: file:///home/svn/incoming/trunk@3457 4d416f70-5f16-0410-b530-b9f4589650da
2006-01-27 21:57:44 +00:00
|
|
|
# if the server said stop pipelining, we listen...
|
|
|
|
if resp['Connection'] == 'close'
|
|
|
|
close
|
|
|
|
end
|
|
|
|
|
2005-09-15 23:37:38 +00:00
|
|
|
# XXX - How should we handle this?
|
|
|
|
if (not resp.completed?)
|
|
|
|
# raise RuntimeError, resp.error, caller
|
|
|
|
end
|
|
|
|
|
|
|
|
# Always return the Response object back to the client
|
|
|
|
return resp
|
2005-07-24 20:53:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
2005-11-15 05:22:13 +00:00
|
|
|
# Cleans up any outstanding connections and other resources.
|
2005-07-24 20:53:54 +00:00
|
|
|
#
|
|
|
|
def stop
|
|
|
|
close
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Returns whether or not the conn is valid.
|
|
|
|
#
|
|
|
|
def conn?
|
|
|
|
conn != nil
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
2005-11-15 05:22:13 +00:00
|
|
|
# Whether or not connections should be pipelined.
|
2005-07-24 20:53:54 +00:00
|
|
|
#
|
|
|
|
def pipelining?
|
|
|
|
pipeline
|
|
|
|
end
|
|
|
|
|
2005-11-15 05:22:13 +00:00
|
|
|
#
|
|
|
|
# Whether or not pipelining is in use.
|
|
|
|
#
|
2005-07-24 20:53:54 +00:00
|
|
|
attr_accessor :pipeline
|
2005-11-15 05:22:13 +00:00
|
|
|
#
|
|
|
|
# The local host of the client.
|
|
|
|
#
|
2005-07-24 20:53:54 +00:00
|
|
|
attr_accessor :local_host
|
2005-11-15 05:22:13 +00:00
|
|
|
#
|
|
|
|
# The local port of the client.
|
|
|
|
#
|
2005-07-24 20:53:54 +00:00
|
|
|
attr_accessor :local_port
|
2005-11-15 05:22:13 +00:00
|
|
|
#
|
|
|
|
# Client configuration attributes.
|
|
|
|
#
|
2005-09-15 23:37:38 +00:00
|
|
|
attr_accessor :client_config
|
2005-11-15 05:22:13 +00:00
|
|
|
#
|
|
|
|
# The underlying connection.
|
|
|
|
#
|
2005-09-22 03:24:32 +00:00
|
|
|
attr_accessor :conn
|
2006-01-17 04:35:44 +00:00
|
|
|
#
|
|
|
|
# The calling context to pass to the socket
|
|
|
|
#
|
|
|
|
attr_accessor :context
|
* add junk pipelined request support
* fix socket creation on pipelined requests
* when a server says that the connection should be closed (Connection: closed), then close the connection, since its going to regardless, and we don't want to loose our state
* support non-standard line termination in headers. ie \n instead of \r\n
* add junk headers (X-rand: rand)
* add header folding (for evasion)
* add parse_header_re (still leaving parse_header around, though its dead code ATM) that does the right thing on non-standard line endings
* move 'gzip' to a 'compression' option
* add 'deflate' compression option (really, just raw zlib, and only firefox does deflate right)
* fix a bunch of TE:chunked decoding bugs based based on the fact that Apache doesn't always close chunks appropriately
* modify parse_body to not return state, since it doesn't always do that, and the return isn't used... self.state is.
* add TE:chunked request support
* normalize URIs in requests before saving them
* Move params out of the URI, but when the uri is requested, and the method is GET, and there are params, return a URI that has the params that are approrpiately encoded (needed for junk_params, see below)
* move request.to_s support of params to use the request params array when a POST, allows use of junk params support (see below). NOTE: If the body is provided, use the body instead of params, in case you want to hardcode the params in a POST request, eg: php_xmlrpc_eval.rb
* Add junk params when building a param list, eg: a=b becomes asdfasdf=asdrt32a&asdfad=okhgasd&a=b&hjklasdf=hkasgd
* add URI junk slash support (eg: /////foo.html)
* param splitting now supports both '&', and ';', which CGI.pm and PHP both allow
* add URI junk directory support, eg: /asdf/../foo.html
* add param encoding support, eg: param A with value '=' is A=%3d
* add URI junk self referring directory support, eg: /././foo.html
git-svn-id: file:///home/svn/incoming/trunk@3457 4d416f70-5f16-0410-b530-b9f4589650da
2006-01-27 21:57:44 +00:00
|
|
|
|
|
|
|
# When parsing the request, thunk off the first response from the server, since junk
|
|
|
|
attr_accessor :junk_pipeline
|
2005-09-15 23:37:38 +00:00
|
|
|
|
2005-07-24 20:53:54 +00:00
|
|
|
protected
|
|
|
|
|
2006-01-27 05:33:08 +00:00
|
|
|
# https
|
2006-01-20 18:59:24 +00:00
|
|
|
attr_accessor :ssl
|
|
|
|
|
2005-11-15 05:22:13 +00:00
|
|
|
attr_accessor :hostname, :port # :nodoc:
|
|
|
|
attr_accessor :request_config, :client_config # :nodoc:
|
2005-09-15 23:37:38 +00:00
|
|
|
|
2005-07-24 20:53:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|