curb 0.8.4 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
data/ext/curb.c CHANGED
@@ -951,6 +951,19 @@ void Init_curb_core() {
951
951
  CURB_DEFINE(CURLOPT_TELNETOPTIONS);
952
952
  #endif
953
953
 
954
+ #if HAVE_CURLOPT_GSSAPI_DELEGATION
955
+ CURB_DEFINE(CURLOPT_GSSAPI_DELEGATION);
956
+ #endif
957
+
958
+ #if HAVE_CURLGSSAPI_DELEGATION_FLAG
959
+ CURB_DEFINE(CURLGSSAPI_DELEGATION_FLAG);
960
+ #endif
961
+
962
+ #if HAVE_CURLGSSAPI_DELEGATION_POLICY_FLAG
963
+ CURB_DEFINE(CURLGSSAPI_DELEGATION_POLICY_FLAG);
964
+ #endif
965
+
966
+
954
967
  rb_define_const(mCurl, "HTTP_1_1", LONG2NUM(CURL_HTTP_VERSION_1_1));
955
968
  rb_define_const(mCurl, "HTTP_1_0", LONG2NUM(CURL_HTTP_VERSION_1_0));
956
969
  rb_define_const(mCurl, "HTTP_NONE", LONG2NUM(CURL_HTTP_VERSION_NONE));
data/ext/curb.h CHANGED
@@ -20,11 +20,11 @@
20
20
  #include "curb_macros.h"
21
21
 
22
22
  // These should be managed from the Rake 'release' task.
23
- #define CURB_VERSION "0.8.4"
24
- #define CURB_VER_NUM 804
23
+ #define CURB_VERSION "0.8.5"
24
+ #define CURB_VER_NUM 805
25
25
  #define CURB_VER_MAJ 0
26
26
  #define CURB_VER_MIN 8
27
- #define CURB_VER_MIC 4
27
+ #define CURB_VER_MIC 5
28
28
  #define CURB_VER_PATCH 0
29
29
 
30
30
 
@@ -2578,6 +2578,29 @@ static VALUE ruby_curl_easy_connect_time_get(VALUE self) {
2578
2578
  return rb_float_new(time);
2579
2579
  }
2580
2580
 
2581
+ /*
2582
+ * call-seq:
2583
+ * easy.app_connect_time => float
2584
+ *
2585
+ * Retrieve the time, in seconds, it took from the start until the SSL/SSH
2586
+ * connect/handshake to the remote host was completed. This time is most often
2587
+ * very near to the pre transfer time, except for cases such as HTTP
2588
+ * pippelining where the pretransfer time can be delayed due to waits in line
2589
+ * for the pipeline and more.
2590
+ */
2591
+ #if defined(HAVE_CURLINFO_APPCONNECT_TIME)
2592
+ static VALUE ruby_curl_easy_app_connect_time_get(VALUE self) {
2593
+ ruby_curl_easy *rbce;
2594
+ double time;
2595
+
2596
+ Data_Get_Struct(self, ruby_curl_easy, rbce);
2597
+ curl_easy_getinfo(rbce->curl, CURLINFO_APPCONNECT_TIME, &time);
2598
+
2599
+ return rb_float_new(time);
2600
+ }
2601
+ #endif
2602
+
2603
+
2581
2604
  /*
2582
2605
  * call-seq:
2583
2606
  * easy.pre_transfer_time => float
@@ -3112,6 +3135,11 @@ static VALUE ruby_curl_easy_set_opt(VALUE self, VALUE opt, VALUE val) {
3112
3135
  case CURLOPT_FAILONERROR: {
3113
3136
  curl_easy_setopt(rbce->curl, CURLOPT_FAILONERROR, FIX2LONG(val));
3114
3137
  } break;
3138
+ #if HAVE_CURLOPT_GSSAPI_DELEGATION
3139
+ case CURLOPT_GSSAPI_DELEGATION: {
3140
+ curl_easy_setopt(rbce->curl, CURLOPT_GSSAPI_DELEGATION, FIX2LONG(val));
3141
+ } break;
3142
+ #endif
3115
3143
  default:
3116
3144
  break;
3117
3145
  }
@@ -3364,6 +3392,9 @@ void init_curb_easy() {
3364
3392
  rb_define_method(cCurlEasy, "total_time", ruby_curl_easy_total_time_get, 0);
3365
3393
  rb_define_method(cCurlEasy, "name_lookup_time", ruby_curl_easy_name_lookup_time_get, 0);
3366
3394
  rb_define_method(cCurlEasy, "connect_time", ruby_curl_easy_connect_time_get, 0);
3395
+ #if defined(HAVE_CURLINFO_APPCONNECT_TIME)
3396
+ rb_define_method(cCurlEasy, "app_connect_time", ruby_curl_easy_app_connect_time_get, 0);
3397
+ #endif
3367
3398
  rb_define_method(cCurlEasy, "pre_transfer_time", ruby_curl_easy_pre_transfer_time_get, 0);
3368
3399
  rb_define_method(cCurlEasy, "start_transfer_time", ruby_curl_easy_start_transfer_time_get, 0);
3369
3400
  rb_define_method(cCurlEasy, "redirect_time", ruby_curl_easy_redirect_time_get, 0);
@@ -59,6 +59,7 @@ def have_constant(name)
59
59
  end
60
60
  end
61
61
 
62
+ have_constant "curlinfo_appconnect_time"
62
63
  have_constant "curlinfo_redirect_time"
63
64
  have_constant "curlinfo_response_code"
64
65
  have_constant "curlinfo_filetime"
@@ -351,6 +352,11 @@ have_constant "curle_not_built_in"
351
352
 
352
353
  have_constant "curle_obsolete" # removed in 7.24 ?
353
354
 
355
+ # gssapi/spnego delegation related constants
356
+ have_constant "curlopt_gssapi_delegation"
357
+ have_constant "curlgssapi_delegation_policy_flag"
358
+ have_constant "curlgssapi_delegation_flag"
359
+
354
360
  if try_compile('int main() { return 0; }','-Wall')
355
361
  $CFLAGS << ' -Wall'
356
362
  end
@@ -8,6 +8,7 @@ module Curl
8
8
 
9
9
  def self.http(verb, url, post_body=nil, put_data=nil, &block)
10
10
  handle = Thread.current[:curb_curl] ||= Curl::Easy.new
11
+ handle.reset
11
12
  handle.url = url
12
13
  handle.post_body = post_body if post_body
13
14
  handle.put_data = put_data if put_data
@@ -3,6 +3,8 @@ module Curl
3
3
 
4
4
  alias post http_post
5
5
  alias put http_put
6
+ alias body body_str
7
+ alias head header_str
6
8
 
7
9
  #
8
10
  # call-seq:
@@ -11,7 +11,9 @@ class TestCurbCurlEasy < Test::Unit::TestCase
11
11
  5.times do
12
12
  c = Curl.get($TEST_URL)
13
13
  assert_match(/^# DO NOT REMOVE THIS COMMENT/, c.body_str)
14
+ assert_match(/^# DO NOT REMOVE THIS COMMENT/, c.body)
14
15
  assert_equal "", c.header_str
16
+ assert_equal "", c.head
15
17
  end
16
18
  end
17
19
  end
@@ -22,6 +24,7 @@ class TestCurbCurlEasy < Test::Unit::TestCase
22
24
  def test_class_perform_01
23
25
  assert_instance_of Curl::Easy, c = Curl::Easy.perform($TEST_URL)
24
26
  assert_match(/^# DO NOT REMOVE THIS COMMENT/, c.body_str)
27
+ assert_match(/^# DO NOT REMOVE THIS COMMENT/, c.body)
25
28
  assert_equal "", c.header_str
26
29
  end
27
30
 
@@ -719,7 +722,9 @@ class TestCurbCurlEasy < Test::Unit::TestCase
719
722
  assert curl.http_put("message")
720
723
  assert_match /^PUT/, curl.body_str
721
724
  assert_match /message$/, curl.body_str
725
+ assert_match /message$/, curl.body
722
726
  assert_match /application\/json/, curl.header_str
727
+ assert_match /application\/json/, curl.head
723
728
  end
724
729
 
725
730
  def test_put_data
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.8.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-20 00:00:00.000000000 Z
13
+ date: 2013-06-05 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Curb (probably CUrl-RuBy or something) provides Ruby-language bindings
16
16
  for the libcurl(3), a fully-featured client-side URL transfer library. cURL and
@@ -51,7 +51,6 @@ files:
51
51
  - tests/bug_curb_easy_blocks_ruby_threads.rb
52
52
  - tests/bug_curb_easy_post_with_string_no_content_length_header.rb
53
53
  - tests/bug_instance_post_differs_from_class_post.rb
54
- - tests/bug_issue102.rb
55
54
  - tests/bug_multi_segfault.rb
56
55
  - tests/bug_postfields_crash.rb
57
56
  - tests/bug_postfields_crash2.rb
@@ -85,18 +84,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
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
88
  none: false
93
89
  requirements:
94
90
  - - ! '>='
95
91
  - !ruby/object:Gem::Version
96
92
  version: '0'
97
- segments:
98
- - 0
99
- hash: -243569426931689339
100
93
  requirements: []
101
94
  rubyforge_project: curb
102
95
  rubygems_version: 1.8.24
@@ -110,7 +103,6 @@ test_files:
110
103
  - tests/bug_curb_easy_blocks_ruby_threads.rb
111
104
  - tests/bug_curb_easy_post_with_string_no_content_length_header.rb
112
105
  - tests/bug_instance_post_differs_from_class_post.rb
113
- - tests/bug_issue102.rb
114
106
  - tests/bug_multi_segfault.rb
115
107
  - tests/bug_postfields_crash.rb
116
108
  - tests/bug_postfields_crash2.rb
@@ -129,3 +121,4 @@ test_files:
129
121
  - tests/timeout.rb
130
122
  - tests/timeout_server.rb
131
123
  - tests/unittests.rb
124
+ has_rdoc: true
@@ -1,17 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
2
-
3
- class BugIssue102 < Test::Unit::TestCase
4
-
5
- def test_interface
6
- test = "https://api.twitter.com/1/users/show.json?screen_name=TwitterAPI&include_entities=true"
7
- ip = "192.168.1.61"
8
-
9
- c = Curl::Easy.new do |curl|
10
- curl.url = test
11
- curl.interface = ip
12
- end
13
-
14
- c.perform
15
- end
16
-
17
- end