http_spew 0.4.1 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.document +0 -1
- data/.gitignore +1 -4
- data/.manifest +3 -3
- data/.olddoc.yml +6 -0
- data/COPYING +288 -623
- data/GIT-VERSION-FILE +1 -1
- data/GIT-VERSION-GEN +1 -1
- data/GNUmakefile +2 -3
- data/LATEST +4 -2
- data/LICENSE +8 -11
- data/NEWS +55 -0
- data/README +5 -6
- data/benchmark/bm_content_md5.rb +52 -0
- data/benchmark/bm_content_md5_input_spray.rb +59 -0
- data/http_spew.gemspec +14 -18
- data/lib/http_spew/chunky_pipe.rb +14 -3
- data/lib/http_spew/class_methods.rb +40 -12
- data/lib/http_spew/content_md5.rb +6 -6
- data/lib/http_spew/headers.rb +8 -17
- data/lib/http_spew/input_spray.rb +1 -0
- data/lib/http_spew/request.rb +46 -33
- data/lib/http_spew/version.rb +1 -1
- data/lib/http_spew.rb +14 -14
- data/pkg.mk +27 -52
- data/test/helper.rb +3 -1
- data/test/test_content_md5.rb +1 -1
- data/test/test_hit_n_run.rb +5 -5
- data/test/test_input_spray_with_md5.rb +3 -3
- data/test/test_mirror.rb +1 -1
- data/test/test_request.rb +5 -7
- data/test/test_unexpected_response.rb +2 -2
- data/test/test_upload.rb +6 -3
- metadata +31 -76
- data/.wrongdoc.yml +0 -4
- data/ChangeLog +0 -546
- data/Gemfile +0 -5
data/lib/http_spew/request.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# -*- encoding: binary -*-
|
2
|
+
require 'socket'
|
3
|
+
|
2
4
|
# This is the base class actually capable of making a normal HTTP request
|
3
5
|
class HTTP_Spew::Request
|
4
6
|
|
5
|
-
# May be called by
|
6
|
-
# +to_path+ calls and avoid path lookups.
|
7
|
+
# May be called by IO.select or for use with IO#wait_*able
|
7
8
|
attr_reader :to_io
|
8
9
|
|
9
10
|
# Stores any exception that was raised in another thread (e.g.
|
@@ -22,10 +23,9 @@ class HTTP_Spew::Request
|
|
22
23
|
#
|
23
24
|
# +sock+ may be the String representing an address created with
|
24
25
|
# +Socket.pack_sockaddr_un+ or +Socket.pack_sockaddr_in+, or it
|
25
|
-
# may be an actual
|
26
|
-
# (e.g. Kgio::Socket)
|
26
|
+
# may be an actual Socket object
|
27
27
|
def initialize(env, input, sock, allow = nil)
|
28
|
-
@to_io =
|
28
|
+
@to_io = BasicSocket === sock ? sock : start_sock(sock)
|
29
29
|
if Hash === env
|
30
30
|
@buf, @input = env_to_headers(env, input)
|
31
31
|
else
|
@@ -38,39 +38,43 @@ class HTTP_Spew::Request
|
|
38
38
|
# returns :wait_readable or :wait_writable if busy
|
39
39
|
def resume
|
40
40
|
if @buf
|
41
|
-
case
|
42
|
-
when
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
41
|
+
case w = @to_io.write_nonblock(@buf, exception: false)
|
42
|
+
when :wait_writable, :wait_readable
|
43
|
+
return w
|
44
|
+
else # Integer
|
45
|
+
len = @buf.size
|
46
|
+
if w == len
|
47
|
+
@buf = @input ? @input.read(0x4000, @buf) : nil
|
48
|
+
else
|
49
|
+
tmp = @buf.byteslice(w, len - w)
|
50
|
+
@buf.clear
|
51
|
+
@buf = tmp # loop retry, socket buffer could've expanded
|
52
|
+
end
|
48
53
|
end while @buf
|
49
|
-
read_response
|
50
|
-
else
|
51
|
-
read_response
|
52
54
|
end
|
55
|
+
read_response
|
53
56
|
end
|
54
57
|
|
55
58
|
# returns a 3-element Rack response array on successful completion
|
56
59
|
# returns an Exception if one was raised
|
57
60
|
def run(timeout)
|
58
|
-
t0 =
|
61
|
+
t0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
59
62
|
buf, @buf = @buf, nil # make inspect nicer
|
60
63
|
@to_io.write(buf)
|
61
64
|
if @input
|
62
65
|
@to_io.write(buf) while @input.read(0x4000, buf)
|
63
66
|
end
|
64
|
-
|
67
|
+
buf.clear
|
68
|
+
timeout -= (Process.clock_gettime(Process::CLOCK_MONOTONIC) - t0)
|
65
69
|
while :wait_readable == (rv = read_response) && timeout >= 0.0
|
66
|
-
t0 =
|
67
|
-
@to_io.
|
68
|
-
timeout -= (
|
70
|
+
t0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
71
|
+
@to_io.wait_readable(timeout) if timeout > 0.0
|
72
|
+
timeout -= (Process.clock_gettime(Process::CLOCK_MONOTONIC) - t0)
|
69
73
|
end
|
70
74
|
rv
|
71
|
-
|
72
|
-
|
73
|
-
|
75
|
+
rescue => e
|
76
|
+
@input.respond_to?(:close) and @input.close rescue nil
|
77
|
+
self.error = e
|
74
78
|
end
|
75
79
|
|
76
80
|
# returns a 3-element Rack response array on completion
|
@@ -78,7 +82,7 @@ class HTTP_Spew::Request
|
|
78
82
|
# Users do not need to call this directly, +resume+ will return the result
|
79
83
|
# of this.
|
80
84
|
def read_response
|
81
|
-
buf = @to_io.
|
85
|
+
buf = @to_io.recv_nonblock(0x4000, Socket::MSG_PEEK, exception: false) or
|
82
86
|
raise HttpSpew::EOF, "upstream server closed connection", []
|
83
87
|
String === buf or return buf
|
84
88
|
|
@@ -91,16 +95,10 @@ class HTTP_Spew::Request
|
|
91
95
|
end
|
92
96
|
|
93
97
|
# discard the header data from the socket buffer
|
94
|
-
(hdr_len -= buf.size) > 0 and @to_io.
|
98
|
+
(hdr_len -= buf.size) > 0 and @to_io.read(hdr_len, buf)
|
95
99
|
@response = r << self
|
96
100
|
end
|
97
101
|
|
98
|
-
# Used by some Rack-compatible servers to optimize transfers
|
99
|
-
# by using IO.copy_stream
|
100
|
-
def to_path
|
101
|
-
"/dev/fd/#{@to_io.fileno}"
|
102
|
-
end
|
103
|
-
|
104
102
|
def too_big! # :nodoc:
|
105
103
|
raise HTTP_Spew::RequestError.new(self), "response headers too large", []
|
106
104
|
end
|
@@ -108,9 +106,15 @@ class HTTP_Spew::Request
|
|
108
106
|
# Called by Rack servers to write the response to a client
|
109
107
|
def each
|
110
108
|
buf = ""
|
111
|
-
|
109
|
+
case @to_io.read_nonblock(0x4000, buf, exception: false)
|
110
|
+
when :wait_readable
|
111
|
+
@to_io.wait_readable
|
112
|
+
when nil
|
113
|
+
buf.clear
|
114
|
+
return
|
115
|
+
else
|
112
116
|
yield buf
|
113
|
-
end
|
117
|
+
end while true
|
114
118
|
end
|
115
119
|
|
116
120
|
# Used internally by various HTTP_Spew elements to report errors
|
@@ -126,4 +130,13 @@ class HTTP_Spew::Request
|
|
126
130
|
@to_io.close
|
127
131
|
@input = nil
|
128
132
|
end
|
133
|
+
|
134
|
+
def start_sock(ai)
|
135
|
+
ai = Addrinfo.new(ai) unless Addrinfo === ai
|
136
|
+
sock = Socket.new(ai.afamily, :SOCK_STREAM)
|
137
|
+
case sock.connect_nonblock(ai, exception: false)
|
138
|
+
when 0, :wait_writable
|
139
|
+
end
|
140
|
+
sock
|
141
|
+
end
|
129
142
|
end
|
data/lib/http_spew/version.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
# -*- encoding: binary -*-
|
2
|
-
HTTP_Spew.const_set :VERSION, "0.
|
2
|
+
HTTP_Spew.const_set :VERSION, "0.7.1".freeze
|
data/lib/http_spew.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- encoding: binary -*-
|
2
|
-
require "
|
2
|
+
require "io/wait"
|
3
3
|
require "kcar"
|
4
4
|
|
5
5
|
module HTTP_Spew
|
@@ -8,20 +8,20 @@ module HTTP_Spew
|
|
8
8
|
autoload :HitNRun, "http_spew/hit_n_run"
|
9
9
|
autoload :InputSpray, "http_spew/input_spray"
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
Error = Class.new(RuntimeError)
|
12
|
+
TimeoutError = Class.new(Error)
|
13
|
+
ConnectionReset = Class.new(Error)
|
14
|
+
RequestError = Class.new(Error)
|
15
|
+
UnexpectedResponse = Class.new(RequestError)
|
16
|
+
ChecksumError = Class.new(Error)
|
17
|
+
LengthError = Class.new(Error)
|
18
|
+
NoWritersError = Class.new(Error)
|
19
|
+
EOF = Class.new(EOFError)
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
require_relative "http_spew/version"
|
22
|
+
require_relative "http_spew/headers"
|
23
|
+
require_relative "http_spew/request"
|
24
|
+
require_relative "http_spew/class_methods"
|
25
25
|
|
26
26
|
extend HTTP_Spew::ClassMethods
|
27
27
|
end
|
data/pkg.mk
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
RUBY = ruby
|
2
2
|
RAKE = rake
|
3
3
|
RSYNC = rsync
|
4
|
-
|
4
|
+
OLDDOC = olddoc
|
5
|
+
RDOC = rdoc
|
5
6
|
|
6
7
|
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
|
7
8
|
@./GIT-VERSION-GEN
|
@@ -12,14 +13,6 @@ RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
|
|
12
13
|
RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
|
13
14
|
lib := lib
|
14
15
|
|
15
|
-
ifeq ($(shell test -f script/isolate_for_tests && echo t),t)
|
16
|
-
isolate_libs := tmp/isolate/$(RUBY_ENGINE)-$(RUBY_VERSION)/isolate.mk
|
17
|
-
$(isolate_libs): script/isolate_for_tests
|
18
|
-
@$(RUBY) script/isolate_for_tests
|
19
|
-
-include $(isolate_libs)
|
20
|
-
lib := $(lib):$(ISOLATE_LIBS)
|
21
|
-
endif
|
22
|
-
|
23
16
|
ext := $(firstword $(wildcard ext/*))
|
24
17
|
ifneq ($(ext),)
|
25
18
|
ext_pfx := tmp/ext/$(RUBY_ENGINE)-$(RUBY_VERSION)
|
@@ -36,7 +29,7 @@ $(ext_pfx)/$(ext)/%: $(ext)/% $(ext_d)
|
|
36
29
|
install -m 644 $< $@
|
37
30
|
$(ext_pfx)/$(ext)/Makefile: $(ext)/extconf.rb $(ext_d) $(ext_h)
|
38
31
|
$(RM) -f $(@D)/*.o
|
39
|
-
cd $(@D) && $(RUBY) $(CURDIR)/$(ext)/extconf.rb
|
32
|
+
cd $(@D) && $(RUBY) $(CURDIR)/$(ext)/extconf.rb $(EXTCONF_ARGS)
|
40
33
|
ext_sfx := _ext.$(DLEXT)
|
41
34
|
ext_dl := $(ext_pfx)/$(ext)/$(notdir $(ext)_ext.$(DLEXT))
|
42
35
|
$(ext_dl): $(ext_src) $(ext_pfx_src) $(ext_pfx)/$(ext)/Makefile
|
@@ -48,10 +41,10 @@ else
|
|
48
41
|
build:
|
49
42
|
endif
|
50
43
|
|
51
|
-
pkg_extra += GIT-VERSION-FILE NEWS
|
52
|
-
|
53
|
-
$(
|
54
|
-
|
44
|
+
pkg_extra += GIT-VERSION-FILE NEWS LATEST
|
45
|
+
NEWS: GIT-VERSION-FILE .olddoc.yml
|
46
|
+
$(OLDDOC) prepare
|
47
|
+
LATEST: NEWS
|
55
48
|
|
56
49
|
manifest:
|
57
50
|
$(RM) .manifest
|
@@ -63,28 +56,20 @@ manifest:
|
|
63
56
|
cmp $@+ $@ || mv $@+ $@
|
64
57
|
$(RM) $@+
|
65
58
|
|
66
|
-
doc:: .document .
|
59
|
+
doc:: .document .olddoc.yml $(pkg_extra) $(PLACEHOLDERS)
|
67
60
|
-find lib -type f -name '*.rbc' -exec rm -f '{}' ';'
|
68
61
|
-find ext -type f -name '*.rbc' -exec rm -f '{}' ';'
|
69
62
|
$(RM) -r doc
|
70
|
-
$(
|
71
|
-
|
72
|
-
|
63
|
+
$(RDOC) -f dark216
|
64
|
+
$(OLDDOC) merge
|
65
|
+
if test -f COPYING; then install -m644 COPYING doc/COPYING; fi
|
66
|
+
install -m644 NEWS doc/NEWS
|
67
|
+
install -m644 NEWS.atom.xml doc/NEWS.atom.xml
|
68
|
+
install -m644 $(shell LC_ALL=C grep '^[A-Z]' .document) doc/
|
73
69
|
|
74
70
|
ifneq ($(VERSION),)
|
75
71
|
pkggem := pkg/$(rfpackage)-$(VERSION).gem
|
76
72
|
pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
|
77
|
-
release_notes := release_notes-$(VERSION)
|
78
|
-
release_changes := release_changes-$(VERSION)
|
79
|
-
|
80
|
-
release-notes: $(release_notes)
|
81
|
-
release-changes: $(release_changes)
|
82
|
-
$(release_changes):
|
83
|
-
$(WRONGDOC) release_changes > $@+
|
84
|
-
$(VISUAL) $@+ && test -s $@+ && mv $@+ $@
|
85
|
-
$(release_notes):
|
86
|
-
$(WRONGDOC) release_notes > $@+
|
87
|
-
$(VISUAL) $@+ && test -s $@+ && mv $@+ $@
|
88
73
|
|
89
74
|
# ensures we're actually on the tagged $(VERSION), only used for release
|
90
75
|
verify:
|
@@ -101,7 +86,7 @@ fix-perms:
|
|
101
86
|
gem: $(pkggem)
|
102
87
|
|
103
88
|
install-gem: $(pkggem)
|
104
|
-
gem install $(CURDIR)/$<
|
89
|
+
gem install --local $(CURDIR)/$<
|
105
90
|
|
106
91
|
$(pkggem): manifest fix-perms
|
107
92
|
gem build $(rfpackage).gemspec
|
@@ -120,31 +105,18 @@ $(pkgtgz): manifest fix-perms
|
|
120
105
|
|
121
106
|
package: $(pkgtgz) $(pkggem)
|
122
107
|
|
123
|
-
|
124
|
-
# make tgz release on RubyForge
|
125
|
-
@echo rubyforge add_release -f \
|
126
|
-
-n $(release_notes) -a $(release_changes) \
|
127
|
-
$(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
|
128
|
-
@echo gem push $(pkggem)
|
129
|
-
@echo rubyforge add_file \
|
130
|
-
$(rfproject) $(rfpackage) $(VERSION) $(pkggem)
|
131
|
-
release:: verify package $(release_notes) $(release_changes)
|
132
|
-
# make tgz release on RubyForge
|
133
|
-
rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
|
134
|
-
$(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
|
108
|
+
release:: verify package
|
135
109
|
# push gem to RubyGems.org
|
136
110
|
gem push $(pkggem)
|
137
|
-
# in case of gem downloads from RubyForge releases page
|
138
|
-
rubyforge add_file \
|
139
|
-
$(rfproject) $(rfpackage) $(VERSION) $(pkggem)
|
140
111
|
else
|
141
112
|
gem install-gem: GIT-VERSION-FILE
|
142
113
|
$(MAKE) $@ VERSION=$(GIT_VERSION)
|
143
114
|
endif
|
144
115
|
|
145
|
-
all::
|
116
|
+
all:: check
|
146
117
|
test_units := $(wildcard test/test_*.rb)
|
147
|
-
test:
|
118
|
+
test: check
|
119
|
+
check: test-unit
|
148
120
|
test-unit: $(test_units)
|
149
121
|
$(test_units): build
|
150
122
|
$(RUBY) -I $(lib) $@ $(RUBY_TEST_OPTS)
|
@@ -154,8 +126,6 @@ ifneq ($(RSYNC_DEST),)
|
|
154
126
|
publish_doc:
|
155
127
|
-git set-file-times
|
156
128
|
$(MAKE) doc
|
157
|
-
find doc/images -type f | \
|
158
|
-
TZ=UTC xargs touch -d '1970-01-01 00:00:06' doc/rdoc.css
|
159
129
|
$(MAKE) doc_gz
|
160
130
|
$(RSYNC) -av doc/ $(RSYNC_DEST)/
|
161
131
|
git ls-files | xargs touch
|
@@ -163,13 +133,18 @@ endif
|
|
163
133
|
|
164
134
|
# Create gzip variants of the same timestamp as the original so nginx
|
165
135
|
# "gzip_static on" can serve the gzipped versions directly.
|
166
|
-
doc_gz: docs = $(shell find doc -type f ! -regex '
|
136
|
+
doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.gz$$')
|
167
137
|
doc_gz:
|
168
138
|
for i in $(docs); do \
|
169
139
|
gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
|
170
140
|
check-warnings:
|
171
|
-
@(for i in $$(git ls-files '*.rb'|grep -v '^setup\.rb$$'); \
|
141
|
+
@(for i in $$(git ls-files '*.rb'| grep -v '^setup\.rb$$'); \
|
172
142
|
do $(RUBY) -d -W2 -c $$i; done) | grep -v '^Syntax OK$$' || :
|
173
143
|
|
174
|
-
|
144
|
+
ifneq ($(PLACEHOLDERS),)
|
145
|
+
$(PLACEHOLDERS):
|
146
|
+
echo olddoc_placeholder > $@
|
147
|
+
endif
|
148
|
+
|
149
|
+
.PHONY: all .FORCE-GIT-VERSION-FILE doc check test $(test_units) manifest
|
175
150
|
.PHONY: check-warnings
|
data/test/helper.rb
CHANGED
@@ -10,6 +10,7 @@ require "rack"
|
|
10
10
|
require "tempfile"
|
11
11
|
$-w = true
|
12
12
|
require "http_spew"
|
13
|
+
HAVE_UNICORN = `which unicorn 2>/dev/null`.size > 0
|
13
14
|
|
14
15
|
def start_server(config, worker_processes = 4, rewindable_input = false)
|
15
16
|
ENV["RACK_ENV"] = "deployment"
|
@@ -32,7 +33,8 @@ EOF
|
|
32
33
|
cfg.flush
|
33
34
|
pid = fork do
|
34
35
|
ENV["UNICORN_FD"] = sock.fileno.to_s
|
35
|
-
|
36
|
+
redirect = { sock => sock } if RUBY_VERSION.to_f >= 2.0
|
37
|
+
exec "unicorn", "-l#{addr}:#{port}", "-c#{cfg.path}", config, redirect
|
36
38
|
end
|
37
39
|
File.open(fifo_path).close
|
38
40
|
File.unlink fifo_path
|
data/test/test_content_md5.rb
CHANGED
data/test/test_hit_n_run.rb
CHANGED
@@ -19,7 +19,8 @@ class TestHitNRun < Test::Unit::TestCase
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_request_with_existing_socket
|
22
|
-
sock =
|
22
|
+
sock = TCPSocket.new(@addr, @port)
|
23
|
+
assert(BasicSocket === sock)
|
23
24
|
req = HTTP_Spew::HitNRun.new(@env, nil, sock)
|
24
25
|
assert_equal sock, req.to_io
|
25
26
|
assert_nothing_raised { req.close }
|
@@ -30,8 +31,7 @@ class TestHitNRun < Test::Unit::TestCase
|
|
30
31
|
req = HTTP_Spew::HitNRun.new(@env, nil, @sockaddr)
|
31
32
|
sym = req.resume
|
32
33
|
if sym == :wait_writable
|
33
|
-
|
34
|
-
assert_equal [ req ], set.keys
|
34
|
+
assert req.to_io.wait_writable(0.1)
|
35
35
|
sym = req.resume
|
36
36
|
end
|
37
37
|
assert_equal HTTP_Spew::HitNRun::RESPONSE.object_id, sym.object_id
|
@@ -40,8 +40,8 @@ class TestHitNRun < Test::Unit::TestCase
|
|
40
40
|
def test_request_loop
|
41
41
|
req = HTTP_Spew::HitNRun.new(@env, nil, @sockaddr)
|
42
42
|
until Array === (rv = req.resume)
|
43
|
-
|
43
|
+
req.__send__(rv)
|
44
44
|
end
|
45
45
|
assert_equal HTTP_Spew::HitNRun::RESPONSE.object_id, rv.object_id
|
46
46
|
end
|
47
|
-
end
|
47
|
+
end if HAVE_UNICORN
|
@@ -60,9 +60,9 @@ class TestInputSprayWithMD5 < Test::Unit::TestCase
|
|
60
60
|
HTTP_Spew::Request.new(@env, md5_input, @sockaddr)
|
61
61
|
end
|
62
62
|
assert_equal @nr, reqs.size
|
63
|
-
t0 =
|
63
|
+
t0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
64
64
|
rv = HTTP_Spew.wait_mt reqs.size, reqs, 3600
|
65
|
-
elapsed =
|
65
|
+
elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - t0
|
66
66
|
assert(elapsed <= 30, "took too long: #{elapsed}s")
|
67
67
|
assert_equal @nr, rv.size
|
68
68
|
rv.each { |r|
|
@@ -104,4 +104,4 @@ class TestInputSprayWithMD5 < Test::Unit::TestCase
|
|
104
104
|
assert_equal expect_md5, input.content_md5
|
105
105
|
assert_equal 123 * 8 * 1021 * 13, input.bytes_digested
|
106
106
|
end
|
107
|
-
end
|
107
|
+
end if HAVE_UNICORN
|
data/test/test_mirror.rb
CHANGED
data/test/test_request.rb
CHANGED
@@ -19,7 +19,7 @@ class TestRequest < Test::Unit::TestCase
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_request_with_existing_socket
|
22
|
-
sock =
|
22
|
+
sock = TCPSocket.new(@addr, @port)
|
23
23
|
req = HTTP_Spew::Request.new(@env, nil, sock)
|
24
24
|
assert_equal sock, req.to_io
|
25
25
|
assert_nothing_raised { req.close }
|
@@ -31,13 +31,11 @@ class TestRequest < Test::Unit::TestCase
|
|
31
31
|
sym = req.resume
|
32
32
|
assert_kind_of(Symbol, sym)
|
33
33
|
if sym == :wait_writable
|
34
|
-
|
35
|
-
assert_equal [ req ], set.keys
|
34
|
+
assert req.to_io.wait_writable(1)
|
36
35
|
sym = req.resume
|
37
36
|
end
|
38
37
|
assert_equal :wait_readable, sym
|
39
|
-
|
40
|
-
assert_equal [ req ], set.keys
|
38
|
+
assert req.to_io.wait_readable(1)
|
41
39
|
rv = req.resume
|
42
40
|
assert_equal req, rv[2]
|
43
41
|
end
|
@@ -45,10 +43,10 @@ class TestRequest < Test::Unit::TestCase
|
|
45
43
|
def test_request_loop
|
46
44
|
req = HTTP_Spew::Request.new(@env, nil, @sockaddr)
|
47
45
|
until Array === (rv = req.resume)
|
48
|
-
|
46
|
+
req.to_io.__send__(rv) # wait_readable/wait_writable
|
49
47
|
end
|
50
48
|
assert_kind_of Array, rv
|
51
49
|
assert_equal 3, rv.size
|
52
50
|
assert_equal req, rv[2]
|
53
51
|
end
|
54
|
-
end
|
52
|
+
end if HAVE_UNICORN
|
@@ -19,7 +19,7 @@ class TestRequest < Test::Unit::TestCase
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_request_with_existing_socket
|
22
|
-
sock =
|
22
|
+
sock = TCPSocket.new(@addr, @port)
|
23
23
|
req = HTTP_Spew::Request.new(@env, nil, sock)
|
24
24
|
assert_equal sock, req.to_io
|
25
25
|
assert_nothing_raised { req.close }
|
@@ -44,4 +44,4 @@ class TestRequest < Test::Unit::TestCase
|
|
44
44
|
rv[2].each { |chunk| buf << chunk }
|
45
45
|
assert_equal "da39a3ee5e6b4b0d3255bfef95601890afd80709\n", buf
|
46
46
|
end
|
47
|
-
end
|
47
|
+
end if HAVE_UNICORN
|
data/test/test_upload.rb
CHANGED
@@ -117,13 +117,16 @@ class TestUpload < Test::Unit::TestCase
|
|
117
117
|
req << HTTP_Spew::Request.new(@env, StringIO.new(str), @sockaddr)
|
118
118
|
req << HTTP_Spew::Request.new(@env, StringIO.new(str), @sockaddr)
|
119
119
|
req << HTTP_Spew::Request.new(@env, StringIO.new(str), @sockaddr)
|
120
|
-
before = req.
|
120
|
+
before = req.map(&:object_id)
|
121
121
|
rv = HTTP_Spew.wait_nonblock!(3, req)
|
122
122
|
while rv.nil? do
|
123
123
|
rv = HTTP_Spew.wait_nonblock!(3, req)
|
124
124
|
end
|
125
125
|
assert_nil rv.uniq!
|
126
126
|
assert rv.size > 0
|
127
|
-
rv.
|
127
|
+
rv.map!(&:object_id)
|
128
|
+
rv.each do |r|
|
129
|
+
assert before.include?(r), "rv=#{rv.inspect} before=#{before.inspect}"
|
130
|
+
end
|
128
131
|
end
|
129
|
-
end
|
132
|
+
end if HAVE_UNICORN
|
metadata
CHANGED
@@ -1,70 +1,40 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http_spew
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.7.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
-
|
7
|
+
- http_spew hackers
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2022-01-16 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: kcar
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0.3'
|
22
|
-
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0.3'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: kgio
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
20
|
+
- - ">="
|
36
21
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
22
|
+
version: 0.3.1
|
38
23
|
type: :runtime
|
39
24
|
prerelease: false
|
40
25
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
26
|
requirements:
|
43
|
-
- - ~>
|
27
|
+
- - "~>"
|
44
28
|
- !ruby/object:Gem::Version
|
45
|
-
version: '
|
46
|
-
-
|
47
|
-
name: wrongdoc
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ~>
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '1.5'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
29
|
+
version: '0.3'
|
30
|
+
- - ">="
|
60
31
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
-
description:
|
63
|
-
|
32
|
+
version: 0.3.1
|
33
|
+
description: |-
|
34
|
+
Do not use HTTP Spew for connecting to servers outside of your LAN.
|
64
35
|
Do not use HTTP Spew without the permission of your server admins.
|
65
|
-
|
66
|
-
|
67
|
-
email: http.spew@librelist.org
|
36
|
+
Use HTTP Spew if you wish you could kinda multicast with HTTP...
|
37
|
+
email: http_spew-public@yhbt.net
|
68
38
|
executables: []
|
69
39
|
extensions: []
|
70
40
|
extra_rdoc_files:
|
@@ -72,31 +42,21 @@ extra_rdoc_files:
|
|
72
42
|
- README
|
73
43
|
- NEWS
|
74
44
|
- LATEST
|
75
|
-
- ChangeLog
|
76
|
-
- lib/http_spew.rb
|
77
|
-
- lib/http_spew/chunky_pipe.rb
|
78
|
-
- lib/http_spew/class_methods.rb
|
79
|
-
- lib/http_spew/content_md5.rb
|
80
|
-
- lib/http_spew/headers.rb
|
81
|
-
- lib/http_spew/hit_n_run.rb
|
82
|
-
- lib/http_spew/input_spray.rb
|
83
|
-
- lib/http_spew/request.rb
|
84
|
-
- lib/http_spew/version.rb
|
85
45
|
files:
|
86
|
-
- .document
|
87
|
-
- .gitignore
|
88
|
-
- .manifest
|
89
|
-
- .
|
46
|
+
- ".document"
|
47
|
+
- ".gitignore"
|
48
|
+
- ".manifest"
|
49
|
+
- ".olddoc.yml"
|
90
50
|
- COPYING
|
91
|
-
- ChangeLog
|
92
51
|
- GIT-VERSION-FILE
|
93
52
|
- GIT-VERSION-GEN
|
94
53
|
- GNUmakefile
|
95
|
-
- Gemfile
|
96
54
|
- LATEST
|
97
55
|
- LICENSE
|
98
56
|
- NEWS
|
99
57
|
- README
|
58
|
+
- benchmark/bm_content_md5.rb
|
59
|
+
- benchmark/bm_content_md5_input_spray.rb
|
100
60
|
- http_spew.gemspec
|
101
61
|
- lib/http_spew.rb
|
102
62
|
- lib/http_spew/chunky_pipe.rb
|
@@ -122,34 +82,29 @@ files:
|
|
122
82
|
- test/test_request.rb
|
123
83
|
- test/test_unexpected_response.rb
|
124
84
|
- test/test_upload.rb
|
125
|
-
homepage:
|
126
|
-
licenses:
|
85
|
+
homepage: https://yhbt.net/http_spew/
|
86
|
+
licenses:
|
87
|
+
- GPL-2.0+
|
88
|
+
metadata: {}
|
127
89
|
post_install_message:
|
128
|
-
rdoc_options:
|
129
|
-
- -t
|
130
|
-
- HTTP Spew - LAN-only HTTP spam^H^H^H^Hclient for Ruby
|
131
|
-
- -W
|
132
|
-
- http://bogomips.org/http_spew.git/tree/%s
|
90
|
+
rdoc_options: []
|
133
91
|
require_paths:
|
134
92
|
- lib
|
135
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
-
none: false
|
137
94
|
requirements:
|
138
|
-
- -
|
95
|
+
- - ">="
|
139
96
|
- !ruby/object:Gem::Version
|
140
|
-
version: '
|
97
|
+
version: '2.3'
|
141
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
|
-
none: false
|
143
99
|
requirements:
|
144
|
-
- -
|
100
|
+
- - ">="
|
145
101
|
- !ruby/object:Gem::Version
|
146
102
|
version: '0'
|
147
103
|
requirements: []
|
148
|
-
|
149
|
-
rubygems_version: 1.8.23
|
104
|
+
rubygems_version: 3.0.2
|
150
105
|
signing_key:
|
151
|
-
specification_version:
|
152
|
-
summary: LAN-only HTTP spam^H^H^H^Hclient for Ruby
|
106
|
+
specification_version: 4
|
107
|
+
summary: HTTP Spew - LAN-only HTTP spam^H^H^H^Hclient for Ruby
|
153
108
|
test_files:
|
154
109
|
- test/test_input_spray_with_md5.rb
|
155
110
|
- test/test_mirror.rb
|
data/.wrongdoc.yml
DELETED