lib/net/ajp13.rb in ruby-ajp-0.1.5 vs lib/net/ajp13.rb in ruby-ajp-0.2.0
- old
+ new
@@ -1,11 +1,11 @@
# = Ruby/AJP
-# An implementation of AJP(Apache Jserv Protocol) 1.3 in Ruby,
+# Ruby/AJP is an implementation of AJP(Apache Jserv Protocol) 1.3 in Ruby,
# based on http://tomcat.apache.org/connectors-doc/common/ajpv13a.html.
#
# [Net::AJP13::Client] provides high-level API to implement AJP clients.
-# The interface of the client-side library is similar to
+# The interface of this client-side library is similar to
# net/http.
# see ajp13client.rb[link:files/lib/net/ajp13client_rb.html]
# for more detail.
# [Net::AJP13::Server] provides high-level API to implement AJP servers.
# see ajp13server.rb[link:files/lib/net/ajp13server_rb.html]
@@ -31,13 +31,12 @@
# MA 02110-1301 USA
#
require 'net/http'
-# :stopdoc:
-module Net; end
-# :startdoc:
+module Net #:nodoc:
+end
module Net::AJP13
module Constants
# default AJP port
DEFAULT_PORT = 8009
@@ -91,11 +90,11 @@
'host' => 0xA00B, 'pragma' => 0xA00C,
'referer' => 0xA00D, 'user_agent' => 0xA00E
}.freeze
SC_REQ_HEADER_NAMES.each_key {|k| k.freeze}
- SC_A_REQ_ATTRIBUTE = 0xA0
+ SC_A_REQ_ATTRIBUTE = 0x0A
# Maps request attribute names into their codes
SC_A_NAMES = {
:context => 0x01,
:servlet_path => 0x02,
:remote_user => 0x03,
@@ -192,11 +191,11 @@
raise("Unrecognized HTTP header code #{header_name}")
header_name = header_name.tr('_', '-')
else
header_name = packet.read_string
end
- req[header_name] = packet.read_string
+ req.add_field(header_name, packet.read_string)
end
loop do
case attr_name = packet.read_byte
when nil
raise 'Missing AJP request packet terminator'
@@ -250,10 +249,11 @@
end
# HTTP-side connection is over SSL or not.
attr_accessor :is_ssl
alias :is_ssl? :is_ssl
+ alias :ssl? :is_ssl
def is_ssl=(value) #:nodoc:
@is_ssl = !!value
end
# HTTP protocol name/version
@@ -560,10 +560,10 @@
# Represents errors on AJP packet format
class Net::AJP13::AJPPacketError < IOError
end
-# :stopdoc:
+# :enddoc:
# Represents AJP1.3 Packet
class Net::AJP13::Packet
include Net::AJP13::Constants
# The magic number that represents a packet is from a web server to