curb 0.7.7.1 → 0.7.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.
- data/ext/curb.c +8 -0
- data/ext/curb.h +4 -4
- data/ext/curb_easy.c +24 -7
- data/ext/curb_multi.c +7 -0
- data/ext/curb_postfield.c +56 -45
- data/ext/curb_upload.c +1 -1
- data/ext/extconf.rb +5 -0
- data/tests/helper.rb +4 -0
- data/tests/tc_curl_easy.rb +52 -0
- data/tests/tc_curl_multi.rb +2 -2
- data/tests/tc_curl_postfield.rb +3 -1
- metadata +33 -34
data/ext/curb.c
CHANGED
@@ -255,9 +255,17 @@ void Init_curb_core() {
|
|
255
255
|
/* Passed to on_debug handler to indicate that the data is protocol data sent to the peer. */
|
256
256
|
rb_define_const(mCurl, "CURLINFO_DATA_OUT", INT2FIX(CURLINFO_DATA_OUT));
|
257
257
|
|
258
|
+
#ifdef HAVE_CURLFTPMETHOD_MULTICWD
|
258
259
|
rb_define_const(mCurl, "CURL_MULTICWD", INT2FIX(CURLFTPMETHOD_MULTICWD));
|
260
|
+
#endif
|
261
|
+
|
262
|
+
#ifdef HAVE_CURLFTPMETHOD_NOCWD
|
259
263
|
rb_define_const(mCurl, "CURL_NOCWD", INT2FIX(CURLFTPMETHOD_NOCWD));
|
264
|
+
#endif
|
265
|
+
|
266
|
+
#ifdef HAVE_CURLFTPMETHOD_SINGLECWD
|
260
267
|
rb_define_const(mCurl, "CURL_SINGLECWD", INT2FIX(CURLFTPMETHOD_SINGLECWD));
|
268
|
+
#endif
|
261
269
|
|
262
270
|
/* When passed to Curl::Easy#proxy_type , indicates that the proxy is an HTTP proxy. (libcurl >= 7.10) */
|
263
271
|
#ifdef HAVE_CURLPROXY_HTTP
|
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.
|
24
|
-
#define CURB_VER_NUM
|
23
|
+
#define CURB_VERSION "0.7.8"
|
24
|
+
#define CURB_VER_NUM 708
|
25
25
|
#define CURB_VER_MAJ 0
|
26
26
|
#define CURB_VER_MIN 7
|
27
|
-
#define CURB_VER_MIC
|
28
|
-
#define CURB_VER_PATCH
|
27
|
+
#define CURB_VER_MIC 8
|
28
|
+
#define CURB_VER_PATCH 0
|
29
29
|
|
30
30
|
|
31
31
|
// Maybe not yet defined in Ruby
|
data/ext/curb_easy.c
CHANGED
@@ -57,7 +57,7 @@ static size_t read_data_handler(void *ptr,
|
|
57
57
|
return 0;
|
58
58
|
}
|
59
59
|
}
|
60
|
-
else {
|
60
|
+
else if (rb_respond_to(stream, rb_intern("to_s"))) {
|
61
61
|
ruby_curl_upload *rbcu;
|
62
62
|
VALUE str;
|
63
63
|
size_t len;
|
@@ -68,6 +68,7 @@ static size_t read_data_handler(void *ptr,
|
|
68
68
|
len = RSTRING_LEN(str);
|
69
69
|
remaining = len - rbcu->offset;
|
70
70
|
str_ptr = RSTRING_PTR(str);
|
71
|
+
|
71
72
|
if( remaining < read_bytes ) {
|
72
73
|
if( remaining > 0 ) {
|
73
74
|
memcpy(ptr, str_ptr+rbcu->offset, remaining);
|
@@ -86,7 +87,9 @@ static size_t read_data_handler(void *ptr,
|
|
86
87
|
}
|
87
88
|
return read_bytes;
|
88
89
|
}
|
89
|
-
|
90
|
+
else {
|
91
|
+
return 0;
|
92
|
+
}
|
90
93
|
}
|
91
94
|
|
92
95
|
static size_t proc_data_handler(char *stream,
|
@@ -412,7 +415,7 @@ static VALUE ruby_curl_easy_proxy_url_get(VALUE self) {
|
|
412
415
|
* To remove a standard header (this is useful when removing libcurls default
|
413
416
|
* 'Expect: 100-Continue' header when using HTTP form posts):
|
414
417
|
*
|
415
|
-
* easy.headers["Expect
|
418
|
+
* easy.headers["Expect"] = ''
|
416
419
|
*
|
417
420
|
* Anything passed to libcurl as a header will be converted to a string during
|
418
421
|
* the perform step.
|
@@ -807,10 +810,14 @@ static VALUE ruby_curl_easy_put_data_set(VALUE self, VALUE data) {
|
|
807
810
|
}
|
808
811
|
}
|
809
812
|
|
813
|
+
// exit fast if the payload is empty
|
814
|
+
if (NIL_P(data)) { return data; }
|
815
|
+
|
810
816
|
headers = rb_easy_get("headers");
|
811
817
|
if( headers == Qnil ) {
|
812
818
|
headers = rb_hash_new();
|
813
819
|
}
|
820
|
+
|
814
821
|
if (rb_respond_to(data, rb_intern("read"))) {
|
815
822
|
VALUE stat = rb_funcall(data, rb_intern("stat"), 0);
|
816
823
|
if( stat ) {
|
@@ -835,7 +842,7 @@ static VALUE ruby_curl_easy_put_data_set(VALUE self, VALUE data) {
|
|
835
842
|
rb_raise(rb_eRuntimeError, "PUT data must respond to read or to_s");
|
836
843
|
}
|
837
844
|
rb_easy_set("headers",headers);
|
838
|
-
|
845
|
+
|
839
846
|
// if we made it this far, all should be well.
|
840
847
|
return data;
|
841
848
|
}
|
@@ -2162,7 +2169,17 @@ static VALUE ruby_curl_easy_perform_delete(VALUE self) {
|
|
2162
2169
|
* This method always returns true or raises an exception (defined under Curl::Err) on error.
|
2163
2170
|
*/
|
2164
2171
|
static VALUE ruby_curl_easy_perform_verb(VALUE self, VALUE verb) {
|
2165
|
-
|
2172
|
+
VALUE str_verb;
|
2173
|
+
if (rb_type(verb) == T_STRING) {
|
2174
|
+
return ruby_curl_easy_perform_verb_str(self, RSTRING_PTR(verb));
|
2175
|
+
}
|
2176
|
+
else if (rb_respond_to(verb,rb_intern("to_s"))) {
|
2177
|
+
str_verb = rb_funcall(verb, rb_intern("to_s"), 0);
|
2178
|
+
return ruby_curl_easy_perform_verb_str(self, RSTRING_PTR(str_verb));
|
2179
|
+
}
|
2180
|
+
else {
|
2181
|
+
rb_raise(rb_eRuntimeError, "Invalid HTTP VERB, must response to 'to_s'");
|
2182
|
+
}
|
2166
2183
|
}
|
2167
2184
|
|
2168
2185
|
/*
|
@@ -2995,10 +3012,10 @@ static VALUE ruby_curl_easy_inspect(VALUE self) {
|
|
2995
3012
|
/* "#<Net::HTTP http://www.google.com/:80 open=false>" */
|
2996
3013
|
memcpy(buf,"#<Curl::Easy ", 13);
|
2997
3014
|
memcpy(buf+13,RSTRING_PTR(url), (len - 13));
|
2998
|
-
buf[len
|
3015
|
+
buf[len++] = '>';
|
2999
3016
|
return rb_str_new(buf,len);
|
3000
3017
|
}
|
3001
|
-
return rb_str_new2("#<Curl::Easy");
|
3018
|
+
return rb_str_new2("#<Curl::Easy>");
|
3002
3019
|
}
|
3003
3020
|
|
3004
3021
|
|
data/ext/curb_multi.c
CHANGED
@@ -332,6 +332,12 @@ static void rb_curl_mutli_handle_complete(VALUE self, CURL *easy_handle, int res
|
|
332
332
|
|
333
333
|
ruby_curl_multi_remove( self, easy );
|
334
334
|
|
335
|
+
/* after running a request cleanup the headers, these are set before each request */
|
336
|
+
if (rbce->curl_headers) {
|
337
|
+
curl_slist_free_all(rbce->curl_headers);
|
338
|
+
rbce->curl_headers = NULL;
|
339
|
+
}
|
340
|
+
|
335
341
|
if (ecode != 0) {
|
336
342
|
raise_curl_easy_error_exception(ecode);
|
337
343
|
}
|
@@ -356,6 +362,7 @@ static void rb_curl_mutli_handle_complete(VALUE self, CURL *easy_handle, int res
|
|
356
362
|
(response_code >= 300 && response_code <= 999)) {
|
357
363
|
rb_funcall( rb_easy_get("failure_proc"), idCall, 2, easy, rb_curl_easy_error(result) );
|
358
364
|
}
|
365
|
+
|
359
366
|
}
|
360
367
|
|
361
368
|
static void rb_curl_multi_read_info(VALUE self, CURLM *multi_handle) {
|
data/ext/curb_postfield.c
CHANGED
@@ -235,7 +235,7 @@ static VALUE ruby_curl_postfield_new_content(int argc, VALUE *argv, VALUE klass)
|
|
235
235
|
rbcpf->local_file = Qnil;
|
236
236
|
rbcpf->remote_file = Qnil;
|
237
237
|
rbcpf->buffer_str = Qnil;
|
238
|
-
|
238
|
+
|
239
239
|
return Data_Wrap_Struct(cCurlPostField, curl_postfield_mark, curl_postfield_free, rbcpf);
|
240
240
|
}
|
241
241
|
|
@@ -253,11 +253,11 @@ static VALUE ruby_curl_postfield_new_content(int argc, VALUE *argv, VALUE klass)
|
|
253
253
|
* data.
|
254
254
|
*/
|
255
255
|
static VALUE ruby_curl_postfield_new_file(int argc, VALUE *argv, VALUE klass) {
|
256
|
-
// TODO needs to handle content-type too
|
256
|
+
// TODO needs to handle content-type too
|
257
257
|
ruby_curl_postfield *rbcpf = ALLOC(ruby_curl_postfield);
|
258
|
-
|
258
|
+
|
259
259
|
rb_scan_args(argc, argv, "21&", &rbcpf->name, &rbcpf->local_file, &rbcpf->remote_file, &rbcpf->content_proc);
|
260
|
-
|
260
|
+
|
261
261
|
// special handling if theres a block, second arg is actually remote name.
|
262
262
|
if (rbcpf->content_proc != Qnil) {
|
263
263
|
if (rbcpf->local_file != Qnil) {
|
@@ -267,7 +267,7 @@ static VALUE ruby_curl_postfield_new_file(int argc, VALUE *argv, VALUE klass) {
|
|
267
267
|
// (correct block call form)
|
268
268
|
rbcpf->remote_file = rbcpf->local_file;
|
269
269
|
}
|
270
|
-
|
270
|
+
|
271
271
|
// Shouldn't get a local file, so can ignore it.
|
272
272
|
rbcpf->local_file = Qnil;
|
273
273
|
}
|
@@ -275,8 +275,8 @@ static VALUE ruby_curl_postfield_new_file(int argc, VALUE *argv, VALUE klass) {
|
|
275
275
|
if (rbcpf->remote_file == Qnil) {
|
276
276
|
rbcpf->remote_file = rbcpf->local_file;
|
277
277
|
}
|
278
|
-
}
|
279
|
-
|
278
|
+
}
|
279
|
+
|
280
280
|
/* assoc objects */
|
281
281
|
rbcpf->content = Qnil;
|
282
282
|
rbcpf->content_type = Qnil;
|
@@ -424,55 +424,66 @@ static VALUE ruby_curl_postfield_to_str(VALUE self) {
|
|
424
424
|
// FIXME This is using the deprecated curl_escape func
|
425
425
|
ruby_curl_postfield *rbcpf;
|
426
426
|
VALUE result = Qnil;
|
427
|
+
VALUE name = Qnil;
|
427
428
|
|
428
429
|
Data_Get_Struct(self, ruby_curl_postfield, rbcpf);
|
429
430
|
|
430
|
-
|
431
|
-
|
431
|
+
if (rbcpf->name != Qnil) {
|
432
|
+
name = rbcpf->name;
|
433
|
+
if (rb_type(name) == T_STRING) {
|
434
|
+
name = rbcpf->name;
|
435
|
+
} else if (rb_respond_to(name,rb_intern("to_s"))) {
|
436
|
+
name = rb_funcall(name, rb_intern("to_s"), 0);
|
437
|
+
}
|
438
|
+
else {
|
439
|
+
name = Qnil; // we can't handle this object
|
440
|
+
}
|
441
|
+
}
|
442
|
+
if (name == Qnil) {
|
443
|
+
rb_raise(eCurlErrInvalidPostField, "Cannot convert unnamed field to string %s:%d, make sure your field name responds_to :to_s", __FILE__, __LINE__);
|
444
|
+
}
|
432
445
|
|
433
|
-
|
446
|
+
char *tmpchrs = curl_escape(StringValuePtr(name), RSTRING_LEN(name));
|
447
|
+
|
448
|
+
if (!tmpchrs) {
|
449
|
+
rb_raise(eCurlErrInvalidPostField, "Failed to url-encode name `%s'", tmpchrs);
|
450
|
+
} else {
|
451
|
+
VALUE tmpcontent = Qnil;
|
452
|
+
VALUE escd_name = rb_str_new2(tmpchrs);
|
453
|
+
curl_free(tmpchrs);
|
434
454
|
|
455
|
+
if (rbcpf->content_proc != Qnil) {
|
456
|
+
tmpcontent = rb_funcall(rbcpf->content_proc, idCall, 1, self);
|
457
|
+
} else if (rbcpf->content != Qnil) {
|
458
|
+
tmpcontent = rbcpf->content;
|
459
|
+
} else if (rbcpf->local_file != Qnil) {
|
460
|
+
tmpcontent = rbcpf->local_file;
|
461
|
+
} else if (rbcpf->remote_file != Qnil) {
|
462
|
+
tmpcontent = rbcpf->remote_file;
|
463
|
+
} else {
|
464
|
+
tmpcontent = rb_str_new2("");
|
465
|
+
}
|
466
|
+
if (TYPE(tmpcontent) != T_STRING) {
|
467
|
+
if (rb_respond_to(tmpcontent, rb_intern("to_s"))) {
|
468
|
+
tmpcontent = rb_funcall(tmpcontent, rb_intern("to_s"), 0);
|
469
|
+
}
|
470
|
+
else {
|
471
|
+
rb_raise(rb_eRuntimeError, "postfield(%s) is not a string and does not respond_to to_s", RSTRING_PTR(escd_name) );
|
472
|
+
}
|
473
|
+
}
|
474
|
+
//fprintf(stderr, "encoding content: %ld - %s\n", RSTRING_LEN(tmpcontent), RSTRING_PTR(tmpcontent) );
|
475
|
+
tmpchrs = curl_escape(RSTRING_PTR(tmpcontent), RSTRING_LEN(tmpcontent));
|
435
476
|
if (!tmpchrs) {
|
436
|
-
rb_raise(eCurlErrInvalidPostField, "Failed to url-encode
|
477
|
+
rb_raise(eCurlErrInvalidPostField, "Failed to url-encode content `%s'", tmpchrs);
|
437
478
|
} else {
|
438
|
-
VALUE
|
439
|
-
VALUE escd_name = rb_str_new2(tmpchrs);
|
479
|
+
VALUE escd_content = rb_str_new2(tmpchrs);
|
440
480
|
curl_free(tmpchrs);
|
441
481
|
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
tmpcontent = rbcpf->content;
|
446
|
-
} else {
|
447
|
-
tmpcontent = rb_str_new2("");
|
448
|
-
}
|
449
|
-
if (TYPE(tmpcontent) != T_STRING) {
|
450
|
-
if (rb_respond_to(tmpcontent, rb_intern("to_s"))) {
|
451
|
-
tmpcontent = rb_funcall(tmpcontent, rb_intern("to_s"), 0);
|
452
|
-
}
|
453
|
-
else {
|
454
|
-
rb_raise(rb_eRuntimeError, "postfield(%s) is not a string and does not respond_to to_s", RSTRING_PTR(escd_name) );
|
455
|
-
}
|
456
|
-
}
|
457
|
-
//fprintf(stderr, "encoding content: %ld - %s\n", RSTRING_LEN(tmpcontent), RSTRING_PTR(tmpcontent) );
|
458
|
-
tmpchrs = curl_escape(RSTRING_PTR(tmpcontent), RSTRING_LEN(tmpcontent));
|
459
|
-
if (!tmpchrs) {
|
460
|
-
rb_raise(eCurlErrInvalidPostField, "Failed to url-encode content `%s'", tmpchrs);
|
461
|
-
} else {
|
462
|
-
VALUE escd_content = rb_str_new2(tmpchrs);
|
463
|
-
curl_free(tmpchrs);
|
464
|
-
|
465
|
-
result = escd_name;
|
466
|
-
rb_str_cat(result, "=", 1);
|
467
|
-
rb_str_concat(result, escd_content);
|
468
|
-
}
|
482
|
+
result = escd_name;
|
483
|
+
rb_str_cat(result, "=", 1);
|
484
|
+
rb_str_concat(result, escd_content);
|
469
485
|
}
|
470
|
-
} else {
|
471
|
-
rb_raise(eCurlErrInvalidPostField, "Cannot convert unnamed field to string %s:%d", __FILE__, __LINE__);
|
472
486
|
}
|
473
|
-
} else {
|
474
|
-
rb_raise(eCurlErrInvalidPostField, "Local file and remote file are both nil %s:%d", __FILE__, __LINE__);
|
475
|
-
}
|
476
487
|
|
477
488
|
return result;
|
478
489
|
}
|
data/ext/curb_upload.c
CHANGED
@@ -11,7 +11,7 @@ VALUE cCurlUpload;
|
|
11
11
|
#endif
|
12
12
|
|
13
13
|
static void curl_upload_mark(ruby_curl_upload *rbcu) {
|
14
|
-
if (rbcu->stream) rb_gc_mark(rbcu->stream);
|
14
|
+
if (rbcu->stream && !NIL_P(rbcu->stream)) rb_gc_mark(rbcu->stream);
|
15
15
|
}
|
16
16
|
static void curl_upload_free(ruby_curl_upload *rbcu) {
|
17
17
|
free(rbcu);
|
data/ext/extconf.rb
CHANGED
@@ -119,6 +119,11 @@ have_constant "curlinfo_primary_ip"
|
|
119
119
|
# ie quirk added in 7.19.3
|
120
120
|
have_constant "curlauth_digest_ie"
|
121
121
|
|
122
|
+
# added in 7.15.1
|
123
|
+
have_constant "curlftpmethod_multicwd"
|
124
|
+
have_constant "curlftpmethod_nocwd"
|
125
|
+
have_constant "curlftpmethod_singlecwd"
|
126
|
+
|
122
127
|
# centos 4.5 build of libcurl
|
123
128
|
have_constant "curlm_bad_socket"
|
124
129
|
have_constant "curlm_unknown_option"
|
data/tests/helper.rb
CHANGED
data/tests/tc_curl_easy.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
2
|
+
class FooNoToS
|
3
|
+
undef to_s
|
4
|
+
end
|
2
5
|
|
3
6
|
class TestCurbCurlEasy < Test::Unit::TestCase
|
4
7
|
def test_class_perform_01
|
@@ -360,6 +363,25 @@ class TestCurbCurlEasy < Test::Unit::TestCase
|
|
360
363
|
assert_equal blk, c.on_body # sets handler nil, returns old handler
|
361
364
|
assert_equal nil, c.on_body
|
362
365
|
end
|
366
|
+
|
367
|
+
def test_inspect_with_no_url
|
368
|
+
c = Curl::Easy.new
|
369
|
+
assert_equal '#<Curl::Easy>', c.inspect
|
370
|
+
end
|
371
|
+
|
372
|
+
def test_inspect_with_short_url
|
373
|
+
c = Curl::Easy.new('http://www.google.com/')
|
374
|
+
assert_equal "#<Curl::Easy http://www.google.com/>", c.inspect
|
375
|
+
end
|
376
|
+
|
377
|
+
def test_inspect_truncates_to_64_chars
|
378
|
+
base_url = 'http://www.google.com/'
|
379
|
+
truncated_url = base_url + 'x' * (64 - '#<Curl::Easy >'.size - base_url.size)
|
380
|
+
long_url = truncated_url + 'yyyy'
|
381
|
+
c = Curl::Easy.new(long_url)
|
382
|
+
assert_equal 64, c.inspect.size
|
383
|
+
assert_equal "#<Curl::Easy #{truncated_url}>", c.inspect
|
384
|
+
end
|
363
385
|
|
364
386
|
def test_on_header
|
365
387
|
blk = lambda { |i| i.length }
|
@@ -547,6 +569,15 @@ class TestCurbCurlEasy < Test::Unit::TestCase
|
|
547
569
|
assert_equal 'foo=bar&encoded%20string=val', curl.post_body
|
548
570
|
end
|
549
571
|
|
572
|
+
def test_post_multipart_file_remote
|
573
|
+
curl = Curl::Easy.new(TestServlet.url)
|
574
|
+
curl.multipart_form_post = true
|
575
|
+
pf = Curl::PostField.file('readme', File.expand_path(File.join(File.dirname(__FILE__),'..','README')))
|
576
|
+
curl.http_post(pf)
|
577
|
+
assert_match /HTTP POST file upload/, curl.body_str
|
578
|
+
assert_match /Content-Disposition: form-data/, curl.body_str
|
579
|
+
end
|
580
|
+
|
550
581
|
def test_delete_remote
|
551
582
|
curl = Curl::Easy.new(TestServlet.url)
|
552
583
|
curl.http_delete
|
@@ -602,6 +633,13 @@ class TestCurbCurlEasy < Test::Unit::TestCase
|
|
602
633
|
assert_match /message$/, curl.body_str
|
603
634
|
end
|
604
635
|
|
636
|
+
def test_put_nil_data_no_crash
|
637
|
+
curl = Curl::Easy.new(TestServlet.url)
|
638
|
+
curl.put_data = nil
|
639
|
+
|
640
|
+
curl.perform
|
641
|
+
end
|
642
|
+
|
605
643
|
def test_put_remote_file
|
606
644
|
curl = Curl::Easy.new(TestServlet.url)
|
607
645
|
File.open(__FILE__,'r') do|f|
|
@@ -755,6 +793,20 @@ class TestCurbCurlEasy < Test::Unit::TestCase
|
|
755
793
|
assert_equal 'PURGE', curl.body_str
|
756
794
|
curl.http_put('hello')
|
757
795
|
assert_equal "PUT\nhello", curl.body_str
|
796
|
+
curl.http('COPY')
|
797
|
+
assert_equal 'COPY', curl.body_str
|
798
|
+
end
|
799
|
+
|
800
|
+
def test_easy_http_verbs_must_respond_to_str
|
801
|
+
# issue http://github.com/taf2/curb/issues#issue/45
|
802
|
+
assert_nothing_raised do
|
803
|
+
c = Curl::Easy.new ; c.url = 'http://example.com' ; c.http(:get)
|
804
|
+
end
|
805
|
+
|
806
|
+
assert_raise RuntimeError do
|
807
|
+
c = Curl::Easy.new ; c.url = 'http://example.com' ; c.http(FooNoToS.new)
|
808
|
+
end
|
809
|
+
|
758
810
|
end
|
759
811
|
|
760
812
|
# http://github.com/taf2/curb/issues/#issue/33
|
data/tests/tc_curl_multi.rb
CHANGED
@@ -70,7 +70,7 @@ class TestCurbCurlMulti < Test::Unit::TestCase
|
|
70
70
|
|
71
71
|
m.perform
|
72
72
|
|
73
|
-
|
73
|
+
assert_equal n, responses.size
|
74
74
|
n.times do|i|
|
75
75
|
assert_match(/^# DO NOT REMOVE THIS COMMENT/, responses[i], "response #{i}")
|
76
76
|
end
|
@@ -93,7 +93,7 @@ class TestCurbCurlMulti < Test::Unit::TestCase
|
|
93
93
|
end
|
94
94
|
m.perform
|
95
95
|
|
96
|
-
|
96
|
+
assert_equal n, responses.size
|
97
97
|
n.times do|i|
|
98
98
|
assert_match(/^# DO NOT REMOVE THIS COMMENT/, responses[i], "response #{i}")
|
99
99
|
end
|
data/tests/tc_curl_postfield.rb
CHANGED
@@ -62,6 +62,7 @@ class TestCurbCurlPostfield < Test::Unit::TestCase
|
|
62
62
|
assert_equal 'foo', pf.name
|
63
63
|
assert_equal 'localname', pf.local_file
|
64
64
|
assert_equal 'localname', pf.remote_file
|
65
|
+
assert_nothing_raised { pf.to_s }
|
65
66
|
assert_nil pf.content_type
|
66
67
|
assert_nil pf.content
|
67
68
|
assert_nil pf.set_content_proc
|
@@ -136,6 +137,7 @@ class TestCurbCurlPostfield < Test::Unit::TestCase
|
|
136
137
|
|
137
138
|
def test_to_s_04
|
138
139
|
pf = Curl::PostField.file('foo.file', 'bar.file')
|
139
|
-
|
140
|
+
assert_nothing_raised { pf.to_s }
|
141
|
+
#assert_raise(Curl::Err::InvalidPostFieldError) { pf.to_s }
|
140
142
|
end
|
141
143
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
|
11
|
-
version: 0.7.7.1
|
9
|
+
- 8
|
10
|
+
version: 0.7.8
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Ross Bamford
|
@@ -17,7 +16,7 @@ autorequire:
|
|
17
16
|
bindir: bin
|
18
17
|
cert_chain: []
|
19
18
|
|
20
|
-
date: 2010-
|
19
|
+
date: 2010-08-17 00:00:00 -04:00
|
21
20
|
default_executable:
|
22
21
|
dependencies: []
|
23
22
|
|
@@ -36,38 +35,38 @@ files:
|
|
36
35
|
- Rakefile
|
37
36
|
- doc.rb
|
38
37
|
- ext/extconf.rb
|
39
|
-
- lib/curl.rb
|
40
38
|
- lib/curb.rb
|
39
|
+
- lib/curl.rb
|
41
40
|
- ext/curb.c
|
42
|
-
- ext/curb_upload.c
|
43
|
-
- ext/curb_postfield.c
|
44
41
|
- ext/curb_easy.c
|
45
|
-
- ext/curb_multi.c
|
46
42
|
- ext/curb_errors.c
|
47
|
-
- ext/
|
48
|
-
- ext/
|
43
|
+
- ext/curb_multi.c
|
44
|
+
- ext/curb_postfield.c
|
45
|
+
- ext/curb_upload.c
|
49
46
|
- ext/curb.h
|
50
47
|
- ext/curb_easy.h
|
48
|
+
- ext/curb_errors.h
|
49
|
+
- ext/curb_macros.h
|
50
|
+
- ext/curb_multi.h
|
51
51
|
- ext/curb_postfield.h
|
52
52
|
- ext/curb_upload.h
|
53
|
-
-
|
54
|
-
- tests/
|
55
|
-
- tests/
|
56
|
-
- tests/bug_require_last_or_segfault.rb
|
57
|
-
- tests/helper.rb
|
58
|
-
- tests/tc_curl_postfield.rb
|
53
|
+
- tests/alltests.rb
|
54
|
+
- tests/bug_curb_easy_blocks_ruby_threads.rb
|
55
|
+
- tests/bug_curb_easy_post_with_string_no_content_length_header.rb
|
59
56
|
- tests/bug_instance_post_differs_from_class_post.rb
|
60
57
|
- tests/bug_multi_segfault.rb
|
61
|
-
- tests/alltests.rb
|
62
58
|
- tests/bug_postfields_crash.rb
|
63
|
-
- tests/require_last_or_segfault_script.rb
|
64
59
|
- tests/bug_postfields_crash2.rb
|
65
|
-
- tests/
|
66
|
-
- tests/
|
67
|
-
- tests/
|
60
|
+
- tests/bug_require_last_or_segfault.rb
|
61
|
+
- tests/bugtests.rb
|
62
|
+
- tests/helper.rb
|
63
|
+
- tests/mem_check.rb
|
64
|
+
- tests/require_last_or_segfault_script.rb
|
68
65
|
- tests/tc_curl_download.rb
|
69
66
|
- tests/tc_curl_easy.rb
|
70
|
-
- tests/
|
67
|
+
- tests/tc_curl_multi.rb
|
68
|
+
- tests/tc_curl_postfield.rb
|
69
|
+
- tests/unittests.rb
|
71
70
|
has_rdoc: true
|
72
71
|
homepage: http://curb.rubyforge.org/
|
73
72
|
licenses: []
|
@@ -105,20 +104,20 @@ signing_key:
|
|
105
104
|
specification_version: 3
|
106
105
|
summary: Ruby libcurl bindings
|
107
106
|
test_files:
|
108
|
-
- tests/
|
109
|
-
- tests/
|
110
|
-
- tests/
|
111
|
-
- tests/helper.rb
|
112
|
-
- tests/tc_curl_postfield.rb
|
107
|
+
- tests/alltests.rb
|
108
|
+
- tests/bug_curb_easy_blocks_ruby_threads.rb
|
109
|
+
- tests/bug_curb_easy_post_with_string_no_content_length_header.rb
|
113
110
|
- tests/bug_instance_post_differs_from_class_post.rb
|
114
111
|
- tests/bug_multi_segfault.rb
|
115
|
-
- tests/alltests.rb
|
116
112
|
- tests/bug_postfields_crash.rb
|
117
|
-
- tests/require_last_or_segfault_script.rb
|
118
113
|
- tests/bug_postfields_crash2.rb
|
119
|
-
- tests/
|
120
|
-
- tests/
|
121
|
-
- tests/
|
114
|
+
- tests/bug_require_last_or_segfault.rb
|
115
|
+
- tests/bugtests.rb
|
116
|
+
- tests/helper.rb
|
117
|
+
- tests/mem_check.rb
|
118
|
+
- tests/require_last_or_segfault_script.rb
|
122
119
|
- tests/tc_curl_download.rb
|
123
120
|
- tests/tc_curl_easy.rb
|
124
|
-
- tests/
|
121
|
+
- tests/tc_curl_multi.rb
|
122
|
+
- tests/tc_curl_postfield.rb
|
123
|
+
- tests/unittests.rb
|