kronk 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ === 1.1.2 / 2011-01-17
2
+
3
+ * Bugfixes:
4
+
5
+ * Added handling for invalid encoded strings in http responses (e.g. binary)
6
+
1
7
  === 1.1.1 / 2010-12-22
2
8
 
3
9
  * Enhancements:
@@ -20,7 +20,7 @@ require 'yaml'
20
20
  class Kronk
21
21
 
22
22
  # This gem's version.
23
- VERSION = '1.1.1'
23
+ VERSION = '1.1.2'
24
24
 
25
25
 
26
26
  require 'kronk/data_set'
@@ -65,7 +65,7 @@ class Kronk
65
65
  end
66
66
 
67
67
  resp
68
- rescue SocketError, Errno::ENOENT
68
+ rescue SocketError, Errno::ENOENT, Errno::ECONNREFUSED
69
69
  raise NotFoundError, "#{query} could not be found"
70
70
  end
71
71
 
@@ -231,7 +231,7 @@ class Kronk
231
231
  resp.extend Response::Helpers
232
232
 
233
233
  r_req, r_resp, r_bytes = Response.read_raw_from socket_io
234
- resp.instance_variable_set "@raw", r_resp
234
+ resp.raw = r_resp
235
235
 
236
236
  resp
237
237
  end
@@ -23,7 +23,7 @@ class Kronk
23
23
  resp.extend Helpers
24
24
 
25
25
  r_req, r_resp, r_bytes = read_raw_from socket_io
26
- resp.instance_variable_set "@raw", r_resp
26
+ resp.raw = r_resp
27
27
  resp.instance_variable_set "@read", true
28
28
  resp.instance_variable_set "@socket", true
29
29
 
@@ -70,6 +70,22 @@ class Kronk
70
70
 
71
71
  module Helpers
72
72
 
73
+ ##
74
+ # Assigns the raw http response value. Sets the encoding to ASCII-8BIT
75
+ # and replaces invalid characters with '?' if the encoding is invalid
76
+ # in Ruby 1.9.x
77
+
78
+ def raw= value
79
+ if value.respond_to?(:valid_encoding?) && !value.valid_encoding?
80
+ value.encode! "ASCII-8BIT", :invalid => :replace,
81
+ :undef => :replace,
82
+ :replace => "?"
83
+ end
84
+
85
+ @raw = value
86
+ end
87
+
88
+
73
89
  ##
74
90
  # Returns the raw http response.
75
91
 
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kronk
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 23
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 1
8
- - 1
9
- version: 1.1.1
9
+ - 2
10
+ version: 1.1.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Jeremie Castagna
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-12-22 00:00:00 -08:00
18
+ date: 2011-01-17 00:00:00 -08:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -25,6 +26,7 @@ dependencies:
25
26
  requirements:
26
27
  - - ~>
27
28
  - !ruby/object:Gem::Version
29
+ hash: 3
28
30
  segments:
29
31
  - 3
30
32
  - 1
@@ -40,6 +42,7 @@ dependencies:
40
42
  requirements:
41
43
  - - ~>
42
44
  - !ruby/object:Gem::Version
45
+ hash: 11
43
46
  segments:
44
47
  - 1
45
48
  - 2
@@ -54,6 +57,7 @@ dependencies:
54
57
  requirements:
55
58
  - - ~>
56
59
  - !ruby/object:Gem::Version
60
+ hash: 9
57
61
  segments:
58
62
  - 1
59
63
  - 3
@@ -68,6 +72,7 @@ dependencies:
68
72
  requirements:
69
73
  - - ~>
70
74
  - !ruby/object:Gem::Version
75
+ hash: 1
71
76
  segments:
72
77
  - 0
73
78
  - 5
@@ -82,6 +87,7 @@ dependencies:
82
87
  requirements:
83
88
  - - ">="
84
89
  - !ruby/object:Gem::Version
90
+ hash: 15
85
91
  segments:
86
92
  - 2
87
93
  - 0
@@ -97,6 +103,7 @@ dependencies:
97
103
  requirements:
98
104
  - - ~>
99
105
  - !ruby/object:Gem::Version
106
+ hash: 19
100
107
  segments:
101
108
  - 0
102
109
  - 3
@@ -112,6 +119,7 @@ dependencies:
112
119
  requirements:
113
120
  - - ~>
114
121
  - !ruby/object:Gem::Version
122
+ hash: 15
115
123
  segments:
116
124
  - 1
117
125
  - 0
@@ -126,6 +134,7 @@ dependencies:
126
134
  requirements:
127
135
  - - ">="
128
136
  - !ruby/object:Gem::Version
137
+ hash: 7
129
138
  segments:
130
139
  - 2
131
140
  - 0
@@ -141,6 +150,7 @@ dependencies:
141
150
  requirements:
142
151
  - - ~>
143
152
  - !ruby/object:Gem::Version
153
+ hash: 47
144
154
  segments:
145
155
  - 0
146
156
  - 9
@@ -156,6 +166,7 @@ dependencies:
156
166
  requirements:
157
167
  - - ">="
158
168
  - !ruby/object:Gem::Version
169
+ hash: 19
159
170
  segments:
160
171
  - 2
161
172
  - 6
@@ -218,7 +229,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
218
229
  requirements:
219
230
  - - ">="
220
231
  - !ruby/object:Gem::Version
221
- hash: -1939027826967097857
232
+ hash: 3
222
233
  segments:
223
234
  - 0
224
235
  version: "0"
@@ -227,6 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
238
  requirements:
228
239
  - - ">="
229
240
  - !ruby/object:Gem::Version
241
+ hash: 3
230
242
  segments:
231
243
  - 0
232
244
  version: "0"