curb 0.8.4 → 0.8.8

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.
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
5
- prerelease:
4
+ version: 0.8.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ross Bamford
@@ -10,7 +9,7 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-05-20 00:00:00.000000000 Z
12
+ date: 2015-04-08 00:00:00.000000000 Z
14
13
  dependencies: []
15
14
  description: Curb (probably CUrl-RuBy or something) provides Ruby-language bindings
16
15
  for the libcurl(3), a fully-featured client-side URL transfer library. cURL and
@@ -21,30 +20,30 @@ extensions:
21
20
  - ext/extconf.rb
22
21
  extra_rdoc_files:
23
22
  - LICENSE
24
- - README
23
+ - README.markdown
25
24
  files:
26
25
  - LICENSE
27
- - README
26
+ - README.markdown
28
27
  - Rakefile
29
28
  - doc.rb
30
- - ext/extconf.rb
31
- - lib/curb.rb
32
- - lib/curl/easy.rb
33
- - lib/curl/multi.rb
34
- - lib/curl.rb
35
29
  - ext/curb.c
36
- - ext/curb_easy.c
37
- - ext/curb_errors.c
38
- - ext/curb_multi.c
39
- - ext/curb_postfield.c
40
- - ext/curb_upload.c
41
30
  - ext/curb.h
31
+ - ext/curb_easy.c
42
32
  - ext/curb_easy.h
33
+ - ext/curb_errors.c
43
34
  - ext/curb_errors.h
44
35
  - ext/curb_macros.h
36
+ - ext/curb_multi.c
45
37
  - ext/curb_multi.h
38
+ - ext/curb_postfield.c
46
39
  - ext/curb_postfield.h
40
+ - ext/curb_upload.c
47
41
  - ext/curb_upload.h
42
+ - ext/extconf.rb
43
+ - lib/curb.rb
44
+ - lib/curl.rb
45
+ - lib/curl/easy.rb
46
+ - lib/curl/multi.rb
48
47
  - tests/alltests.rb
49
48
  - tests/bug_crash_on_debug.rb
50
49
  - tests/bug_crash_on_progress.rb
@@ -72,36 +71,29 @@ files:
72
71
  - tests/unittests.rb
73
72
  homepage: http://curb.rubyforge.org/
74
73
  licenses: []
74
+ metadata: {}
75
75
  post_install_message:
76
76
  rdoc_options:
77
- - --main
78
- - README
77
+ - "--main"
78
+ - README.markdown
79
79
  require_paths:
80
80
  - lib
81
81
  - ext
82
82
  required_ruby_version: !ruby/object:Gem::Requirement
83
- none: false
84
83
  requirements:
85
- - - ! '>='
84
+ - - ">="
86
85
  - !ruby/object:Gem::Version
87
86
  version: '0'
88
- segments:
89
- - 0
90
- hash: -243569426931689339
91
87
  required_rubygems_version: !ruby/object:Gem::Requirement
92
- none: false
93
88
  requirements:
94
- - - ! '>='
89
+ - - ">="
95
90
  - !ruby/object:Gem::Version
96
91
  version: '0'
97
- segments:
98
- - 0
99
- hash: -243569426931689339
100
92
  requirements: []
101
93
  rubyforge_project: curb
102
- rubygems_version: 1.8.24
94
+ rubygems_version: 2.4.5
103
95
  signing_key:
104
- specification_version: 3
96
+ specification_version: 4
105
97
  summary: Ruby libcurl bindings
106
98
  test_files:
107
99
  - tests/alltests.rb
data/README DELETED
@@ -1,194 +0,0 @@
1
- # Curb - Libcurl bindings for Ruby
2
-
3
- + [rubyforge rdoc](http://curb.rubyforge.org/)
4
- + [rubyforge project](http://rubyforge.org/projects/curb)
5
- + [github project](http://github.com/taf2/curb/tree/master)
6
-
7
- Curb (probably CUrl-RuBy or something) provides Ruby-language bindings for the
8
- libcurl(3), a fully-featured client-side URL transfer library.
9
- cURL and libcurl live at [http://curl.haxx.se/](http://curl.haxx.se/) .
10
-
11
- Curb is a work-in-progress, and currently only supports libcurl's 'easy' and 'multi' modes.
12
-
13
- ## License
14
-
15
- Curb is copyright (c)2006 Ross Bamford, and released under the terms of the
16
- Ruby license. See the LICENSE file for the gory details.
17
-
18
- ## You will need
19
-
20
- + A working Ruby installation (1.8+, tested with 1.8.6, 1.8.7, 1.9.1, and 1.9.2)
21
- + A working (lib)curl installation, with development stuff (7.5+, tested with 7.19.x)
22
- + A sane build environment (e.g. gcc, make)
23
-
24
- ## Installation...
25
-
26
- ... will usually be as simple as:
27
-
28
- $ gem install curb
29
-
30
- Or, if you downloaded the archive:
31
-
32
- $ rake install
33
-
34
- If you have a wierd setup, you might need extconf options. In this case, pass
35
- them like so:
36
-
37
- $ rake install EXTCONF_OPTS='--with-curl-dir=/path/to/libcurl --prefix=/what/ever'
38
-
39
- Curb is tested only on GNU/Linux x86 and Mac OSX - YMMV on other platforms.
40
- If you do use another platform and experience problems, or if you can
41
- expand on the above instructions, please report the issue at http://github.com/taf2/curb/issues
42
-
43
- On Ubuntu, the dependencies can be satisfied by installing the following packages:
44
-
45
- $ sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev
46
-
47
- Curb has fairly extensive RDoc comments in the source. You can build the
48
- documentation with:
49
-
50
- $ rake doc
51
-
52
- ## Usage & examples
53
-
54
- Curb provides two classes:
55
-
56
- + Curl::Easy - simple API, for day-to-day tasks.
57
- + Curl::Multi - more advanced API, for operating on multiple URLs simultaneously.
58
-
59
- ### Super simple API (less typing)
60
-
61
- http = Curl.get("http://www.google.com/")
62
- puts http.body_str
63
-
64
- http = Curl.post("http://www.google.com/", {:foo => "bar"})
65
- puts http.body_str
66
-
67
- http = Curl.get("http://www.google.com/") do|http|
68
- http.headers['Cookie'] = 'foo=1;bar=2'
69
- end
70
- puts http.body_str
71
-
72
- ### Simple fetch via HTTP:
73
-
74
- c = Curl::Easy.perform("http://www.google.co.uk")
75
- puts c.body_str
76
-
77
- Same thing, more manual:
78
-
79
- c = Curl::Easy.new("http://www.google.co.uk")
80
- c.perform
81
- puts c.body_str
82
-
83
- ### Additional config:
84
-
85
- Curl::Easy.perform("http://www.google.co.uk") do |curl|
86
- curl.headers["User-Agent"] = "myapp-0.0"
87
- curl.verbose = true
88
- end
89
-
90
- Same thing, more manual:
91
-
92
- c = Curl::Easy.new("http://www.google.co.uk") do |curl|
93
- curl.headers["User-Agent"] = "myapp-0.0"
94
- curl.verbose = true
95
- end
96
-
97
- c.perform
98
-
99
- ### HTTP basic authentication:
100
-
101
- c = Curl::Easy.new("http://github.com/")
102
- c.http_auth_types = :basic
103
- c.username = 'foo'
104
- c.password = 'bar'
105
- c.perform
106
-
107
- ### Supplying custom handlers:
108
-
109
- c = Curl::Easy.new("http://www.google.co.uk")
110
-
111
- c.on_body { |data| print(data) }
112
- c.on_header { |data| print(data) }
113
-
114
- c.perform
115
-
116
- ### Reusing Curls:
117
-
118
- c = Curl::Easy.new
119
-
120
- ["http://www.google.co.uk", "http://www.ruby-lang.org/"].map do |url|
121
- c.url = url
122
- c.perform
123
- c.body_str
124
- end
125
-
126
- ### HTTP POST form:
127
-
128
- c = Curl::Easy.http_post("http://my.rails.box/thing/create",
129
- Curl::PostField.content('thing[name]', 'box'),
130
- Curl::PostField.content('thing[type]', 'storage'))
131
-
132
- ### HTTP POST file upload:
133
-
134
- c = Curl::Easy.new("http://my.rails.box/files/upload")
135
- c.multipart_form_post = true
136
- c.http_post(Curl::PostField.file('thing[file]', 'myfile.rb'))
137
-
138
- ### Multi Interface (Basic HTTP GET):
139
-
140
- # make multiple GET requests
141
- easy_options = {:follow_location => true}
142
- multi_options = {:pipeline => true}
143
-
144
- Curl::Multi.get('url1','url2','url3','url4','url5', easy_options, multi_options) do|easy|
145
- # do something interesting with the easy response
146
- puts easy.last_effective_url
147
- end
148
-
149
- ### Multi Interface (Basic HTTP POST):
150
-
151
- # make multiple POST requests
152
- easy_options = {:follow_location => true, :multipart_form_post => true}
153
- multi_options = {:pipeline => true}
154
-
155
- url_fields = [
156
- { :url => 'url1', :post_fields => {'f1' => 'v1'} },
157
- { :url => 'url2', :post_fields => {'f1' => 'v1'} },
158
- { :url => 'url3', :post_fields => {'f1' => 'v1'} }
159
- ]
160
-
161
- Curl::Multi.post(url_fields, easy_options, multi_options) do|easy|
162
- # do something interesting with the easy response
163
- puts easy.last_effective_url
164
- end
165
-
166
- ### Multi Interface (Advanced):
167
-
168
- responses = {}
169
- requests = ["http://www.google.co.uk/", "http://www.ruby-lang.org/"]
170
- m = Curl::Multi.new
171
- # add a few easy handles
172
- requests.each do |url|
173
- responses[url] = ""
174
- c = Curl::Easy.new(url) do|curl|
175
- curl.follow_location = true
176
- curl.on_body{|data| responses[url] << data; data.size }
177
- curl.on_success {|easy| puts "success, add more easy handles" }
178
- end
179
- m.add(c)
180
- end
181
-
182
- m.perform do
183
- puts "idling... can do some work here"
184
- end
185
-
186
- requests.each do|url|
187
- puts responses[url]
188
- end
189
-
190
- ### Easy Callbacks
191
-
192
- on_success: is called when the response code is 20x
193
- on_failure: is called when the response code is not success, including redirects e.g. 30x
194
- on_complete: is called in all cases.