ethon 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
1
+ ## 0.0.2
2
+
3
+ ### Resolved Issues
4
+
5
+ * Add libcurl.so.4 to ffi_lib in order to load correct lib on Debian.
6
+ * Escape zero bytes.
7
+
8
+ ## 0.0.1 Initial version
data/Gemfile CHANGED
@@ -1,6 +1,3 @@
1
1
  source :rubygems
2
- gemspec
3
2
 
4
- gem "rake"
5
- gem "patron"
6
- gem "curb"
3
+ gemspec
@@ -420,7 +420,7 @@ module Ethon
420
420
  callback :callback, [:pointer, :size_t, :size_t, :pointer], :size_t
421
421
 
422
422
  ffi_lib_flags :now, :global
423
- ffi_lib 'libcurl'
423
+ ffi_lib ['libcurl', 'libcurl.so.4']
424
424
 
425
425
  attach_function :global_init, :curl_global_init, [:long], :int
426
426
 
@@ -58,7 +58,7 @@ module Ethon
58
58
  #
59
59
  # @return [ String ] The composed header.
60
60
  def compose_header(key, value)
61
- "#{key}:#{value.to_s.gsub(0.chr, '\\\0')}"
61
+ Util.escape_zero_byte("#{key}:#{value}")
62
62
  end
63
63
  end
64
64
  end
@@ -36,7 +36,7 @@ module Ethon
36
36
  #
37
37
  # @return [ Class ] The action class.
38
38
  def fabricate(action_name)
39
- eval("#{action_name.capitalize}")
39
+ eval("#{action_name.to_s.capitalize}")
40
40
  end
41
41
  end
42
42
  end
@@ -6,6 +6,8 @@ module Ethon
6
6
  # for more information.
7
7
  module Informations
8
8
 
9
+ # Holds available informations and their type, which is needed to
10
+ # request the informations from libcurl.
9
11
  AVAILABLE_INFORMATIONS = {
10
12
  # Return the available http auth methods.
11
13
  :httpauth_avail => :long,
@@ -96,6 +96,8 @@ module Ethon
96
96
  self.class.enum_options[option][value]
97
97
  elsif self.class.int_options.include?(option)
98
98
  value.to_i
99
+ elsif value.is_a?(::String)
100
+ Util.escape_zero_byte(value)
99
101
  else
100
102
  value
101
103
  end
@@ -16,9 +16,9 @@ module Ethon
16
16
  when Array
17
17
  v.each { |x| pairs << [key, x] }
18
18
  when File, Tempfile
19
- pairs << [key, file_info(v)]
19
+ pairs << [Util.escape_zero_byte(key), file_info(v)]
20
20
  else
21
- pairs << [key, v]
21
+ pairs << [Util.escape_zero_byte(key), Util.escape_zero_byte(v)]
22
22
  end
23
23
  end
24
24
  end
@@ -36,6 +36,11 @@ module Ethon
36
36
  File.expand_path(file.path)
37
37
  ]
38
38
  end
39
+
40
+ def self.escape_zero_byte(value)
41
+ return value unless value.to_s.include?(0.chr)
42
+ value.to_s.gsub(0.chr, '\\\0')
43
+ end
39
44
  end
40
45
  end
41
46
  end
@@ -1,5 +1,5 @@
1
1
  module Ethon
2
2
 
3
3
  # Ethon version.
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ethon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-20 00:00:00.000000000 Z
12
+ date: 2012-06-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
@@ -139,6 +139,38 @@ dependencies:
139
139
  - - ~>
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0.6'
142
+ - !ruby/object:Gem::Dependency
143
+ name: patron
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
149
+ version: '0.4'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ~>
156
+ - !ruby/object:Gem::Version
157
+ version: '0.4'
158
+ - !ruby/object:Gem::Dependency
159
+ name: curb
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ~>
164
+ - !ruby/object:Gem::Version
165
+ version: 0.8.0
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ~>
172
+ - !ruby/object:Gem::Version
173
+ version: 0.8.0
142
174
  description: Very lightweight libcurl wrapper.
143
175
  email:
144
176
  - me@hans.io
@@ -201,7 +233,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
201
233
  version: '0'
202
234
  segments:
203
235
  - 0
204
- hash: -4048384056724778314
236
+ hash: 4039343008781597148
205
237
  required_rubygems_version: !ruby/object:Gem::Requirement
206
238
  none: false
207
239
  requirements: