curb 0.7.12 → 0.7.13

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.
Files changed (5) hide show
  1. data/README +16 -3
  2. data/ext/curb.h +2 -2
  3. data/ext/curb_easy.c +6 -6
  4. data/tests/tc_curl_easy.rb +2 -2
  5. metadata +26 -40
data/README CHANGED
@@ -45,14 +45,19 @@ documentation with:
45
45
 
46
46
  $ rake doc
47
47
 
48
- ## Examples
48
+ ## Usage & examples
49
+
50
+ Curb provides two classes:
51
+
52
+ + Curl::Easy - simple API, for day-to-day tasks.
53
+ + Curl::Multi - more advanced API, for operating on multiple URLs simultaneously.
49
54
 
50
55
  ### Simple fetch via HTTP:
51
56
 
52
57
  c = Curl::Easy.perform("http://www.google.co.uk")
53
58
  puts c.body_str
54
59
 
55
- ### Same thing, more manual:
60
+ Same thing, more manual:
56
61
 
57
62
  c = Curl::Easy.new("http://www.google.co.uk")
58
63
  c.perform
@@ -65,7 +70,7 @@ documentation with:
65
70
  curl.verbose = true
66
71
  end
67
72
 
68
- ### Same thing, more manual:
73
+ Same thing, more manual:
69
74
 
70
75
  c = Curl::Easy.new("http://www.google.co.uk") do |curl|
71
76
  curl.headers["User-Agent"] = "myapp-0.0"
@@ -74,6 +79,14 @@ documentation with:
74
79
 
75
80
  c.perform
76
81
 
82
+ ### HTTP basic authentication:
83
+
84
+ c = Curl::Easy.new("http://github.com/")
85
+ c.http_auth_types = :basic
86
+ c.username = 'foo'
87
+ c.password = 'bar'
88
+ c.perform
89
+
77
90
  ### Supplying custom handlers:
78
91
 
79
92
  c = Curl::Easy.new("http://www.google.co.uk")
data/ext/curb.h CHANGED
@@ -20,12 +20,12 @@
20
20
  #include "curb_macros.h"
21
21
 
22
22
  // These should be managed from the Rake 'release' task.
23
- #define CURB_VERSION "0.7.12"
23
+ #define CURB_VERSION "0.7.13"
24
24
  #define CURB_VER_NUM 712
25
25
  #define CURB_VER_MAJ 0
26
26
  #define CURB_VER_MIN 7
27
27
  #define CURB_VER_MIC 1
28
- #define CURB_VER_PATCH 2
28
+ #define CURB_VER_PATCH 3
29
29
 
30
30
 
31
31
  // Maybe not yet defined in Ruby
@@ -1907,16 +1907,16 @@ VALUE ruby_curl_easy_setup( ruby_curl_easy *rbce ) {
1907
1907
  curl_easy_setopt(curl, CURLOPT_USERPWD, NULL);
1908
1908
  }
1909
1909
 
1910
- if (!rb_easy_nil("proxy_url")) {
1911
- curl_easy_setopt(curl, CURLOPT_PROXY, rb_easy_get_str("proxy_url"));
1912
- } else {
1910
+ if (rb_easy_nil("proxy_url")) {
1913
1911
  curl_easy_setopt(curl, CURLOPT_PROXY, NULL);
1912
+ } else {
1913
+ curl_easy_setopt(curl, CURLOPT_PROXY, rb_easy_get_str("proxy_url"));
1914
1914
  }
1915
1915
 
1916
- if (!rb_easy_nil("proxypwd")) {
1917
- curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, rb_easy_get_str("proxy_pwd"));
1918
- } else {
1916
+ if (rb_easy_nil("proxypwd")) {
1919
1917
  curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, NULL);
1918
+ } else {
1919
+ curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, rb_easy_get_str("proxypwd"));
1920
1920
  }
1921
1921
 
1922
1922
  // body/header procs
@@ -224,7 +224,7 @@ class TestCurbCurlEasy < Test::Unit::TestCase
224
224
 
225
225
  assert_equal $TEST_URL, c.url
226
226
  assert_equal "http://some.proxy", c.proxy_url
227
-
227
+
228
228
  c.proxy_url = nil
229
229
  assert_equal $TEST_URL, c.url
230
230
  assert_nil c.proxy_url
@@ -566,7 +566,7 @@ class TestCurbCurlEasy < Test::Unit::TestCase
566
566
  def test_post_remote
567
567
  curl = Curl::Easy.new(TestServlet.url)
568
568
  curl.http_post([Curl::PostField.content('document_id', 5)])
569
- assert_equal "POST\ndocument%5Fid=5", curl.body_str
569
+ assert_equal "POST\ndocument_id=5", curl.unescape(curl.body_str)
570
570
  end
571
571
 
572
572
  def test_post_remote_is_easy_handle
metadata CHANGED
@@ -1,35 +1,29 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: curb
3
- version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 7
9
- - 12
10
- version: 0.7.12
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.13
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Ross Bamford
14
9
  - Todd A. Fisher
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2011-02-23 00:00:00 -05:00
13
+ date: 2011-03-17 00:00:00.000000000 -04:00
20
14
  default_executable:
21
15
  dependencies: []
22
-
23
- description: Curb (probably CUrl-RuBy or something) provides Ruby-language bindings for the libcurl(3), a fully-featured client-side URL transfer library. cURL and libcurl live at http://curl.haxx.se/
16
+ description: Curb (probably CUrl-RuBy or something) provides Ruby-language bindings
17
+ for the libcurl(3), a fully-featured client-side URL transfer library. cURL and
18
+ libcurl live at http://curl.haxx.se/
24
19
  email: todd.fisher@gmail.com
25
20
  executables: []
26
-
27
- extensions:
21
+ extensions:
28
22
  - ext/extconf.rb
29
- extra_rdoc_files:
23
+ extra_rdoc_files:
30
24
  - LICENSE
31
25
  - README
32
- files:
26
+ files:
33
27
  - LICENSE
34
28
  - README
35
29
  - Rakefile
@@ -72,40 +66,32 @@ files:
72
66
  has_rdoc: true
73
67
  homepage: http://curb.rubyforge.org/
74
68
  licenses: []
75
-
76
69
  post_install_message:
77
- rdoc_options:
70
+ rdoc_options:
78
71
  - --main
79
72
  - README
80
- require_paths:
73
+ require_paths:
81
74
  - lib
82
75
  - ext
83
- required_ruby_version: !ruby/object:Gem::Requirement
76
+ required_ruby_version: !ruby/object:Gem::Requirement
84
77
  none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
90
- - 0
91
- version: "0"
92
- required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
83
  none: false
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- hash: 3
98
- segments:
99
- - 0
100
- version: "0"
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
101
88
  requirements: []
102
-
103
89
  rubyforge_project: curb
104
- rubygems_version: 1.3.7
90
+ rubygems_version: 1.6.2
105
91
  signing_key:
106
92
  specification_version: 3
107
93
  summary: Ruby libcurl bindings
108
- test_files:
94
+ test_files:
109
95
  - tests/alltests.rb
110
96
  - tests/bug_curb_easy_blocks_ruby_threads.rb
111
97
  - tests/bug_curb_easy_post_with_string_no_content_length_header.rb