ht2p 0.0.3 → 0.0.4
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.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/ht2p.gemspec +61 -0
- data/lib/ht2p/client/request.rb +2 -1
- data/lib/ht2p/client/response.rb +1 -1
- data/spec/ht2p_spec.rb +13 -14
- metadata +3 -2
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/ht2p.gemspec
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{ht2p}
|
8
|
+
s.version = "0.0.4"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Jun Kikuchi"]
|
12
|
+
s.date = %q{2009-11-19}
|
13
|
+
s.description = %q{ht2p}
|
14
|
+
s.email = %q{kikuchi@bonnou.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"ht2p.gemspec",
|
27
|
+
"lib/ht2p.rb",
|
28
|
+
"lib/ht2p/client.rb",
|
29
|
+
"lib/ht2p/client/request.rb",
|
30
|
+
"lib/ht2p/client/response.rb",
|
31
|
+
"lib/ht2p/header.rb",
|
32
|
+
"spec/ht2p_spec.rb",
|
33
|
+
"spec/server.rb",
|
34
|
+
"spec/spec.opts",
|
35
|
+
"spec/spec_helper.rb"
|
36
|
+
]
|
37
|
+
s.homepage = %q{http://github.com/JunKikuchi/ht2p}
|
38
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
39
|
+
s.require_paths = ["lib"]
|
40
|
+
s.rubygems_version = %q{1.3.5}
|
41
|
+
s.summary = %q{ht2p}
|
42
|
+
s.test_files = [
|
43
|
+
"spec/ht2p_spec.rb",
|
44
|
+
"spec/server.rb",
|
45
|
+
"spec/spec_helper.rb"
|
46
|
+
]
|
47
|
+
|
48
|
+
if s.respond_to? :specification_version then
|
49
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
50
|
+
s.specification_version = 3
|
51
|
+
|
52
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
53
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
54
|
+
else
|
55
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
56
|
+
end
|
57
|
+
else
|
58
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
data/lib/ht2p/client/request.rb
CHANGED
@@ -11,7 +11,8 @@ class HT2P::Client::Request
|
|
11
11
|
|
12
12
|
def send(body=nil, &block)
|
13
13
|
@client.request_header(@method, @header)
|
14
|
-
@
|
14
|
+
@header['content-length'] = body.to_s.size
|
15
|
+
@client.write(body) if body
|
15
16
|
block.call(self) if block_given?
|
16
17
|
@client.flush
|
17
18
|
HT2P::Client::Response.new(@client)
|
data/lib/ht2p/client/response.rb
CHANGED
@@ -6,7 +6,7 @@ class HT2P::Client::Response
|
|
6
6
|
def initialize(client)
|
7
7
|
@client, @code, @header = client, *client.response_header
|
8
8
|
|
9
|
-
@body = if HAS_BODY.include? @client.request.method
|
9
|
+
@body = if HAS_BODY.include? @client.request.method.to_s.downcase.to_sym
|
10
10
|
if @header['transfer-encoding'].to_s.downcase == 'chunked'
|
11
11
|
Chunked.new(@client)
|
12
12
|
else
|
data/spec/ht2p_spec.rb
CHANGED
@@ -35,19 +35,6 @@ describe HT2P::Client do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
HEADER=<<END
|
39
|
-
HTTP/1.1 100 continue
|
40
|
-
HTTP/1.1 200 ok
|
41
|
-
a:A
|
42
|
-
b:B
|
43
|
-
b: B
|
44
|
-
c: C
|
45
|
-
C
|
46
|
-
d: D
|
47
|
-
d: D
|
48
|
-
D
|
49
|
-
END
|
50
|
-
|
51
38
|
require 'stringio'
|
52
39
|
|
53
40
|
describe HT2P::Header do
|
@@ -78,7 +65,19 @@ describe HT2P::Header do
|
|
78
65
|
end
|
79
66
|
|
80
67
|
it 'should perform `load` to load HTTP header' do
|
81
|
-
|
68
|
+
s =<<END
|
69
|
+
HTTP/1.1 100 continue
|
70
|
+
HTTP/1.1 200 ok
|
71
|
+
a:A
|
72
|
+
b:B
|
73
|
+
b: B
|
74
|
+
c: C
|
75
|
+
C
|
76
|
+
d: D
|
77
|
+
d: D
|
78
|
+
D
|
79
|
+
END
|
80
|
+
code, header = HT2P::Header.load(StringIO.new(s))
|
82
81
|
code.should == 200
|
83
82
|
header['a'].should == 'A'
|
84
83
|
header['b'].should == ['B', 'B']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ht2p
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jun Kikuchi
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-19 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -38,6 +38,7 @@ files:
|
|
38
38
|
- README.rdoc
|
39
39
|
- Rakefile
|
40
40
|
- VERSION
|
41
|
+
- ht2p.gemspec
|
41
42
|
- lib/ht2p.rb
|
42
43
|
- lib/ht2p/client.rb
|
43
44
|
- lib/ht2p/client/request.rb
|