curb 1.0.8 → 1.0.9
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.
- checksums.yaml +4 -4
 - data/README.markdown +116 -16
 - data/Rakefile +4 -0
 - data/ext/curb.h +3 -3
 - data/ext/curb_easy.c +1 -1
 - data/tests/tc_curl_postfield.rb +2 -1
 - metadata +4 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 0105bb19d8f3c70c7b16dc47ede5eef29b26d78a765b6ab9ac19c81dc34c647a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8bb7441583b1caa916969f4a7aad3785777de7912347f6c454bb110c4ab50b08
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b9d63ab6203a5d37fe3ef02b081f92afa9ece68acdde249d6f3e09fd21fec5fd1342fa6e2fcbfb6fc58a6fd5ad2fce44fd0915d0b0bd31902cc9c5aef976d250
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: cb9f110ebeddb88eddc31d9cf1985148365c6abe5a378e2ea157414dd7bc96c59b2b2883ba0b21ac1569d82ee4bc8744cfbeaae1eaae07245c81a146bae78510
         
     | 
    
        data/README.markdown
    CHANGED
    
    | 
         @@ -37,6 +37,103 @@ POST request 
     | 
|
| 
       37 
37 
     | 
    
         
             
              puts res.body
         
     | 
| 
       38 
38 
     | 
    
         
             
            ```
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
      
 40 
     | 
    
         
            +
            ## FTP Support
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            require 'curb'
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            ### Basic FTP Download
         
     | 
| 
      
 45 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 46 
     | 
    
         
            +
            puts "=== FTP Download Example ==="
         
     | 
| 
      
 47 
     | 
    
         
            +
            ftp = Curl::Easy.new('ftp://ftp.example.com/remote/file.txt')
         
     | 
| 
      
 48 
     | 
    
         
            +
            ftp.username = 'user'
         
     | 
| 
      
 49 
     | 
    
         
            +
            ftp.password = 'password'
         
     | 
| 
      
 50 
     | 
    
         
            +
            ftp.perform
         
     | 
| 
      
 51 
     | 
    
         
            +
            puts ftp.body
         
     | 
| 
      
 52 
     | 
    
         
            +
            ```
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            ### FTP Upload
         
     | 
| 
      
 55 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 56 
     | 
    
         
            +
            puts "\n=== FTP Upload Example ==="
         
     | 
| 
      
 57 
     | 
    
         
            +
            upload = Curl::Easy.new('ftp://ftp.example.com/remote/upload.txt')
         
     | 
| 
      
 58 
     | 
    
         
            +
            upload.username = 'user'
         
     | 
| 
      
 59 
     | 
    
         
            +
            upload.password = 'password'
         
     | 
| 
      
 60 
     | 
    
         
            +
            upload.upload = true
         
     | 
| 
      
 61 
     | 
    
         
            +
            upload.put_data = File.read('local_file.txt')
         
     | 
| 
      
 62 
     | 
    
         
            +
            upload.perform
         
     | 
| 
      
 63 
     | 
    
         
            +
            ```
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            ### List Directory Contents
         
     | 
| 
      
 66 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 67 
     | 
    
         
            +
            puts "\n=== FTP Directory Listing Example ==="
         
     | 
| 
      
 68 
     | 
    
         
            +
            list = Curl::Easy.new('ftp://ftp.example.com/remote/directory/')
         
     | 
| 
      
 69 
     | 
    
         
            +
            list.username = 'user'
         
     | 
| 
      
 70 
     | 
    
         
            +
            list.password = 'password'
         
     | 
| 
      
 71 
     | 
    
         
            +
            list.dirlistonly = true
         
     | 
| 
      
 72 
     | 
    
         
            +
            list.perform
         
     | 
| 
      
 73 
     | 
    
         
            +
            puts list.body
         
     | 
| 
      
 74 
     | 
    
         
            +
            ```
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            ### Advanced FTP Usage with Various Options
         
     | 
| 
      
 77 
     | 
    
         
            +
            ```
         
     | 
| 
      
 78 
     | 
    
         
            +
            puts "\n=== Advanced FTP Example ==="
         
     | 
| 
      
 79 
     | 
    
         
            +
            advanced = Curl::Easy.new do |curl|
         
     | 
| 
      
 80 
     | 
    
         
            +
              curl.url = 'ftp://ftp.example.com/remote/file.txt'
         
     | 
| 
      
 81 
     | 
    
         
            +
              curl.username = 'user'
         
     | 
| 
      
 82 
     | 
    
         
            +
              curl.password = 'password'
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
              # FTP Options
         
     | 
| 
      
 85 
     | 
    
         
            +
              curl.ftp_response_timeout = 30
         
     | 
| 
      
 86 
     | 
    
         
            +
              curl.ftp_create_missing_dirs = true   # Create directories if they don't exist
         
     | 
| 
      
 87 
     | 
    
         
            +
              curl.ftp_filemethod = Curl::CURL_MULTICWD  # Use multicwd method for traversing paths
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
              # SSL/TLS Options for FTPS
         
     | 
| 
      
 90 
     | 
    
         
            +
              curl.use_ssl = Curl::CURLUSESSL_ALL  # Use SSL/TLS for control and data
         
     | 
| 
      
 91 
     | 
    
         
            +
              curl.ssl_verify_peer = true
         
     | 
| 
      
 92 
     | 
    
         
            +
              curl.ssl_verify_host = true
         
     | 
| 
      
 93 
     | 
    
         
            +
              curl.cacert = "/path/to/cacert.pem"
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
              # Progress callback
         
     | 
| 
      
 96 
     | 
    
         
            +
              curl.on_progress do |dl_total, dl_now, ul_total, ul_now|
         
     | 
| 
      
 97 
     | 
    
         
            +
                puts "Download: #{dl_now}/#{dl_total} Upload: #{ul_now}/#{ul_total}"
         
     | 
| 
      
 98 
     | 
    
         
            +
                true # must return true to continue
         
     | 
| 
      
 99 
     | 
    
         
            +
              end
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
              # Debug output
         
     | 
| 
      
 102 
     | 
    
         
            +
              curl.verbose = true
         
     | 
| 
      
 103 
     | 
    
         
            +
              curl.on_debug do |type, data|
         
     | 
| 
      
 104 
     | 
    
         
            +
                puts "#{type}: #{data}"
         
     | 
| 
      
 105 
     | 
    
         
            +
                true
         
     | 
| 
      
 106 
     | 
    
         
            +
              end
         
     | 
| 
      
 107 
     | 
    
         
            +
            end
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
            advanced.perform
         
     | 
| 
      
 110 
     | 
    
         
            +
            ```
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
            ### Parallel FTP Downloads
         
     | 
| 
      
 113 
     | 
    
         
            +
            ```
         
     | 
| 
      
 114 
     | 
    
         
            +
            puts "\n=== Parallel FTP Downloads Example ==="
         
     | 
| 
      
 115 
     | 
    
         
            +
            urls = [
         
     | 
| 
      
 116 
     | 
    
         
            +
              'ftp://ftp.example.com/file1.txt',
         
     | 
| 
      
 117 
     | 
    
         
            +
              'ftp://ftp.example.com/file2.txt',
         
     | 
| 
      
 118 
     | 
    
         
            +
              'ftp://ftp.example.com/file3.txt'
         
     | 
| 
      
 119 
     | 
    
         
            +
            ]
         
     | 
| 
      
 120 
     | 
    
         
            +
            ```
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
            ### Common options for all connections
         
     | 
| 
      
 123 
     | 
    
         
            +
            ```
         
     | 
| 
      
 124 
     | 
    
         
            +
            options = {
         
     | 
| 
      
 125 
     | 
    
         
            +
              :username => 'user',
         
     | 
| 
      
 126 
     | 
    
         
            +
              :password => 'password',
         
     | 
| 
      
 127 
     | 
    
         
            +
              :timeout => 30,
         
     | 
| 
      
 128 
     | 
    
         
            +
              :on_success => proc { |easy| puts "Successfully downloaded: #{easy.url}" },
         
     | 
| 
      
 129 
     | 
    
         
            +
              :on_failure => proc { |easy, code| puts "Failed to download: #{easy.url} (#{code})" }
         
     | 
| 
      
 130 
     | 
    
         
            +
            }
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
            Curl::Multi.download(urls, options) do |curl, file_path|
         
     | 
| 
      
 133 
     | 
    
         
            +
              puts "Completed downloading to: #{file_path}"
         
     | 
| 
      
 134 
     | 
    
         
            +
            end
         
     | 
| 
      
 135 
     | 
    
         
            +
            ```
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
       40 
137 
     | 
    
         
             
            ## You will need
         
     | 
| 
       41 
138 
     | 
    
         | 
| 
       42 
139 
     | 
    
         
             
            * A working Ruby installation (`2.0.0+` will work but `2.1+` preferred) (it's possible it still works with 1.8.7 but you'd have to tell me if not...)
         
     | 
| 
         @@ -50,20 +147,23 @@ A **non-exhaustive** set of compatibility versions of the libcurl library 
     | 
|
| 
       50 
147 
     | 
    
         
             
            with this gem are as follows. (Note that these are only the ones that have been
         
     | 
| 
       51 
148 
     | 
    
         
             
            tested and reported to work across a variety of platforms / rubies)
         
     | 
| 
       52 
149 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
            | Gem Version | Release Date 
     | 
| 
       54 
     | 
    
         
            -
            | ----------- |  
     | 
| 
       55 
     | 
    
         
            -
            | 1.0. 
     | 
| 
       56 
     | 
    
         
            -
            | 1.0. 
     | 
| 
       57 
     | 
    
         
            -
            | 1.0. 
     | 
| 
       58 
     | 
    
         
            -
            | 1.0. 
     | 
| 
       59 
     | 
    
         
            -
            | 1.0. 
     | 
| 
       60 
     | 
    
         
            -
            | 1.0. 
     | 
| 
       61 
     | 
    
         
            -
            | 0. 
     | 
| 
       62 
     | 
    
         
            -
            | 0. 
     | 
| 
       63 
     | 
    
         
            -
            | 0. 
     | 
| 
       64 
     | 
    
         
            -
            | 0.9. 
     | 
| 
       65 
     | 
    
         
            -
            | 0.9. 
     | 
| 
       66 
     | 
    
         
            -
            | 0.9. 
     | 
| 
      
 150 
     | 
    
         
            +
            | Gem Version | Release Date   | libcurl versions  |
         
     | 
| 
      
 151 
     | 
    
         
            +
            | ----------- | -------------- | ----------------- |
         
     | 
| 
      
 152 
     | 
    
         
            +
            | 1.0.8       | Feb 10, 2025   | 7.58 – 8.12.1     |
         
     | 
| 
      
 153 
     | 
    
         
            +
            | 1.0.7       | Feb 09, 2025   | 7.58 – 8.12.1     |
         
     | 
| 
      
 154 
     | 
    
         
            +
            | 1.0.6       | Aug 23, 2024   | 7.58 – 8.12.1     |
         
     | 
| 
      
 155 
     | 
    
         
            +
            | 1.0.5       | Jan 2023       | 7.58 – 8.12.1     |
         
     | 
| 
      
 156 
     | 
    
         
            +
            | 1.0.4       | Jan 2023       | 7.58 – 8.12.1     |
         
     | 
| 
      
 157 
     | 
    
         
            +
            | 1.0.3*      | Dec 2022       | 7.58 – 8.12.1     |
         
     | 
| 
      
 158 
     | 
    
         
            +
            | 1.0.2*      | Dec 2022       | 7.58 – 8.12.1     |
         
     | 
| 
      
 159 
     | 
    
         
            +
            | 1.0.1       | Apr 2022       | 7.58 – 8.12.1     |
         
     | 
| 
      
 160 
     | 
    
         
            +
            | 1.0.0       | Jan 2022       | 7.58 – 8.12.1     |
         
     | 
| 
      
 161 
     | 
    
         
            +
            | 0.9.8       | Jan 2019       | 7.58 – 7.81       |
         
     | 
| 
      
 162 
     | 
    
         
            +
            | 0.9.7       | Nov 2018       | 7.56 – 7.60       |
         
     | 
| 
      
 163 
     | 
    
         
            +
            | 0.9.6       | May 2018       | 7.51 – 7.59       |
         
     | 
| 
      
 164 
     | 
    
         
            +
            | 0.9.5       | May 2018       | 7.51 – 7.59       |
         
     | 
| 
      
 165 
     | 
    
         
            +
            | 0.9.4       | Aug 2017       | 7.41 – 7.58       |
         
     | 
| 
      
 166 
     | 
    
         
            +
            | 0.9.3       | Apr 2016       | 7.26 – 7.58       |
         
     | 
| 
       67 
167 
     | 
    
         | 
| 
       68 
168 
     | 
    
         
             
              ```*avoid using these version are known to have issues with segmentation faults```
         
     | 
| 
       69 
169 
     | 
    
         | 
| 
         @@ -215,7 +315,7 @@ c = Curl::Easy.new 
     | 
|
| 
       215 
315 
     | 
    
         
             
            ["http://www.google.co.uk", "http://www.ruby-lang.org/"].map do |url|
         
     | 
| 
       216 
316 
     | 
    
         
             
              c.url = url
         
     | 
| 
       217 
317 
     | 
    
         
             
              c.perform
         
     | 
| 
       218 
     | 
    
         
            -
              c. 
     | 
| 
      
 318 
     | 
    
         
            +
              c.body
         
     | 
| 
       219 
319 
     | 
    
         
             
            end
         
     | 
| 
       220 
320 
     | 
    
         
             
            ```
         
     | 
| 
       221 
321 
     | 
    
         | 
| 
         @@ -242,7 +342,7 @@ c = Curl::Easy.new("https://http2.akamai.com") 
     | 
|
| 
       242 
342 
     | 
    
         
             
            c.set(:HTTP_VERSION, Curl::HTTP_2_0)
         
     | 
| 
       243 
343 
     | 
    
         | 
| 
       244 
344 
     | 
    
         
             
            c.perform
         
     | 
| 
       245 
     | 
    
         
            -
            puts (c. 
     | 
| 
      
 345 
     | 
    
         
            +
            puts (c.body.include? "You are using HTTP/2 right now!") ? "HTTP/2" : "HTTP/1.x"
         
     | 
| 
       246 
346 
     | 
    
         
             
            ```
         
     | 
| 
       247 
347 
     | 
    
         | 
| 
       248 
348 
     | 
    
         
             
            ### Multi Interface (Basic HTTP GET):
         
     | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/ext/curb.h
    CHANGED
    
    | 
         @@ -28,11 +28,11 @@ 
     | 
|
| 
       28 
28 
     | 
    
         
             
            #include "curb_macros.h"
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
            // These should be managed from the Rake 'release' task.
         
     | 
| 
       31 
     | 
    
         
            -
            #define CURB_VERSION   "1.0. 
     | 
| 
       32 
     | 
    
         
            -
            #define CURB_VER_NUM    
     | 
| 
      
 31 
     | 
    
         
            +
            #define CURB_VERSION   "1.0.9"
         
     | 
| 
      
 32 
     | 
    
         
            +
            #define CURB_VER_NUM   1009
         
     | 
| 
       33 
33 
     | 
    
         
             
            #define CURB_VER_MAJ   1
         
     | 
| 
       34 
34 
     | 
    
         
             
            #define CURB_VER_MIN   0
         
     | 
| 
       35 
     | 
    
         
            -
            #define CURB_VER_MIC    
     | 
| 
      
 35 
     | 
    
         
            +
            #define CURB_VER_MIC   9
         
     | 
| 
       36 
36 
     | 
    
         
             
            #define CURB_VER_PATCH 0
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         | 
    
        data/ext/curb_easy.c
    CHANGED
    
    | 
         @@ -2535,7 +2535,7 @@ VALUE ruby_curl_easy_setup(ruby_curl_easy *rbce) { 
     | 
|
| 
       2535 
2535 
     | 
    
         
             
                  rb_iterate(rb_each, rb_easy_get("proxy_headers"), cb_each_http_proxy_header, wrap);
         
     | 
| 
       2536 
2536 
     | 
    
         
             
                } else {
         
     | 
| 
       2537 
2537 
     | 
    
         
             
                  VALUE proxy_headers_str = rb_obj_as_string(rb_easy_get("proxy_headers"));
         
     | 
| 
       2538 
     | 
    
         
            -
                  *phdrs = curl_slist_append(* 
     | 
| 
      
 2538 
     | 
    
         
            +
                  *phdrs = curl_slist_append(*phdrs, StringValuePtr(proxy_headers_str));
         
     | 
| 
       2539 
2539 
     | 
    
         
             
                }
         
     | 
| 
       2540 
2540 
     | 
    
         | 
| 
       2541 
2541 
     | 
    
         
             
                if (*phdrs) {
         
     | 
    
        data/tests/tc_curl_postfield.rb
    CHANGED
    
    | 
         @@ -58,12 +58,13 @@ class TestCurbCurlPostfield < Test::Unit::TestCase 
     | 
|
| 
       58 
58 
     | 
    
         | 
| 
       59 
59 
     | 
    
         
             
              def test_new_file_01
         
     | 
| 
       60 
60 
     | 
    
         
             
                pf = Curl::PostField.file('foo', 'localname')
         
     | 
| 
      
 61 
     | 
    
         
            +
                pf.content_type = 'text/super'
         
     | 
| 
       61 
62 
     | 
    
         | 
| 
       62 
63 
     | 
    
         
             
                assert_equal 'foo', pf.name
         
     | 
| 
       63 
64 
     | 
    
         
             
                assert_equal 'localname', pf.local_file
         
     | 
| 
       64 
65 
     | 
    
         
             
                assert_equal 'localname', pf.remote_file
         
     | 
| 
       65 
66 
     | 
    
         
             
                assert_nothing_raised { pf.to_s }
         
     | 
| 
       66 
     | 
    
         
            -
                 
     | 
| 
      
 67 
     | 
    
         
            +
                assert_equal 'text/super', pf.content_type
         
     | 
| 
       67 
68 
     | 
    
         
             
                assert_nil pf.content
         
     | 
| 
       68 
69 
     | 
    
         
             
                assert_nil pf.set_content_proc
         
     | 
| 
       69 
70 
     | 
    
         
             
              end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: curb
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.9
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ross Bamford
         
     | 
| 
       8 
8 
     | 
    
         
             
            - Todd A. Fisher
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2025-02- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2025-02-15 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
13 
     | 
    
         
             
            description: Curb (probably CUrl-RuBy or something) provides Ruby-language bindings
         
     | 
| 
       14 
14 
     | 
    
         
             
              for the libcurl(3), a fully-featured client-side URL transfer library. cURL and
         
     | 
| 
         @@ -79,7 +79,8 @@ files: 
     | 
|
| 
       79 
79 
     | 
    
         
             
            homepage: https://github.com/taf2/curb
         
     | 
| 
       80 
80 
     | 
    
         
             
            licenses:
         
     | 
| 
       81 
81 
     | 
    
         
             
            - Ruby
         
     | 
| 
       82 
     | 
    
         
            -
            metadata: 
     | 
| 
      
 82 
     | 
    
         
            +
            metadata:
         
     | 
| 
      
 83 
     | 
    
         
            +
              changelog_uri: https://github.com/taf2/curb/blob/master/ChangeLog.md
         
     | 
| 
       83 
84 
     | 
    
         
             
            rdoc_options:
         
     | 
| 
       84 
85 
     | 
    
         
             
            - "--main"
         
     | 
| 
       85 
86 
     | 
    
         
             
            - README.markdown
         
     |