curb 1.2.1 → 1.3.0
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.md +33 -0
- data/Rakefile +22 -0
- data/ext/curb.c +282 -231
- data/ext/curb.h +4 -4
- data/ext/curb_easy.c +676 -228
- data/ext/curb_easy.h +6 -0
- data/ext/curb_errors.c +5 -5
- data/ext/curb_errors.h +1 -1
- data/ext/curb_macros.h +14 -14
- data/ext/curb_multi.c +639 -132
- data/ext/curb_multi.h +3 -1
- data/ext/curb_postfield.c +47 -21
- data/ext/curb_postfield.h +1 -0
- data/ext/curb_upload.c +32 -9
- data/ext/curb_upload.h +2 -0
- data/ext/extconf.rb +40 -0
- data/lib/curl/easy.rb +154 -13
- data/lib/curl/multi.rb +69 -9
- data/lib/curl.rb +193 -0
- data/tests/helper.rb +222 -36
- data/tests/leak_trace.rb +237 -0
- data/tests/tc_curl_download.rb +6 -2
- data/tests/tc_curl_easy.rb +450 -1
- data/tests/tc_curl_easy_request_target.rb +41 -0
- data/tests/tc_curl_multi.rb +573 -59
- data/tests/tc_curl_native_coverage.rb +130 -0
- data/tests/tc_curl_postfield.rb +161 -0
- data/tests/tc_fiber_scheduler.rb +342 -7
- data/tests/tc_ftp_options.rb +26 -0
- data/tests/tc_gc_compact.rb +223 -0
- data/tests/tc_test_server_methods.rb +110 -0
- metadata +16 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 886abdbc88d51f4d214de43f3a4d12029bfa010bd419ac89e60d0d18a8be3e21
|
|
4
|
+
data.tar.gz: 0a574a8d8f70daf2e28f4d0900075a67158ce12187ddb10d4da7700e6eea7ecb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 10438303d75fb75a75cfc2b42d9ff0bfcb92fa87cf4f1eea893f51556dfeab29639b9d30c635721224898ddc712fd62c2f46ca3d70c6622889da3821de9e2b19
|
|
7
|
+
data.tar.gz: af1a29be7253c4b0c73e593e238f7e49b1c456994559eedd9ae170678b6ac1ecb9fb80982dce1cd9eb3bba422b282fc5c83336e1bc1a1a48c88b3845cc95c424
|
data/README.md
CHANGED
|
@@ -105,6 +105,39 @@ puts list.body
|
|
|
105
105
|
|
|
106
106
|
If you need a full `LIST` output instead of just names, omit `dirlistonly` and parse the server response accordingly. The key is to let libcurl initiate the data connection (PASV/EPSV) instead of trying to drive it via `ftp_commands`.
|
|
107
107
|
|
|
108
|
+
#### Full LIST directory listing
|
|
109
|
+
To retrieve the full `LIST` output (permissions, owner, size, timestamp, name), simply do not set `dirlistonly`:
|
|
110
|
+
|
|
111
|
+
```ruby
|
|
112
|
+
list = Curl::Easy.new('ftp://ftp.example.com/remote/directory/')
|
|
113
|
+
list.username = 'user'
|
|
114
|
+
list.password = 'password'
|
|
115
|
+
|
|
116
|
+
# Explicitly ensure names+metadata (LIST) rather than NLST
|
|
117
|
+
# list.set(:dirlistonly, 0) # optional; default is LIST for directory URLs
|
|
118
|
+
|
|
119
|
+
list.perform
|
|
120
|
+
puts list.body # multi-line LIST output
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Through an HTTP proxy tunnel, the same considerations apply as the NLST example above — just omit `dirlistonly` and keep the optional EPSV/EPRT/PASV tweaks if needed:
|
|
124
|
+
|
|
125
|
+
```ruby
|
|
126
|
+
list = Curl::Easy.new('ftp://ftp.example.com/remote/directory/')
|
|
127
|
+
list.username = 'user'
|
|
128
|
+
list.password = 'password'
|
|
129
|
+
list.proxy_url = 'http://proxy.example.com:80'
|
|
130
|
+
list.proxy_tunnel = true
|
|
131
|
+
|
|
132
|
+
# Optional tweaks if the proxy/server combination struggles
|
|
133
|
+
# list.set(:ftp_use_epsv, 0)
|
|
134
|
+
# list.set(:ftp_use_eprt, 0)
|
|
135
|
+
# list.set(:ftp_skip_pasv_ip, 1)
|
|
136
|
+
|
|
137
|
+
list.perform
|
|
138
|
+
puts list.body
|
|
139
|
+
```
|
|
140
|
+
|
|
108
141
|
### Advanced FTP Usage with Various Options
|
|
109
142
|
```
|
|
110
143
|
puts "\n=== Advanced FTP Example ==="
|
data/Rakefile
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require 'rake/clean'
|
|
4
4
|
require 'rake/testtask'
|
|
5
5
|
require "ruby_memcheck"
|
|
6
|
+
require 'shellwords'
|
|
6
7
|
begin
|
|
7
8
|
require 'mixlib/shellout'
|
|
8
9
|
rescue LoadError
|
|
@@ -88,6 +89,16 @@ task :rmpid do
|
|
|
88
89
|
FileUtils.rm_rf Dir.glob("tests/server_lock-*")
|
|
89
90
|
end
|
|
90
91
|
|
|
92
|
+
at_exit do
|
|
93
|
+
next unless defined?(Rake.application)
|
|
94
|
+
|
|
95
|
+
top_level_tasks = Rake.application.top_level_tasks
|
|
96
|
+
test_tasks = %w[default test ta tu alltests unittests bugtests test:valgrind]
|
|
97
|
+
should_cleanup = top_level_tasks.empty? || top_level_tasks.any? { |task| test_tasks.include?(task) }
|
|
98
|
+
|
|
99
|
+
FileUtils.rm_rf Dir.glob("tests/server_lock-*") if should_cleanup
|
|
100
|
+
end
|
|
101
|
+
|
|
91
102
|
if ENV['RELTEST']
|
|
92
103
|
announce "Release task testing - not running regression tests on alltests"
|
|
93
104
|
task :alltests => [:unittests]
|
|
@@ -101,6 +112,17 @@ namespace :test do
|
|
|
101
112
|
t.test_files = FileList['tests/tc_*.rb']
|
|
102
113
|
t.verbose = false
|
|
103
114
|
end
|
|
115
|
+
|
|
116
|
+
desc 'Run the standalone leak trace helper'
|
|
117
|
+
task :leak_trace => :compile do
|
|
118
|
+
ruby_opts = Shellwords.split(ENV['LEAK_TRACE_OPTS'].to_s)
|
|
119
|
+
sh RbConfig.ruby, '-Ilib', '-Iext', 'tests/leak_trace.rb', *ruby_opts
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
Rake::Task['test:valgrind'].enhance([:rmpid]) do
|
|
124
|
+
Rake::Task[:rmpid].reenable
|
|
125
|
+
Rake::Task[:rmpid].invoke
|
|
104
126
|
end
|
|
105
127
|
|
|
106
128
|
Rake::TestTask.new(:unittests) do |t|
|