ruby-ajp 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.en +4 -0
- data/NEWS.ja +4 -0
- data/Rakefile +1 -1
- data/lib/net/ajp13/client.rb +11 -2
- data/lib/net/ajp13/server.rb +14 -2
- data/ruby-ajp.gemspec +1 -1
- metadata +2 -2
data/NEWS.en
CHANGED
data/NEWS.ja
CHANGED
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ Rake::TestTask.new do |t|
|
|
10
10
|
end
|
11
11
|
|
12
12
|
Rake::RDocTask.new do |rd|
|
13
|
-
rd.rdoc_files.include *['', 'client', 'server'].map{ |n|
|
13
|
+
rd.rdoc_files.include *['', '/client', '/server'].map{ |n|
|
14
14
|
"lib/net/ajp13#{n}.rb"
|
15
15
|
}
|
16
16
|
rd.title = "Ruby/AJP - An implementation of Apache JServ Protocol 1.3"
|
data/lib/net/ajp13/client.rb
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
# ==Example
|
6
6
|
#
|
7
7
|
# === Simple GET
|
8
|
-
# require 'net/
|
8
|
+
# require 'net/ajp13/client'
|
9
9
|
# Net::AJP13::Client.start('localhost') do |client|
|
10
10
|
# puts client.get('/index.jsp').body
|
11
11
|
# end
|
12
12
|
#
|
13
13
|
# === More about GET
|
14
|
-
# require 'net/
|
14
|
+
# require 'net/ajp13/client'
|
15
15
|
# req = Net::AJP13::GetRequest.new('/index.jsp')
|
16
16
|
# req.server_port = 80
|
17
17
|
# req['Host'] = 'www.example.com'
|
@@ -356,6 +356,15 @@ class Net::AJP13::Client
|
|
356
356
|
def get(path, header = nil, &block)
|
357
357
|
request(Net::AJP13::GetRequest.new(path, header), &block)
|
358
358
|
end
|
359
|
+
|
360
|
+
def post(path, body, header = nil, &block)
|
361
|
+
post = Net::AJP13::PostRequest.new(path, header)
|
362
|
+
if body.respond_to?(:read)
|
363
|
+
post.body_stream = body
|
364
|
+
else
|
365
|
+
post.body = body
|
366
|
+
end
|
367
|
+
end
|
359
368
|
end
|
360
369
|
|
361
370
|
|
data/lib/net/ajp13/server.rb
CHANGED
@@ -74,7 +74,7 @@ class Net::AJP13::Server
|
|
74
74
|
|
75
75
|
# logger
|
76
76
|
attr_accessor :logger
|
77
|
-
def logger
|
77
|
+
def logger #:nodoc:
|
78
78
|
unless @logger
|
79
79
|
require 'logger'
|
80
80
|
@logger = Logger.new(STDOUT)
|
@@ -82,6 +82,10 @@ class Net::AJP13::Server
|
|
82
82
|
@logger
|
83
83
|
end
|
84
84
|
|
85
|
+
|
86
|
+
#
|
87
|
+
# Starts the server; opens the socket, begins accepting requests, ....
|
88
|
+
# +sock+:: If not nil, the server uses +sock+ instead of opening a new socket.
|
85
89
|
def start(sock = nil)
|
86
90
|
if sock
|
87
91
|
@sock = sock
|
@@ -151,6 +155,11 @@ class Net::AJP13::Server
|
|
151
155
|
end
|
152
156
|
end
|
153
157
|
|
158
|
+
|
159
|
+
# Handler for FORWARD_REQUEST message.
|
160
|
+
#
|
161
|
+
# Normally, you should override #process_request instead of overriding this
|
162
|
+
# method directly.
|
154
163
|
def process_forward_request(packet, conn)
|
155
164
|
req = Net::AJP13::Request.from_packet(packet)
|
156
165
|
if req['content-length'] and req.content_length > 0
|
@@ -212,6 +221,7 @@ class Net::AJP13::Server
|
|
212
221
|
conn.close if user_code_error
|
213
222
|
end
|
214
223
|
|
224
|
+
# Handler for CPING message
|
215
225
|
def process_cping(packet, conn)
|
216
226
|
packet = Net::AJP13::Packet.new
|
217
227
|
packet.direction = :from_app
|
@@ -219,12 +229,14 @@ class Net::AJP13::Server
|
|
219
229
|
packet.send_to conn
|
220
230
|
end
|
221
231
|
|
232
|
+
# Handler for SHUTDOWN message.
|
222
233
|
def process_shutdown(packet, conn)
|
223
234
|
if IPAddr.new(conn.addr[3]) == IPAddr.new(conn.peeraddr[3])
|
224
235
|
shutdown
|
225
236
|
end
|
226
237
|
end
|
227
238
|
|
239
|
+
# Shuts the server down.
|
228
240
|
def shutdown(force = false)
|
229
241
|
@shutdown = true
|
230
242
|
@sock.close if force
|
@@ -235,7 +247,7 @@ class Net::AJP13::Server
|
|
235
247
|
|
236
248
|
# Input stream that corresponds the request body from the web server.
|
237
249
|
# BodyInput object acts as an IO except writing methods.
|
238
|
-
class BodyInput
|
250
|
+
class BodyInput #:nodoc: all
|
239
251
|
include Net::AJP13::Constants
|
240
252
|
include Enumerable
|
241
253
|
|
data/ruby-ajp.gemspec
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ruby-ajp
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.2.
|
7
|
-
date: 2006-01
|
6
|
+
version: 0.2.1
|
7
|
+
date: 2006-02-01 00:00:00 +09:00
|
8
8
|
summary: An implementation of Apache Jserv Protocol 1.3 in Ruby
|
9
9
|
require_paths:
|
10
10
|
- lib
|