iudex-async-httpclient 1.1.0-java

Sign up to get free protection for your applications and to get access to all the features.
data/.gemtest ADDED
File without changes
data/History.rdoc ADDED
@@ -0,0 +1,2 @@
1
+ === 1.1.0 (2011-11-13)
2
+ * Initial release with Iudex 1.1.x.
data/Manifest.txt ADDED
@@ -0,0 +1,10 @@
1
+ History.rdoc
2
+ Manifest.txt
3
+ README.rdoc
4
+ Rakefile
5
+ pom.xml
6
+ lib/iudex-async-httpclient/base.rb
7
+ lib/iudex-async-httpclient.rb
8
+ test/setup.rb
9
+ test/test_httpclient.rb
10
+ lib/iudex-async-httpclient/iudex-async-httpclient-1.1.0.jar
data/README.rdoc ADDED
@@ -0,0 +1,25 @@
1
+ = iudex-async-httpclient
2
+
3
+ * http://github.com/dekellum/iudex
4
+
5
+ == Description
6
+
7
+ Iudex is a general purpose web crawler and feed processor in
8
+ ruby/java. This gem is an rjack-async-httpclient based implementation
9
+ of the iudex-http interfaces.
10
+
11
+ == License
12
+
13
+ Copyright (c) 2011 David Kellum
14
+
15
+ Licensed under the Apache License, Version 2.0 (the "License"); you
16
+ may not use this file except in compliance with the License. You
17
+ may obtain a copy of the License at:
18
+
19
+ http://www.apache.org/licenses/LICENSE-2.0
20
+
21
+ Unless required by applicable law or agreed to in writing, software
22
+ distributed under the License is distributed on an "AS IS" BASIS,
23
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
24
+ implied. See the License for the specific language governing
25
+ permissions and limitations under the License.
data/Rakefile ADDED
@@ -0,0 +1,43 @@
1
+ # -*- ruby -*-
2
+
3
+ $LOAD_PATH << './lib'
4
+ require 'iudex-async-httpclient/base'
5
+
6
+ require 'rubygems'
7
+ gem 'rjack-tarpit', '~> 1.2'
8
+ require 'rjack-tarpit'
9
+
10
+ t = RJack::TarPit.new( 'iudex-async-httpclient',
11
+ Iudex::AsyncHTTPClient::VERSION,
12
+ :no_assembly, :java_platform )
13
+
14
+ t.specify do |h|
15
+ h.developer( "David Kellum", "dek-oss@gravitext.com" )
16
+
17
+ h.extra_deps += [ [ 'iudex-http', '~> 1.1.0' ],
18
+ [ 'rjack-async-httpclient', '~> 1.6.5' ],
19
+ [ 'hooker', '~> 1.0.0' ] ]
20
+
21
+ h.testlib = :minitest
22
+ h.extra_dev_deps += [ [ 'minitest', '~> 2.3' ],
23
+ [ 'iudex-http-test', '~> 1.1.0' ],
24
+ [ 'rjack-logback', '~> 1.0' ] ]
25
+ end
26
+
27
+ file 'Manifest.txt' => "lib/#{t.name}/base.rb"
28
+
29
+ task :check_pom_version do
30
+ t.test_line_match( 'pom.xml', /<version>/, /#{t.version}/ )
31
+ end
32
+ task :check_history_version do
33
+ t.test_line_match( 'History.rdoc', /^==/, / #{t.version} / )
34
+ end
35
+ task :check_history_date do
36
+ t.test_line_match( 'History.rdoc', /^==/, /\([0-9\-]+\)$/ )
37
+ end
38
+
39
+ task :gem => [ :check_pom_version, :check_history_version ]
40
+ task :tag => [ :check_pom_version, :check_history_version, :check_history_date ]
41
+ task :push => [ :check_history_date ]
42
+
43
+ t.define_tasks
@@ -0,0 +1,59 @@
1
+ #--
2
+ # Copyright (c) 2011 David Kellum
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
5
+ # may not use this file except in compliance with the License. You
6
+ # may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
+ # implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+ #++
16
+
17
+ require 'iudex-http'
18
+ require 'rjack-async-httpclient'
19
+ require 'hooker'
20
+
21
+ require 'iudex-async-httpclient/base'
22
+
23
+ require 'java'
24
+
25
+ module Iudex
26
+
27
+ module AsyncHTTPClient
28
+ require "#{LIB_DIR}/iudex-async-httpclient-#{VERSION}.jar"
29
+
30
+ import 'iudex.asynchttpclient.Client'
31
+
32
+ include RJack::AsyncHTTPClient
33
+
34
+ def self.create_client( opts = {} )
35
+ Client.new( AsyncHttpClient.new( create_client_config( opts ) ) )
36
+ end
37
+
38
+ def self.create_client_config( opts = {} )
39
+
40
+ cfg = { :connection_timeout_in_ms => 3_000,
41
+ :idle_connection_timeout_in_ms => 6_000,
42
+ :request_timeout_in_ms => 5_000,
43
+ :max_request_retry => 1,
44
+ :maximum_connections_total => 100,
45
+ :maximum_connections_per_host => 2,
46
+ :follow_redirects => false,
47
+ :maximum_number_of_redirects => 6,
48
+ :compression_enabled => true }
49
+
50
+ cfg = cfg.merge( opts )
51
+
52
+ cfg = Hooker.merge( [ :iudex, :async_httpclient ], cfg )
53
+
54
+ RJack::AsyncHTTPClient.build_client_config( cfg )
55
+ end
56
+
57
+ end
58
+
59
+ end
@@ -0,0 +1,23 @@
1
+ #--
2
+ # Copyright (c) 2011 David Kellum
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
5
+ # may not use this file except in compliance with the License. You
6
+ # may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
+ # implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+ #++
16
+
17
+ module Iudex
18
+ module AsyncHTTPClient
19
+ VERSION = '1.1.0'
20
+
21
+ LIB_DIR = File.dirname( __FILE__ ) # :nodoc:
22
+ end
23
+ end
data/pom.xml ADDED
@@ -0,0 +1,47 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3
+
4
+ <modelVersion>4.0.0</modelVersion>
5
+ <groupId>iudex</groupId>
6
+ <artifactId>iudex-async-httpclient</artifactId>
7
+ <packaging>jar</packaging>
8
+ <version>1.1.0</version>
9
+ <name>Iudex Async HTTP Client Adaptor</name>
10
+
11
+ <parent>
12
+ <groupId>iudex</groupId>
13
+ <artifactId>iudex-parent</artifactId>
14
+ <version>1.1</version>
15
+ <relativePath>..</relativePath>
16
+ </parent>
17
+
18
+ <dependencies>
19
+
20
+ <dependency>
21
+ <groupId>iudex</groupId>
22
+ <artifactId>iudex-http</artifactId>
23
+ <version>[1.1,1.2)</version>
24
+ </dependency>
25
+
26
+ <dependency>
27
+ <groupId>com.ning</groupId>
28
+ <artifactId>async-http-client</artifactId>
29
+ <version>[1.6.5,1.6.9999]</version>
30
+ </dependency>
31
+
32
+ </dependencies>
33
+
34
+ <build>
35
+ <plugins>
36
+ <plugin>
37
+ <!-- Parent settings -->
38
+ <artifactId>maven-compiler-plugin</artifactId>
39
+ </plugin>
40
+ <plugin>
41
+ <!-- Parent settings -->
42
+ <artifactId>maven-source-plugin</artifactId>
43
+ </plugin>
44
+ </plugins>
45
+ </build>
46
+
47
+ </project>
data/test/setup.rb ADDED
@@ -0,0 +1,44 @@
1
+ #--
2
+ # Copyright (c) 2011 David Kellum
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
5
+ # may not use this file except in compliance with the License. You
6
+ # may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
+ # implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+ #++
16
+
17
+ #### General test setup: LOAD_PATH, logging, console output ####
18
+
19
+ ldir = File.join( File.dirname( __FILE__ ), "..", "lib" )
20
+ $LOAD_PATH.unshift( ldir ) unless $LOAD_PATH.include?( ldir )
21
+
22
+ require 'rubygems'
23
+ require 'rjack-logback'
24
+ require 'minitest/unit'
25
+ require 'minitest/autorun'
26
+
27
+ module TestSetup
28
+ include RJack
29
+ Logback.config_console( :stderr => true )
30
+
31
+ unless ( ARGV & %w[ -v --verbose ] ).empty?
32
+ Logback.root.level = Logback::DEBUG
33
+ else
34
+ sl = [ "com.ning.http.client.providers.netty.NettyAsyncHttpProvider" ]
35
+ sl.each { |l| Logback[ l ].level = Logback::WARN }
36
+ end
37
+ end
38
+
39
+ # Make test output logging compatible: no partial lines.
40
+ class TestOut
41
+ def print( *a ); $stdout.puts( *a ); end
42
+ def puts( *a ); $stdout.puts( *a ); end
43
+ end
44
+ MiniTest::Unit.output = TestOut.new
@@ -0,0 +1,414 @@
1
+ #!/usr/bin/env jruby
2
+ #.hashdot.profile += jruby-shortlived
3
+
4
+ #--
5
+ # Copyright (c) 2011 David Kellum
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
8
+ # may not use this file except in compliance with the License. You
9
+ # may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16
+ # implied. See the License for the specific language governing
17
+ # permissions and limitations under the License.
18
+ #++
19
+
20
+ require File.join( File.dirname( __FILE__ ), "setup" )
21
+
22
+ require 'iudex-http-test/helper'
23
+ require 'iudex-http-test/broken_server'
24
+
25
+ require 'iudex-async-httpclient'
26
+ require 'thread'
27
+
28
+ class TestHTTPClient < MiniTest::Unit::TestCase
29
+ include Iudex
30
+ include Iudex::HTTP
31
+ include Iudex::HTTP::Test
32
+ include Helper
33
+
34
+ import 'com.ning.http.client.MaxRedirectException'
35
+ import 'java.util.concurrent.TimeoutException'
36
+ import 'java.net.ConnectException'
37
+ import 'java.io.IOException'
38
+
39
+ CustomUnit.register
40
+
41
+ def setup
42
+ server # make sure jetty starts, for cosmetic log output
43
+ end
44
+
45
+ def test_default_config
46
+ client = AsyncHTTPClient.create_client
47
+ client.close
48
+ pass
49
+ end
50
+
51
+ import 'java.util.concurrent.ThreadPoolExecutor'
52
+ import 'java.util.concurrent.ArrayBlockingQueue'
53
+ import 'java.util.concurrent.TimeUnit'
54
+
55
+ def test_custom_executor
56
+
57
+ executor = ThreadPoolExecutor.new( 1, 10,
58
+ 10, TimeUnit::SECONDS,
59
+ ArrayBlockingQueue.new( 20 ) )
60
+
61
+ with_new_client( :executor_service => executor ) do |client|
62
+
63
+ with_session_handler( client, "/index" ) do |s,x|
64
+ assert_equal( 200, s.status_code )
65
+ end
66
+ end
67
+
68
+ executor.shutdown
69
+ end
70
+
71
+ def test_200
72
+ with_new_client do |client|
73
+
74
+ with_session_handler( client, "/index" ) do |s,x|
75
+ assert_equal( 200, s.status_code )
76
+ assert_match( /Test Index Page/, s.response_stream.to_io.read )
77
+ end
78
+
79
+ with_session_handler( client, "/atom.xml" ) do |s,x|
80
+ assert_equal( 200, s.status_code )
81
+ cl = find_header( s.response_headers, "Content-Length" )
82
+ assert_operator( cl.to_i, :>, 10_000 )
83
+ end
84
+
85
+ end
86
+ end
87
+
88
+ def test_correct_type
89
+ with_new_client do |client|
90
+ client.accepted_content_types = ContentTypeSet.new( [ "text/html" ] )
91
+ with_session_handler( client, "/index" ) do |s,x|
92
+ assert_equal( 200, s.status_code )
93
+ assert_nil( x )
94
+ assert_match( /^text\/html/,
95
+ find_header( s.response_headers, 'Content-Type' ) )
96
+ end
97
+ end
98
+ end
99
+
100
+ def test_headers
101
+ req,rsp = nil
102
+ with_new_client do |client|
103
+ with_session_handler( client,
104
+ "/echo/header/Accept?noop=3",
105
+ true,
106
+ { 'Accept' => 'text/plain;moo' } ) do |s,x|
107
+ assert_equal( 200, s.status_code )
108
+ assert_equal( 'GET /echo/header/Accept?noop=3',
109
+ find_header( s.request_headers, "Request-Line" ) )
110
+ assert_equal( 'text/plain;moo',
111
+ find_header( s.request_headers, 'Accept' ) )
112
+ assert_equal( 'localhost:19292',
113
+ find_header( s.request_headers, 'Host' ) )
114
+
115
+ assert_match( /^text\/plain/,
116
+ find_header( s.response_headers, 'Content-Type' ) )
117
+ assert_match( /^text\/plain;moo$/, s.response_stream.to_io.read )
118
+ end
119
+ end
120
+ end
121
+
122
+ def test_unknown_host
123
+ with_new_client do |client|
124
+ with_session_handler( client,
125
+ "http://9xa9.a7v6a7lop-9m9q-w12.com" ) do |s,x|
126
+ assert_instance_of( ConnectException, x )
127
+ end
128
+ end
129
+ end
130
+
131
+ def test_local_connection_refused
132
+ with_new_client do |client|
133
+ with_session_handler( client,
134
+ "http://localhost:54929/" ) do |s,x|
135
+ assert_instance_of( ConnectException, x )
136
+ end
137
+ end
138
+ end
139
+
140
+ def test_connection_timeout
141
+ bs = BrokenServer.new
142
+ bs.start
143
+
144
+ #FIXME: Looks like request_timeout is used as this timeout as well.
145
+ with_new_client( :connection_timeout_in_ms => 100,
146
+ :request_timeout_in_ms => 200 ) do |client|
147
+ with_session_handler( client,
148
+ "http://localhost:19293/" ) do |s,x|
149
+ assert_instance_of( TimeoutException, x )
150
+ end
151
+ end
152
+ ensure
153
+ bs.stop
154
+ end
155
+
156
+ def test_404
157
+ with_new_client do |client|
158
+ with_session_handler( client, "/not-found" ) do |s,x|
159
+ assert_equal( 404, s.status_code )
160
+ end
161
+ end
162
+ end
163
+
164
+ def test_304
165
+ with_new_client do |client|
166
+ client.accepted_content_types = ContentTypeSet.new( [ "text/html" ] )
167
+ with_session_handler( client, "/304" ) do |s,x|
168
+ assert_equal( 304, s.status_code )
169
+ end
170
+ end
171
+ end
172
+
173
+ def test_timeout
174
+ with_new_client( :request_timeout_in_ms => 400 ) do |client|
175
+ with_session_handler( client, "/index?sleep=1.0" ) do |s,x|
176
+ assert_instance_of( TimeoutException, x )
177
+ end
178
+ end
179
+ sleep 0.70 # FIXME: Account for test server delay. Should be
180
+ # joined instead.
181
+ end
182
+
183
+ def test_redirect
184
+ with_new_client( :follow_redirects => true ) do |client|
185
+ with_session_handler( client, "/" ) do |s,x|
186
+ assert_equal( 200, s.status_code )
187
+ assert_equal( 'http://localhost:19292/index', s.url )
188
+ end
189
+ end
190
+ end
191
+
192
+ def test_redirect_with_query_string
193
+ with_new_client( :follow_redirects => true ) do |client|
194
+ with_session_handler( client, "/redirects/multi/2?sleep=0" ) do |s,x|
195
+ assert_equal( 200, s.status_code )
196
+ assert_equal( 'http://localhost:19292/redirects/multi/1?sleep=0',
197
+ s.url )
198
+ assert_equal( 'GET /redirects/multi/1?sleep=0',
199
+ find_header( s.request_headers, "Request-Line" ) )
200
+ end
201
+ end
202
+ end
203
+
204
+ def test_multi_redirect
205
+ with_new_client( :follow_redirects => true,
206
+ :maximum_number_of_redirects => 7 ) do |client|
207
+ with_session_handler( client, "/redirects/multi/6" ) do |s,x|
208
+ assert_equal( 200, s.status_code )
209
+ assert_nil x
210
+ end
211
+ end
212
+ end
213
+
214
+ def test_unfollowed_301_redirect
215
+ with_new_client( :follow_redirects => false ) do |client|
216
+ with_session_handler( client, "/301" ) do |s,x|
217
+ assert_equal( 301, s.status_code )
218
+ lh = find_header( s.response_headers, "Location" )
219
+ assert_match( %r{/index$}, lh )
220
+ end
221
+ end
222
+ end
223
+
224
+ def test_too_many_redirects
225
+ with_new_client( :follow_redirects => true,
226
+ :maximum_number_of_redirects => 19 ) do |client|
227
+ with_session_handler( client, "/redirects/multi/20" ) do |s,x|
228
+ assert_instance_of( MaxRedirectException, x )
229
+ end
230
+ end
231
+ end
232
+
233
+ def test_redirect_timeout
234
+ skip( "Unreliable timeout with redirects, timing dependent" )
235
+ with_new_client( :request_timeout_in_ms => 500 ) do |client|
236
+ with_session_handler( client, "/redirects/multi/3?sleep=0.40" ) do |s,x|
237
+ assert_instance_of( TimeoutException, x )
238
+ end
239
+ sleep 0.80
240
+ end
241
+ end
242
+
243
+ def test_bad_server_response
244
+ bs = BrokenServer.new
245
+ bs.start
246
+
247
+ sthread = Thread.new do
248
+ bs.accept { |sock| sock.write "FU Stinky\r\n" }
249
+ end
250
+
251
+ #FIXME: IllegalArgumentException on bad HTTP response line?
252
+ with_new_client do |client|
253
+ with_session_handler( client, "http://localhost:19293/" ) do |s,x|
254
+ assert_instance_of( Java::java.lang.IllegalArgumentException, x )
255
+ end
256
+ end
257
+
258
+ sthread.join
259
+
260
+ ensure
261
+ bs.stop
262
+ end
263
+
264
+ def test_empty_server_response
265
+ bs = BrokenServer.new
266
+ bs.start
267
+
268
+ sthread = Thread.new do
269
+ bs.accept { |sock| sock.close }
270
+ end
271
+
272
+ with_new_client( :connection_timeout_in_ms => 100,
273
+ :request_timeout_in_ms => 100 ) do |client|
274
+ with_session_handler( client, "http://localhost:19293/" ) do |s,x|
275
+ assert_instance_of( IOException, x )
276
+ end
277
+ end
278
+
279
+ sthread.join
280
+
281
+ ensure
282
+ bs.stop
283
+ end
284
+
285
+ def test_maximum_connections_total
286
+ skip( "IOException: Too many connections; expected blocking" )
287
+ with_new_client( :maximum_connections_total => 1 ) do |client|
288
+
289
+ resps = []
290
+ sessions = (1..7).map do |i|
291
+ with_session_handler( client, "/index?sleep=2&con=1&i=#{i}",
292
+ false ) do |s,x|
293
+ resps << [ s.status_code, x ]
294
+ end
295
+ end
296
+
297
+ sessions.each { |s| s.wait_for_completion }
298
+
299
+ assert_equal( [ [ 200, nil ] ] * 7, resps )
300
+ end
301
+ end
302
+
303
+ def test_maximum_connections_per_host
304
+ skip( "max_connections_per_host not honored?" )
305
+ with_new_client( :maximum_connections_per_host => 1 ) do |client|
306
+
307
+ resps = []
308
+ sessions = (1..7).map do |i|
309
+ with_session_handler( client, "/index?sleep=2&con=1&i=#{i}",
310
+ false ) do |s,x|
311
+ resps << [ s.status_code, x ]
312
+ end
313
+ end
314
+
315
+ sessions.each { |s| s.wait_for_completion }
316
+
317
+ assert_equal( [ [ 200, nil ] ] * 7, resps )
318
+ end
319
+ end
320
+
321
+ def test_abort_when_too_large
322
+ with_new_client do |client|
323
+ with_session_handler( client, "/giant" ) do |s,x|
324
+ assert_nil( x )
325
+ assert_equal( HTTPSession::TOO_LARGE, s.status_code )
326
+ end
327
+ end
328
+ end
329
+
330
+ def test_abort_when_too_large_length
331
+ with_new_client do |client|
332
+ client.max_content_length = 1
333
+ with_session_handler( client, "/atom.xml" ) do |s,x|
334
+ assert_nil( x )
335
+ assert_equal( HTTPSession::TOO_LARGE_LENGTH, s.status_code )
336
+ end
337
+ end
338
+ end
339
+
340
+ def test_abort_when_wrong_type
341
+ with_new_client do |client|
342
+ client.accepted_content_types = ContentTypeSet.new( [ "gold/*" ] )
343
+ with_session_handler( client, "/giant" ) do |s,x|
344
+ assert_nil( x )
345
+ assert_equal( HTTPSession::NOT_ACCEPTED, s.status_code )
346
+ end
347
+ end
348
+ end
349
+
350
+ def with_session_handler( client, uri, wait = true, headers = {}, &block )
351
+ session = client.create_session
352
+ uri = "http://localhost:#{server.port}#{uri}" unless uri =~ /^http:/
353
+ session.url = uri
354
+ headers.each do |k,v|
355
+ session.add_request_header( Java::iudex.http.Header.new( k, v ) )
356
+ end
357
+ handler = TestHandler.new( &block )
358
+ client.request( session, handler )
359
+ if wait
360
+ session.wait_for_completion
361
+ assert handler.called?
362
+ session.close
363
+ end
364
+ session
365
+ end
366
+
367
+ def with_new_client( opts = {} )
368
+ opts = { :max_request_retry => 0 }.merge( opts )
369
+
370
+ client = AsyncHTTPClient.create_client( opts )
371
+ begin
372
+ yield client
373
+ ensure
374
+ client.close
375
+ end
376
+ end
377
+
378
+ class TestHandler < BaseResponseHandler
379
+
380
+ def initialize( &block )
381
+ @block = block
382
+ @failure = nil
383
+ end
384
+
385
+ def sessionCompleted( session )
386
+ forward( session, session.error )
387
+ end
388
+
389
+ def called?
390
+ raise @failure if @failure
391
+ @block.nil?
392
+ end
393
+
394
+ def forward( s, x = nil )
395
+ b, @block = @block, nil
396
+ if b
397
+ b.call( s, x )
398
+ else
399
+ flunk "Handler called twice!"
400
+ end
401
+ rescue NativeException => x
402
+ @failure = x.cause
403
+ rescue Exception => x
404
+ @failure = x
405
+ end
406
+
407
+ end
408
+
409
+ def find_header( headers, name )
410
+ cl = headers.find { |h| h.name.to_s == name }
411
+ cl && cl.value.to_s
412
+ end
413
+
414
+ end
metadata ADDED
@@ -0,0 +1,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: iudex-async-httpclient
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 1.1.0
6
+ platform: java
7
+ authors:
8
+ - David Kellum
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-11-13 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: iudex-http
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 1.1.0
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: rjack-async-httpclient
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 1.6.5
35
+ type: :runtime
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: hooker
39
+ prerelease: false
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.0.0
46
+ type: :runtime
47
+ version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: minitest
50
+ prerelease: false
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: "2.3"
57
+ type: :development
58
+ version_requirements: *id004
59
+ - !ruby/object:Gem::Dependency
60
+ name: iudex-http-test
61
+ prerelease: false
62
+ requirement: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: 1.1.0
68
+ type: :development
69
+ version_requirements: *id005
70
+ - !ruby/object:Gem::Dependency
71
+ name: rjack-logback
72
+ prerelease: false
73
+ requirement: &id006 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ version: "1.0"
79
+ type: :development
80
+ version_requirements: *id006
81
+ - !ruby/object:Gem::Dependency
82
+ name: rjack-tarpit
83
+ prerelease: false
84
+ requirement: &id007 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 1.4.0
90
+ type: :development
91
+ version_requirements: *id007
92
+ description: |-
93
+ Iudex is a general purpose web crawler and feed processor in
94
+ ruby/java. This gem is an rjack-async-httpclient based implementation
95
+ of the iudex-http interfaces.
96
+ email:
97
+ - dek-oss@gravitext.com
98
+ executables: []
99
+
100
+ extensions: []
101
+
102
+ extra_rdoc_files:
103
+ - Manifest.txt
104
+ - History.rdoc
105
+ - README.rdoc
106
+ files:
107
+ - History.rdoc
108
+ - Manifest.txt
109
+ - README.rdoc
110
+ - Rakefile
111
+ - pom.xml
112
+ - lib/iudex-async-httpclient/base.rb
113
+ - lib/iudex-async-httpclient.rb
114
+ - test/setup.rb
115
+ - test/test_httpclient.rb
116
+ - lib/iudex-async-httpclient/iudex-async-httpclient-1.1.0.jar
117
+ - .gemtest
118
+ homepage: http://github.com/dekellum/iudex
119
+ licenses: []
120
+
121
+ post_install_message:
122
+ rdoc_options:
123
+ - --main
124
+ - README.rdoc
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: "0"
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ none: false
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: "0"
139
+ requirements: []
140
+
141
+ rubyforge_project: iudex-async-httpclient
142
+ rubygems_version: 1.8.9
143
+ signing_key:
144
+ specification_version: 3
145
+ summary: Iudex is a general purpose web crawler and feed processor in ruby/java
146
+ test_files:
147
+ - test/test_httpclient.rb