rhack 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/.gemtest +0 -0
  2. data/CURB-LICENSE +51 -0
  3. data/Gemfile +4 -0
  4. data/History.txt +4 -0
  5. data/LICENSE +51 -0
  6. data/License.txt +17 -0
  7. data/Manifest.txt +61 -0
  8. data/README.txt +12 -0
  9. data/Rakefile +34 -0
  10. data/ext/curb-original/curb.c +977 -0
  11. data/ext/curb-original/curb.h +52 -0
  12. data/ext/curb-original/curb_config.h +235 -0
  13. data/ext/curb-original/curb_easy.c +3455 -0
  14. data/ext/curb-original/curb_easy.h +90 -0
  15. data/ext/curb-original/curb_errors.c +647 -0
  16. data/ext/curb-original/curb_errors.h +129 -0
  17. data/ext/curb-original/curb_macros.h +159 -0
  18. data/ext/curb-original/curb_multi.c +704 -0
  19. data/ext/curb-original/curb_multi.h +26 -0
  20. data/ext/curb-original/curb_postfield.c +523 -0
  21. data/ext/curb-original/curb_postfield.h +40 -0
  22. data/ext/curb-original/curb_upload.c +80 -0
  23. data/ext/curb-original/curb_upload.h +30 -0
  24. data/ext/curb/Makefile +157 -0
  25. data/ext/curb/curb.c +977 -0
  26. data/ext/curb/curb.h +52 -0
  27. data/ext/curb/curb_config.h +235 -0
  28. data/ext/curb/curb_easy.c +3430 -0
  29. data/ext/curb/curb_easy.h +94 -0
  30. data/ext/curb/curb_errors.c +647 -0
  31. data/ext/curb/curb_errors.h +129 -0
  32. data/ext/curb/curb_macros.h +159 -0
  33. data/ext/curb/curb_multi.c +710 -0
  34. data/ext/curb/curb_multi.h +26 -0
  35. data/ext/curb/curb_postfield.c +523 -0
  36. data/ext/curb/curb_postfield.h +40 -0
  37. data/ext/curb/curb_upload.c +80 -0
  38. data/ext/curb/curb_upload.h +30 -0
  39. data/ext/curb/extconf.rb +399 -0
  40. data/lib/cache.rb +44 -0
  41. data/lib/curl-global.rb +151 -0
  42. data/lib/extensions/browser/env.js +697 -0
  43. data/lib/extensions/browser/jquery.js +7180 -0
  44. data/lib/extensions/browser/xmlsax.js +1564 -0
  45. data/lib/extensions/browser/xmlw3cdom_1.js +1444 -0
  46. data/lib/extensions/browser/xmlw3cdom_2.js +2744 -0
  47. data/lib/extensions/curb.rb +125 -0
  48. data/lib/extensions/declarative.rb +153 -0
  49. data/lib/extensions/johnson.rb +63 -0
  50. data/lib/frame.rb +766 -0
  51. data/lib/init.rb +36 -0
  52. data/lib/rhack.rb +16 -0
  53. data/lib/rhack.yml.template +19 -0
  54. data/lib/rhack/proxy/checker.rb +226 -0
  55. data/lib/rhack/proxy/list.rb +196 -0
  56. data/lib/rhack/services.rb +445 -0
  57. data/lib/rhack_in.rb +2 -0
  58. data/lib/scout.rb +591 -0
  59. data/lib/words.rb +37 -0
  60. data/test/test_frame.rb +107 -0
  61. data/test/test_rhack.rb +5 -0
  62. data/test/test_scout.rb +53 -0
  63. metadata +195 -0
data/.gemtest ADDED
File without changes
data/CURB-LICENSE ADDED
@@ -0,0 +1,51 @@
1
+ Copyright (c) 2006 Ross Bamford (rosco AT roscopeco DOT co DOT uk).
2
+ Curb is free software licensed under the following terms:
3
+
4
+ 1. You may make and give away verbatim copies of the source form of the
5
+ software without restriction, provided that you duplicate all of the
6
+ original copyright notices and associated disclaimers.
7
+
8
+ 2. You may modify your copy of the software in any way, provided that
9
+ you do at least ONE of the following:
10
+
11
+ a) place your modifications in the Public Domain or otherwise
12
+ make them Freely Available, such as by posting said
13
+ modifications to Usenet or an equivalent medium, or by allowing
14
+ the author to include your modifications in the software.
15
+
16
+ b) use the modified software only within your corporation or
17
+ organization.
18
+
19
+ c) give non-standard binaries non-standard names, with
20
+ instructions on where to get the original software distribution.
21
+
22
+ d) make other distribution arrangements with the author.
23
+
24
+ 3. You may distribute the software in object code or binary form,
25
+ provided that you do at least ONE of the following:
26
+
27
+ a) distribute the binaries and library files of the software,
28
+ together with instructions (in the manual page or equivalent)
29
+ on where to get the original distribution.
30
+
31
+ b) accompany the distribution with the machine-readable source of
32
+ the software.
33
+
34
+ c) give non-standard binaries non-standard names, with
35
+ instructions on where to get the original software distribution.
36
+
37
+ d) make other distribution arrangements with the author.
38
+
39
+ 4. You may modify and include the part of the software into any other
40
+ software (possibly commercial).
41
+
42
+ 5. The scripts and library files supplied as input to or produced as
43
+ output from the software do not automatically fall under the
44
+ copyright of the software, but belong to whomever generated them,
45
+ and may be sold commercially, and may be aggregated with this
46
+ software.
47
+
48
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
49
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
50
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
51
+ PURPOSE.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'libxml-ruby'
4
+ gem 'rmtools'
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ === Version 1.0.0
2
+
3
+ * Divided by classes and packed as gem
4
+
data/LICENSE ADDED
@@ -0,0 +1,51 @@
1
+ Copyright (c) 2010 Sergey Baev (tinbka AT gmail DOT com).
2
+ Curb is free software licensed under the following terms:
3
+
4
+ 1. You may make and give away verbatim copies of the source form of the
5
+ software without restriction, provided that you duplicate all of the
6
+ original copyright notices and associated disclaimers.
7
+
8
+ 2. You may modify your copy of the software in any way, provided that
9
+ you do at least ONE of the following:
10
+
11
+ a) place your modifications in the Public Domain or otherwise
12
+ make them Freely Available, such as by posting said
13
+ modifications to Usenet or an equivalent medium, or by allowing
14
+ the author to include your modifications in the software.
15
+
16
+ b) use the modified software only within your corporation or
17
+ organization.
18
+
19
+ c) give non-standard binaries non-standard names, with
20
+ instructions on where to get the original software distribution.
21
+
22
+ d) make other distribution arrangements with the author.
23
+
24
+ 3. You may distribute the software in object code or binary form,
25
+ provided that you do at least ONE of the following:
26
+
27
+ a) distribute the binaries and library files of the software,
28
+ together with instructions (in the manual page or equivalent)
29
+ on where to get the original distribution.
30
+
31
+ b) accompany the distribution with the machine-readable source of
32
+ the software.
33
+
34
+ c) give non-standard binaries non-standard names, with
35
+ instructions on where to get the original software distribution.
36
+
37
+ d) make other distribution arrangements with the author.
38
+
39
+ 4. You may modify and include the part of the software into any other
40
+ software (possibly commercial).
41
+
42
+ 5. The scripts and library files supplied as input to or produced as
43
+ output from the software do not automatically fall under the
44
+ copyright of the software, but belong to whomever generated them,
45
+ and may be sold commercially, and may be aggregated with this
46
+ software.
47
+
48
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
49
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
50
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
51
+ PURPOSE.
data/License.txt ADDED
@@ -0,0 +1,17 @@
1
+ Copyright (c) 2010 Anonymous <tinbka@gmail.com>
2
+ All rights reserved.
3
+
4
+ This work is licensed under the same license as Ruby language.
5
+
6
+
7
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
8
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
9
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
10
+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
11
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
12
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
13
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
14
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
15
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
16
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
17
+ SUCH DAMAGE.
data/Manifest.txt ADDED
@@ -0,0 +1,61 @@
1
+ ext/curb/curb_errors.c
2
+ ext/curb/curb_errors.h
3
+ ext/curb/Makefile
4
+ ext/curb/curb_macros.h
5
+ ext/curb/curb_multi.c
6
+ ext/curb/curb_multi.h
7
+ ext/curb/curb_upload.c
8
+ ext/curb/curb_upload.h
9
+ ext/curb/curb_config.h
10
+ ext/curb/extconf.rb
11
+ ext/curb/curb.c
12
+ ext/curb/curb.h
13
+ ext/curb/curb_easy.c
14
+ ext/curb/curb_easy.h
15
+ ext/curb/curb_postfield.c
16
+ ext/curb/curb_postfield.h
17
+ ext/curb-original/curb_errors.c
18
+ ext/curb-original/curb_errors.h
19
+ ext/curb-original/curb_macros.h
20
+ ext/curb-original/curb_multi.c
21
+ ext/curb-original/curb_multi.h
22
+ ext/curb-original/curb_upload.c
23
+ ext/curb-original/curb_upload.h
24
+ ext/curb-original/curb_config.h
25
+ ext/curb-original/curb.c
26
+ ext/curb-original/curb.h
27
+ ext/curb-original/curb_easy.c
28
+ ext/curb-original/curb_easy.h
29
+ ext/curb-original/curb_postfield.c
30
+ ext/curb-original/curb_postfield.h
31
+ lib/rhack/proxy/list.rb
32
+ lib/rhack/proxy/checker.rb
33
+ lib/rhack/services.rb
34
+ lib/cache.rb
35
+ lib/rhack.rb
36
+ lib/scout.rb
37
+ lib/rhack.yml.template
38
+ lib/frame.rb
39
+ lib/words.rb
40
+ lib/curl-global.rb
41
+ lib/extensions/curb.rb
42
+ lib/extensions/declarative.rb
43
+ lib/extensions/johnson.rb
44
+ lib/extensions/browser/env.js
45
+ lib/extensions/browser/jquery.js
46
+ lib/extensions/browser/xmlw3cdom_1.js
47
+ lib/extensions/browser/xmlw3cdom_2.js
48
+ lib/extensions/browser/xmlsax.js
49
+ lib/rhack_in.rb
50
+ lib/init.rb
51
+ test/test_rhack.rb
52
+ test/test_scout.rb
53
+ test/test_frame.rb
54
+ ./LICENSE
55
+ ./Rakefile
56
+ ./Manifest.txt
57
+ ./CURB-LICENSE
58
+ ./License.txt
59
+ ./README.txt
60
+ ./Gemfile
61
+ ./History.txt
data/README.txt ADDED
@@ -0,0 +1,12 @@
1
+ ## RHACK
2
+
3
+ Rhack is Ruby Http ACcess Kit -- curl-based web-client for developing web-clients
4
+ applications such as webscrappers.
5
+
6
+ ## License
7
+
8
+ Rhack is copyright (c)2010 Sergey Baev, and released under the terms of the Ruby license.
9
+ See the LICENSE file for the details.
10
+ Rhack is also include slightly modified Curb gem extension source code. For original
11
+ Curb gem code you may want to check ext/curb-original or visit http://github.com/taf2/curb/tree/master .
12
+ See the CURB-LICENSE file for the details.
data/Rakefile ADDED
@@ -0,0 +1,34 @@
1
+ require 'rake'
2
+ begin
3
+ require 'rmtools_dev'
4
+ require 'rmtools/install'
5
+ rescue LoadError
6
+ puts "cannot load the RMTools gem. Distribution is disabled. Please 'sudo gem install rmtools' first"
7
+ exit
8
+ end
9
+
10
+ compile_manifest
11
+ RHACK_VERSION = '0.2.2'
12
+ begin
13
+ require 'hoe'
14
+ config = Hoe.spec "rhack" do |h|
15
+ h.developer("Sergey Baev", "tinbka@gmail.com")
16
+
17
+ h.description = 'Webscrapping library based on curb gem extension and libxml-ruby (and optionally Johnson and ActiveRecord)'
18
+ # h.summary = h.description
19
+ h.url = 'http://github.com/tinbka'
20
+
21
+ h.extra_deps << ['rmtools','>= 1.0.0']
22
+ h.extra_deps << ['rake','>= 0.8.7']
23
+ #h.extra_deps << ['johnson','>= 2.0.0.pre3']
24
+ h.extra_deps << ['libxml-ruby','>= 1.1.3']
25
+ #h.extra_deps << ['curb','> 0.4']
26
+ end
27
+ config.spec.extensions << 'ext/curb/extconf.rb'
28
+ rescue LoadError
29
+ STDERR.puts "cannot load the Hoe gem. Distribution is disabled"
30
+ rescue Exception => e
31
+ STDERR.puts "cannot load the Hoe gem, or Hoe fails. Distribution is disabled"
32
+ STDERR.puts "error message is: #{e.message}"
33
+ raise e
34
+ end
@@ -0,0 +1,977 @@
1
+ /* Curb - Libcurl(3) bindings for Ruby.
2
+ * Copyright (c)2006 Ross Bamford.
3
+ * Licensed under the Ruby License. See LICENSE for details.
4
+ *
5
+ * $Id: curb.c 35 2006-12-23 15:22:19Z roscopeco $
6
+ */
7
+
8
+ #include "curb.h"
9
+ #include "curb_upload.h"
10
+
11
+ VALUE mCurl;
12
+
13
+ /* ================== VER QUERY FUNCS ==============*/
14
+
15
+ /*
16
+ * call-seq:
17
+ * Curl.ipv6? => true or false
18
+ *
19
+ * Returns true if the installed libcurl supports IPv6.
20
+ */
21
+ static VALUE ruby_curl_ipv6_q(VALUE mod) {
22
+ curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
23
+ return((ver->features & CURL_VERSION_IPV6) ? Qtrue : Qfalse);
24
+ }
25
+
26
+ /*
27
+ * call-seq:
28
+ * Curl.kerberos4? => true or false
29
+ *
30
+ * Returns true if the installed libcurl supports Kerberos4 authentication
31
+ * with FTP connections.
32
+ */
33
+ static VALUE ruby_curl_kerberos4_q(VALUE mod) {
34
+ curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
35
+ return((ver->features & CURL_VERSION_KERBEROS4) ? Qtrue : Qfalse);
36
+ }
37
+
38
+ /*
39
+ * call-seq:
40
+ * Curl.ssl? => true or false
41
+ *
42
+ * Returns true if the installed libcurl supports SSL connections.
43
+ * For libcurl versions < 7.10, always returns false.
44
+ */
45
+ static VALUE ruby_curl_ssl_q(VALUE mod) {
46
+ #ifdef HAVE_CURL_VERSION_SSL
47
+ curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
48
+ return((ver->features & CURL_VERSION_SSL) ? Qtrue : Qfalse);
49
+ #else
50
+ return Qfalse;
51
+ #endif
52
+ }
53
+
54
+ /*
55
+ * call-seq:
56
+ * Curl.libz? => true or false
57
+ *
58
+ * Returns true if the installed libcurl supports HTTP deflate
59
+ * using libz. For libcurl versions < 7.10, always returns false.
60
+ */
61
+ static VALUE ruby_curl_libz_q(VALUE mod) {
62
+ #ifdef HAVE_CURL_VERSION_LIBZ
63
+ curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
64
+ return((ver->features & CURL_VERSION_LIBZ) ? Qtrue : Qfalse);
65
+ #else
66
+ return Qfalse;
67
+ #endif
68
+ }
69
+
70
+ /*
71
+ * call-seq:
72
+ * Curl.ntlm? => true or false
73
+ *
74
+ * Returns true if the installed libcurl supports HTTP NTLM.
75
+ * For libcurl versions < 7.10.6, always returns false.
76
+ */
77
+ static VALUE ruby_curl_ntlm_q(VALUE mod) {
78
+ #ifdef HAVE_CURL_VERSION_NTLM
79
+ curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
80
+ return((ver->features & CURL_VERSION_NTLM) ? Qtrue : Qfalse);
81
+ #else
82
+ return Qfalse;
83
+ #endif
84
+ }
85
+
86
+ /*
87
+ * call-seq:
88
+ * Curl.gssnegotiate? => true or false
89
+ *
90
+ * Returns true if the installed libcurl supports HTTP GSS-Negotiate.
91
+ * For libcurl versions < 7.10.6, always returns false.
92
+ */
93
+ static VALUE ruby_curl_gssnegotiate_q(VALUE mod) {
94
+ #ifdef HAVE_CURL_VERSION_GSSNEGOTIATE
95
+ curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
96
+ return((ver->features & CURL_VERSION_GSSNEGOTIATE) ? Qtrue : Qfalse);
97
+ #else
98
+ return Qfalse;
99
+ #endif
100
+ }
101
+
102
+ /*
103
+ * call-seq:
104
+ * Curl.debug? => true or false
105
+ *
106
+ * Returns true if the installed libcurl was built with extra debug
107
+ * capabilities built-in. For libcurl versions < 7.10.6, always returns
108
+ * false.
109
+ */
110
+ static VALUE ruby_curl_debug_q(VALUE mod) {
111
+ #ifdef HAVE_CURL_VERSION_DEBUG
112
+ curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
113
+ return((ver->features & CURL_VERSION_DEBUG) ? Qtrue : Qfalse);
114
+ #else
115
+ return Qfalse;
116
+ #endif
117
+ }
118
+
119
+ /*
120
+ * call-seq:
121
+ * Curl.asyncdns? => true or false
122
+ *
123
+ * Returns true if the installed libcurl was built with support for
124
+ * asynchronous name lookups, which allows more exact timeouts (even
125
+ * on Windows) and less blocking when using the multi interface.
126
+ * For libcurl versions < 7.10.7, always returns false.
127
+ */
128
+ static VALUE ruby_curl_asyncdns_q(VALUE mod) {
129
+ #ifdef HAVE_CURL_VERSION_ASYNCHDNS
130
+ curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
131
+ return((ver->features & CURL_VERSION_ASYNCHDNS) ? Qtrue : Qfalse);
132
+ #else
133
+ return Qfalse;
134
+ #endif
135
+ }
136
+
137
+ /*
138
+ * call-seq:
139
+ * Curl.spnego? => true or false
140
+ *
141
+ * Returns true if the installed libcurl was built with support for SPNEGO
142
+ * authentication (Simple and Protected GSS-API Negotiation Mechanism, defined
143
+ * in RFC 2478). For libcurl versions < 7.10.8, always returns false.
144
+ */
145
+ static VALUE ruby_curl_spnego_q(VALUE mod) {
146
+ #ifdef HAVE_CURL_VERSION_SPNEGO
147
+ curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
148
+ return((ver->features & CURL_VERSION_SPNEGO) ? Qtrue : Qfalse);
149
+ #else
150
+ return Qfalse;
151
+ #endif
152
+ }
153
+
154
+ /*
155
+ * call-seq:
156
+ * Curl.largefile? => true or false
157
+ *
158
+ * Returns true if the installed libcurl was built with support for large
159
+ * files. For libcurl versions < 7.11.1, always returns false.
160
+ */
161
+ static VALUE ruby_curl_largefile_q(VALUE mod) {
162
+ #ifdef HAVE_CURL_VERSION_LARGEFILE
163
+ curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
164
+ return((ver->features & CURL_VERSION_LARGEFILE) ? Qtrue : Qfalse);
165
+ #else
166
+ return Qfalse;
167
+ #endif
168
+ }
169
+
170
+ /*
171
+ * call-seq:
172
+ * Curl.idn? => true or false
173
+ *
174
+ * Returns true if the installed libcurl was built with support for IDNA,
175
+ * domain names with international letters. For libcurl versions < 7.12.0,
176
+ * always returns false.
177
+ */
178
+ static VALUE ruby_curl_idn_q(VALUE mod) {
179
+ #ifdef HAVE_CURL_VERSION_IDN
180
+ curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
181
+ return((ver->features & CURL_VERSION_IDN) ? Qtrue : Qfalse);
182
+ #else
183
+ return Qfalse;
184
+ #endif
185
+ }
186
+
187
+ /*
188
+ * call-seq:
189
+ * Curl.sspi? => true or false
190
+ *
191
+ * Returns true if the installed libcurl was built with support for SSPI.
192
+ * This is only available on Windows and makes libcurl use Windows-provided
193
+ * functions for NTLM authentication. It also allows libcurl to use the current
194
+ * user and the current user's password without the app having to pass them on.
195
+ * For libcurl versions < 7.13.2, always returns false.
196
+ */
197
+ static VALUE ruby_curl_sspi_q(VALUE mod) {
198
+ #ifdef HAVE_CURL_VERSION_SSPI
199
+ curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
200
+ return((ver->features & CURL_VERSION_SSPI) ? Qtrue : Qfalse);
201
+ #else
202
+ return Qfalse;
203
+ #endif
204
+ }
205
+
206
+ /*
207
+ * call-seq:
208
+ * Curl.conv? => true or false
209
+ *
210
+ * Returns true if the installed libcurl was built with support for character
211
+ * conversions. For libcurl versions < 7.15.4, always returns false.
212
+ */
213
+ static VALUE ruby_curl_conv_q(VALUE mod) {
214
+ #ifdef HAVE_CURL_VERSION_CONV
215
+ curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
216
+ return((ver->features & CURL_VERSION_CONV) ? Qtrue : Qfalse);
217
+ #else
218
+ return Qfalse;
219
+ #endif
220
+ }
221
+
222
+ void Init_curb_core() {
223
+ // TODO we need to call curl_global_cleanup at exit!
224
+ curl_version_info_data *ver;
225
+ VALUE curlver, curllongver, curlvernum;
226
+
227
+ curl_global_init(CURL_GLOBAL_ALL);
228
+ ver = curl_version_info(CURLVERSION_NOW);
229
+
230
+ mCurl = rb_define_module("Curl");
231
+
232
+ curlver = rb_str_new2(ver->version);
233
+ curllongver = rb_str_new2(curl_version());
234
+ curlvernum = LONG2NUM(LIBCURL_VERSION_NUM);
235
+
236
+ rb_define_const(mCurl, "CURB_VERSION", rb_str_new2(CURB_VERSION));
237
+ rb_define_const(mCurl, "VERSION", curlver);
238
+ rb_define_const(mCurl, "CURL_VERSION", curlver);
239
+ rb_define_const(mCurl, "VERNUM", curlvernum);
240
+ rb_define_const(mCurl, "CURL_VERNUM", curlvernum);
241
+ rb_define_const(mCurl, "LONG_VERSION", curllongver);
242
+ rb_define_const(mCurl, "CURL_LONG_VERSION", curllongver);
243
+
244
+ /* Passed to on_debug handler to indicate that the data is informational text. */
245
+ rb_define_const(mCurl, "CURLINFO_TEXT", INT2FIX(CURLINFO_TEXT));
246
+
247
+ /* Passed to on_debug handler to indicate that the data is header (or header-like) data received from the peer. */
248
+ rb_define_const(mCurl, "CURLINFO_HEADER_IN", INT2FIX(CURLINFO_HEADER_IN));
249
+
250
+ /* Passed to on_debug handler to indicate that the data is header (or header-like) data sent to the peer. */
251
+ rb_define_const(mCurl, "CURLINFO_HEADER_OUT", INT2FIX(CURLINFO_HEADER_OUT));
252
+
253
+ /* Passed to on_debug handler to indicate that the data is protocol data received from the peer. */
254
+ rb_define_const(mCurl, "CURLINFO_DATA_IN", INT2FIX(CURLINFO_DATA_IN));
255
+
256
+ /* Passed to on_debug handler to indicate that the data is protocol data sent to the peer. */
257
+ rb_define_const(mCurl, "CURLINFO_DATA_OUT", INT2FIX(CURLINFO_DATA_OUT));
258
+
259
+ #ifdef HAVE_CURLFTPMETHOD_MULTICWD
260
+ rb_define_const(mCurl, "CURL_MULTICWD", INT2FIX(CURLFTPMETHOD_MULTICWD));
261
+ #endif
262
+
263
+ #ifdef HAVE_CURLFTPMETHOD_NOCWD
264
+ rb_define_const(mCurl, "CURL_NOCWD", INT2FIX(CURLFTPMETHOD_NOCWD));
265
+ #endif
266
+
267
+ #ifdef HAVE_CURLFTPMETHOD_SINGLECWD
268
+ rb_define_const(mCurl, "CURL_SINGLECWD", INT2FIX(CURLFTPMETHOD_SINGLECWD));
269
+ #endif
270
+
271
+ /* When passed to Curl::Easy#proxy_type , indicates that the proxy is an HTTP proxy. (libcurl >= 7.10) */
272
+ #ifdef HAVE_CURLPROXY_HTTP
273
+ rb_define_const(mCurl, "CURLPROXY_HTTP", INT2FIX(CURLPROXY_HTTP));
274
+ #else
275
+ rb_define_const(mCurl, "CURLPROXY_HTTP", INT2FIX(-1));
276
+ #endif
277
+
278
+ #ifdef CURL_VERSION_SSL
279
+ rb_define_const(mCurl, "CURL_SSLVERSION_DEFAULT", INT2FIX(CURL_SSLVERSION_DEFAULT));
280
+ rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1", INT2FIX(CURL_SSLVERSION_TLSv1));
281
+ rb_define_const(mCurl, "CURL_SSLVERSION_SSLv2", INT2FIX(CURL_SSLVERSION_SSLv2));
282
+ rb_define_const(mCurl, "CURL_SSLVERSION_SSLv3", INT2FIX(CURL_SSLVERSION_SSLv3));
283
+
284
+ rb_define_const(mCurl, "CURL_USESSL_CONTROL", INT2FIX(CURB_FTPSSL_CONTROL));
285
+ rb_define_const(mCurl, "CURL_USESSL_NONE", INT2FIX(CURB_FTPSSL_NONE));
286
+ rb_define_const(mCurl, "CURL_USESSL_TRY", INT2FIX(CURB_FTPSSL_TRY));
287
+ rb_define_const(mCurl, "CURL_USESSL_ALL", INT2FIX(CURB_FTPSSL_ALL));
288
+ #else
289
+ rb_define_const(mCurl, "CURL_SSLVERSION_DEFAULT", INT2FIX(-1));
290
+ rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1", INT2FIX(-1));
291
+ rb_define_const(mCurl, "CURL_SSLVERSION_SSLv2", INT2FIX(-1));
292
+ rb_define_const(mCurl, "CURL_SSLVERSION_SSLv3", INT2FIX(-1));
293
+
294
+ rb_define_const(mCurl, "CURL_USESSL_CONTROL", INT2FIX(-1));
295
+ rb_define_const(mCurl, "CURL_USESSL_NONE", INT2FIX(-1));
296
+ rb_define_const(mCurl, "CURL_USESSL_TRY", INT2FIX(-1));
297
+ rb_define_const(mCurl, "CURL_USESSL_ALL", INT2FIX(-1));
298
+ #endif
299
+
300
+ /* When passed to Curl::Easy#proxy_type , indicates that the proxy is a SOCKS4 proxy. (libcurl >= 7.15.2) */
301
+ #ifdef HAVE_CURLPROXY_SOCKS4
302
+ rb_define_const(mCurl, "CURLPROXY_SOCKS4", INT2FIX(CURLPROXY_SOCKS4));
303
+ #else
304
+ rb_define_const(mCurl, "CURLPROXY_SOCKS4", INT2FIX(-2));
305
+ #endif
306
+
307
+ /* When passed to Curl::Easy#proxy_type , indicates that the proxy is a SOCKS5 proxy. (libcurl >= 7.10) */
308
+ #ifdef HAVE_CURLPROXY_SOCKS5
309
+ rb_define_const(mCurl, "CURLPROXY_SOCKS5", INT2FIX(CURLPROXY_SOCKS5));
310
+ #else
311
+ rb_define_const(mCurl, "CURLPROXY_SOCKS5", INT2FIX(-2));
312
+ #endif
313
+
314
+ /* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, directs libcurl to use Basic authentication. */
315
+ #ifdef HAVE_CURLAUTH_BASIC
316
+ rb_define_const(mCurl, "CURLAUTH_BASIC", INT2FIX(CURLAUTH_BASIC));
317
+ #else
318
+ rb_define_const(mCurl, "CURLAUTH_BASIC", INT2FIX(0));
319
+ #endif
320
+
321
+ /* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, directs libcurl to use Digest authentication. */
322
+ #ifdef HAVE_CURLAUTH_DIGEST
323
+ rb_define_const(mCurl, "CURLAUTH_DIGEST", INT2FIX(CURLAUTH_DIGEST));
324
+ #else
325
+ rb_define_const(mCurl, "CURLAUTH_DIGEST", INT2FIX(0));
326
+ #endif
327
+
328
+ /* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, directs libcurl to use GSS Negotiate authentication. Requires a suitable GSS-API library. */
329
+ #ifdef HAVE_CURLAUTH_GSSNEGOTIATE
330
+ rb_define_const(mCurl, "CURLAUTH_GSSNEGOTIATE", INT2FIX(CURLAUTH_GSSNEGOTIATE));
331
+ #else
332
+ rb_define_const(mCurl, "CURLAUTH_GSSNEGOTIATE", INT2FIX(0));
333
+ #endif
334
+
335
+ /* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, directs libcurl to use HTTP NTLM authentication. Requires MS Windows or OpenSSL support. */
336
+ #ifdef HAVE_CURLAUTH_NTLM
337
+ rb_define_const(mCurl, "CURLAUTH_NTLM", INT2FIX(CURLAUTH_NTLM));
338
+ #else
339
+ rb_define_const(mCurl, "CURLAUTH_NTLM", INT2FIX(0));
340
+ #endif
341
+
342
+ /* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, allows libcurl to select any suitable authentication method except basic. */
343
+ #ifdef HAVE_CURLAUTH_ANYSAFE
344
+ rb_define_const(mCurl, "CURLAUTH_ANYSAFE", INT2FIX(CURLAUTH_ANYSAFE));
345
+ #else
346
+ rb_define_const(mCurl, "CURLAUTH_ANYSAFE", INT2FIX(0));
347
+ #endif
348
+
349
+ /* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, allows libcurl to select any suitable authentication method. */
350
+ #ifdef HAVE_CURLAUTH_ANY
351
+ rb_define_const(mCurl, "CURLAUTH_ANY", INT2FIX(CURLAUTH_ANY));
352
+ #else
353
+ rb_define_const(mCurl, "CURLAUTH_ANY", INT2FIX(0));
354
+ #endif
355
+
356
+ CURB_DEFINE(CURLOPT_VERBOSE);
357
+ CURB_DEFINE(CURLOPT_HEADER);
358
+ CURB_DEFINE(CURLOPT_NOPROGRESS);
359
+ CURB_DEFINE(CURLOPT_NOSIGNAL);
360
+ CURB_DEFINE(CURLOPT_WRITEFUNCTION);
361
+ CURB_DEFINE(CURLOPT_WRITEDATA);
362
+ CURB_DEFINE(CURLOPT_READFUNCTION);
363
+ CURB_DEFINE(CURLOPT_READDATA);
364
+ CURB_DEFINE(CURLOPT_IOCTLFUNCTION);
365
+ CURB_DEFINE(CURLOPT_IOCTLDATA);
366
+ #if HAVE_CURLOPT_SEEKFUNCTION
367
+ CURB_DEFINE(CURLOPT_SEEKFUNCTION);
368
+ #endif
369
+ #if HAVE_CURLOPT_SEEKDATA
370
+ CURB_DEFINE(CURLOPT_SEEKDATA);
371
+ #endif
372
+ #if HAVE_CURLOPT_SOCKOPTFUNCTION
373
+ CURB_DEFINE(CURLOPT_SOCKOPTFUNCTION);
374
+ #endif
375
+ #if HAVE_CURLOPT_SOCKOPTDATA
376
+ CURB_DEFINE(CURLOPT_SOCKOPTDATA);
377
+ #endif
378
+ #if HAVE_CURLOPT_OPENSOCKETFUNCTION
379
+ CURB_DEFINE(CURLOPT_OPENSOCKETFUNCTION);
380
+ #endif
381
+ #if HAVE_CURLOPT_OPENSOCKETDATA
382
+ CURB_DEFINE(CURLOPT_OPENSOCKETDATA);
383
+ #endif
384
+ CURB_DEFINE(CURLOPT_PROGRESSFUNCTION);
385
+ CURB_DEFINE(CURLOPT_PROGRESSDATA);
386
+ CURB_DEFINE(CURLOPT_HEADERFUNCTION);
387
+ CURB_DEFINE(CURLOPT_WRITEHEADER);
388
+ CURB_DEFINE(CURLOPT_DEBUGFUNCTION);
389
+ CURB_DEFINE(CURLOPT_DEBUGDATA);
390
+ CURB_DEFINE(CURLOPT_SSL_CTX_FUNCTION);
391
+ CURB_DEFINE(CURLOPT_SSL_CTX_DATA);
392
+ CURB_DEFINE(CURLOPT_CONV_TO_NETWORK_FUNCTION);
393
+ CURB_DEFINE(CURLOPT_CONV_FROM_NETWORK_FUNCTION);
394
+ CURB_DEFINE(CURLOPT_CONV_FROM_UTF8_FUNCTION);
395
+
396
+ #if HAVE_CURLOPT_INTERLEAVEFUNCTION
397
+ CURB_DEFINE(CURLOPT_INTERLEAVEFUNCTION);
398
+ #endif
399
+ #if HAVE_CURLOPT_INTERLEAVEDATA
400
+ CURB_DEFINE(CURLOPT_INTERLEAVEDATA);
401
+ #endif
402
+ #if HAVE_CURLOPT_CHUNK_BGN_FUNCTION
403
+ CURB_DEFINE(CURLOPT_CHUNK_BGN_FUNCTION);
404
+ #endif
405
+ #if HAVE_CURLOPT_CHUNK_END_FUNCTION
406
+ CURB_DEFINE(CURLOPT_CHUNK_END_FUNCTION);
407
+ #endif
408
+ #if HAVE_CURLOPT_CHUNK_DATA
409
+ CURB_DEFINE(CURLOPT_CHUNK_DATA);
410
+ #endif
411
+ #if HAVE_CURLOPT_FNMATCH_FUNCTION
412
+ CURB_DEFINE(CURLOPT_FNMATCH_FUNCTION);
413
+ #endif
414
+ #if HAVE_CURLOPT_FNMATCH_DATA
415
+ CURB_DEFINE(CURLOPT_FNMATCH_DATA);
416
+ #endif
417
+ #if HAVE_CURLOPT_ERRORBUFFER
418
+ CURB_DEFINE(CURLOPT_ERRORBUFFER);
419
+ #endif
420
+ #if HAVE_CURLOPT_STDERR
421
+ CURB_DEFINE(CURLOPT_STDERR);
422
+ #endif
423
+ #if HAVE_CURLOPT_FAILONERROR
424
+ CURB_DEFINE(CURLOPT_FAILONERROR);
425
+ #endif
426
+ CURB_DEFINE(CURLOPT_URL);
427
+ #if HAVE_CURLOPT_PROTOCOLS
428
+ CURB_DEFINE(CURLOPT_PROTOCOLS);
429
+ #endif
430
+ #if HAVE_CURLOPT_REDIR_PROTOCOLS
431
+ CURB_DEFINE(CURLOPT_REDIR_PROTOCOLS);
432
+ #endif
433
+ CURB_DEFINE(CURLOPT_PROXY);
434
+ CURB_DEFINE(CURLOPT_PROXYPORT);
435
+ #if HAVE_CURLOPT_PROXYTYPE
436
+ CURB_DEFINE(CURLOPT_PROXYTYPE);
437
+ #endif
438
+ #if HAVE_CURLOPT_NOPROXY
439
+ CURB_DEFINE(CURLOPT_NOPROXY);
440
+ #endif
441
+ CURB_DEFINE(CURLOPT_HTTPPROXYTUNNEL);
442
+ #if HAVE_CURLOPT_SOCKS5_GSSAPI_SERVICE
443
+ CURB_DEFINE(CURLOPT_SOCKS5_GSSAPI_SERVICE);
444
+ #endif
445
+ #if HAVE_CURLOPT_SOCKS5_GSSAPI_NEC
446
+ CURB_DEFINE(CURLOPT_SOCKS5_GSSAPI_NEC);
447
+ #endif
448
+ CURB_DEFINE(CURLOPT_INTERFACE);
449
+ #if HAVE_CURLOPT_LOCALPORT
450
+ CURB_DEFINE(CURLOPT_LOCALPORT);
451
+ #endif
452
+ CURB_DEFINE(CURLOPT_DNS_CACHE_TIMEOUT);
453
+ CURB_DEFINE(CURLOPT_DNS_USE_GLOBAL_CACHE);
454
+ CURB_DEFINE(CURLOPT_BUFFERSIZE);
455
+ CURB_DEFINE(CURLOPT_PORT);
456
+ CURB_DEFINE(CURLOPT_TCP_NODELAY);
457
+ #if HAVE_CURLOPT_ADDRESS_SCOPE
458
+ CURB_DEFINE(CURLOPT_ADDRESS_SCOPE);
459
+ #endif
460
+ CURB_DEFINE(CURLOPT_NETRC);
461
+ CURB_DEFINE(CURL_NETRC_OPTIONAL);
462
+ CURB_DEFINE(CURL_NETRC_IGNORED);
463
+ CURB_DEFINE(CURL_NETRC_REQUIRED);
464
+ #if HAVE_CURLOPT_NETRC_FILE
465
+ CURB_DEFINE(CURLOPT_NETRC_FILE);
466
+ #endif
467
+ CURB_DEFINE(CURLOPT_USERPWD);
468
+ CURB_DEFINE(CURLOPT_PROXYUSERPWD);
469
+ #if HAVE_CURLOPT_USERNAME
470
+ CURB_DEFINE(CURLOPT_USERNAME);
471
+ #endif
472
+ #if HAVE_CURLOPT_PASSWORD
473
+ CURB_DEFINE(CURLOPT_PASSWORD);
474
+ #endif
475
+ #if HAVE_CURLOPT_PROXYUSERNAME
476
+ CURB_DEFINE(CURLOPT_PASSWORD);
477
+ #endif
478
+ #if HAVE_CURLOPT_PROXYPASSWORD
479
+ CURB_DEFINE(CURLOPT_PASSWORD);
480
+ #endif
481
+
482
+ #if HAVE_CURLOPT_HTTPAUTH
483
+ CURB_DEFINE(CURLOPT_HTTPAUTH);
484
+ #endif
485
+ #if HAVE_CURLAUTH_DIGEST_IE
486
+ CURB_DEFINE(CURLAUTH_DIGEST_IE);
487
+ #endif
488
+ #if HAVE_CURLAUTH_ONLY
489
+ CURB_DEFINE(CURLAUTH_ONLY);
490
+ #endif
491
+ #if HAVE_CURLOPT_TLSAUTH_TYPE
492
+ CURB_DEFINE(CURLOPT_TLSAUTH_TYPE);
493
+ #endif
494
+ #if HAVE_CURLOPT_TLSAUTH_SRP
495
+ CURB_DEFINE(CURLOPT_TLSAUTH_SRP);
496
+ #endif
497
+ #if HAVE_CURLOPT_TLSAUTH_USERNAME
498
+ CURB_DEFINE(CURLOPT_TLSAUTH_USERNAME);
499
+ #endif
500
+ #if HAVE_CURLOPT_TLSAUTH_PASSWORD
501
+ CURB_DEFINE(CURLOPT_TLSAUTH_PASSWORD);
502
+ #endif
503
+ #if HAVE_CURLOPT_PROXYAUTH
504
+ CURB_DEFINE(CURLOPT_PROXYAUTH);
505
+ #endif
506
+ #if HAVE_CURLOPT_AUTOREFERER
507
+ CURB_DEFINE(CURLOPT_AUTOREFERER);
508
+ #endif
509
+ #if HAVE_CURLOPT_ENCODING
510
+ CURB_DEFINE(CURLOPT_ENCODING);
511
+ #endif
512
+ #if HAVE_CURLOPT_FOLLOWLOCATION
513
+ CURB_DEFINE(CURLOPT_FOLLOWLOCATION);
514
+ #endif
515
+ #if HAVE_CURLOPT_UNRESTRICTED_AUTH
516
+ CURB_DEFINE(CURLOPT_UNRESTRICTED_AUTH);
517
+ #endif
518
+ #if HAVE_CURLOPT_MAXREDIRS
519
+ CURB_DEFINE(CURLOPT_MAXREDIRS);
520
+ #endif
521
+ #if HAVE_CURLOPT_POSTREDIR
522
+ CURB_DEFINE(CURLOPT_POSTREDIR);
523
+ #endif
524
+ #if HAVE_CURLOPT_PUT
525
+ CURB_DEFINE(CURLOPT_PUT);
526
+ #endif
527
+ #if HAVE_CURLOPT_POST
528
+ CURB_DEFINE(CURLOPT_POST);
529
+ #endif
530
+ CURB_DEFINE(CURLOPT_POSTFIELDS);
531
+ CURB_DEFINE(CURLOPT_POSTFIELDSIZE);
532
+ #if HAVE_CURLOPT_POSTFIELDSIZE_LARGE
533
+ CURB_DEFINE(CURLOPT_POSTFIELDSIZE_LARGE);
534
+ #endif
535
+ #if HAVE_CURLOPT_COPYPOSTFIELDS
536
+ CURB_DEFINE(CURLOPT_COPYPOSTFIELDS);
537
+ #endif
538
+ #if HAVE_CURLOPT_HTTPPOST
539
+ CURB_DEFINE(CURLOPT_HTTPPOST);
540
+ #endif
541
+ CURB_DEFINE(CURLOPT_REFERER);
542
+ CURB_DEFINE(CURLOPT_USERAGENT);
543
+ CURB_DEFINE(CURLOPT_HTTPHEADER);
544
+ #if HAVE_CURLOPT_HTTP200ALIASES
545
+ CURB_DEFINE(CURLOPT_HTTP200ALIASES);
546
+ #endif
547
+
548
+ CURB_DEFINE(CURLOPT_COOKIE);
549
+ CURB_DEFINE(CURLOPT_COOKIEFILE);
550
+ CURB_DEFINE(CURLOPT_COOKIEJAR);
551
+
552
+ #if HAVE_CURLOPT_COOKIESESSION
553
+ CURB_DEFINE(CURLOPT_COOKIESESSION);
554
+ #endif
555
+ #if HAVE_CURLOPT_COOKIELIST
556
+ CURB_DEFINE(CURLOPT_COOKIELIST);
557
+ #endif
558
+ #if HAVE_CURLOPT_HTTPGET
559
+ CURB_DEFINE(CURLOPT_HTTPGET);
560
+ #endif
561
+ CURB_DEFINE(CURLOPT_HTTP_VERSION);
562
+ CURB_DEFINE(CURL_HTTP_VERSION_NONE);
563
+ CURB_DEFINE(CURL_HTTP_VERSION_1_0);
564
+ CURB_DEFINE(CURL_HTTP_VERSION_1_1);
565
+ #if HAVE_CURLOPT_IGNORE_CONTENT_LENGTH
566
+ CURB_DEFINE(CURLOPT_IGNORE_CONTENT_LENGTH);
567
+ #endif
568
+ #if HAVE_CURLOPT_HTTP_CONTENT_DECODING
569
+ CURB_DEFINE(CURLOPT_HTTP_CONTENT_DECODING);
570
+ #endif
571
+ #if HAVE_CURLOPT_HTTP_TRANSFER_DECODING
572
+ CURB_DEFINE(CURLOPT_HTTP_TRANSFER_DECODING);
573
+ #endif
574
+ #if HAVE_CURLOPT_MAIL_FROM
575
+ CURB_DEFINE(CURLOPT_MAIL_FROM);
576
+ #endif
577
+ #if HAVE_CURLOPT_MAIL_RCPT
578
+ CURB_DEFINE(CURLOPT_MAIL_RCPT);
579
+ #endif
580
+ #if HAVE_CURLOPT_TFTP_BLKSIZE
581
+ CURB_DEFINE(CURLOPT_TFTP_BLKSIZE);
582
+ #endif
583
+ #if HAVE_CURLOPT_FTPPORT
584
+ CURB_DEFINE(CURLOPT_FTPPORT);
585
+ #endif
586
+ #if HAVE_CURLOPT_QUOTE
587
+ CURB_DEFINE(CURLOPT_QUOTE);
588
+ #endif
589
+ #if HAVE_CURLOPT_POSTQUOTE
590
+ CURB_DEFINE(CURLOPT_POSTQUOTE);
591
+ #endif
592
+ #if HAVE_CURLOPT_PREQUOTE
593
+ CURB_DEFINE(CURLOPT_PREQUOTE);
594
+ #endif
595
+ #if HAVE_CURLOPT_DIRLISTONLY
596
+ CURB_DEFINE(CURLOPT_DIRLISTONLY);
597
+ #endif
598
+ #if HAVE_CURLOPT_APPEND
599
+ CURB_DEFINE(CURLOPT_APPEND);
600
+ #endif
601
+ #if HAVE_CURLOPT_FTP_USE_EPRT
602
+ CURB_DEFINE(CURLOPT_FTP_USE_EPRT);
603
+ #endif
604
+ #if HAVE_CURLOPT_FTP_USE_EPSV
605
+ CURB_DEFINE(CURLOPT_FTP_USE_EPSV);
606
+ #endif
607
+ #if HAVE_CURLOPT_FTP_USE_PRET
608
+ CURB_DEFINE(CURLOPT_FTP_USE_PRET);
609
+ #endif
610
+ #if HAVE_CURLOPT_FTP_CREATE_MISSING_DIRS
611
+ CURB_DEFINE(CURLOPT_FTP_CREATE_MISSING_DIRS);
612
+ #endif
613
+ #if HAVE_CURLOPT_FTP_RESPONSE_TIMEOUT
614
+ CURB_DEFINE(CURLOPT_FTP_RESPONSE_TIMEOUT);
615
+ #endif
616
+ #if HAVE_CURLOPT_FTP_ALTERNATIVE_TO_USER
617
+ CURB_DEFINE(CURLOPT_FTP_ALTERNATIVE_TO_USER);
618
+ #endif
619
+ #if HAVE_CURLOPT_FTP_SKIP_PASV_IP
620
+ CURB_DEFINE(CURLOPT_FTP_SKIP_PASV_IP);
621
+ #endif
622
+ #if HAVE_CURLOPT_FTPSSLAUTH
623
+ CURB_DEFINE(CURLOPT_FTPSSLAUTH);
624
+ #endif
625
+ #if HAVE_CURLFTPAUTH_DEFAULT
626
+ CURB_DEFINE(CURLFTPAUTH_DEFAULT);
627
+ #endif
628
+ #if HAVE_CURLFTPAUTH_SSL
629
+ CURB_DEFINE(CURLFTPAUTH_SSL);
630
+ #endif
631
+ #if HAVE_CURLFTPAUTH_TLS
632
+ CURB_DEFINE(CURLFTPAUTH_TLS);
633
+ #endif
634
+ #if HAVE_CURLOPT_FTP_SSL_CCC
635
+ CURB_DEFINE(CURLOPT_FTP_SSL_CCC);
636
+ #endif
637
+ #if HAVE_CURLFTPSSL_CCC_NONE
638
+ CURB_DEFINE(CURLFTPSSL_CCC_NONE);
639
+ #endif
640
+ #if HAVE_CURLFTPSSL_CCC_PASSIVE
641
+ CURB_DEFINE(CURLFTPSSL_CCC_PASSIVE);
642
+ #endif
643
+ #if HAVE_CURLFTPSSL_CCC_ACTIVE
644
+ CURB_DEFINE(CURLFTPSSL_CCC_ACTIVE);
645
+ #endif
646
+ #if HAVE_CURLOPT_FTP_ACCOUNT
647
+ CURB_DEFINE(CURLOPT_FTP_ACCOUNT);
648
+ #endif
649
+ #if HAVE_CURLOPT_FTP_FILEMETHOD
650
+ CURB_DEFINE(CURLOPT_FTP_FILEMETHOD);
651
+ #endif
652
+ #if HAVE_CURLFTPMETHOD_MULTICWD
653
+ CURB_DEFINE(CURLFTPMETHOD_MULTICWD);
654
+ #endif
655
+ #if HAVE_CURLFTPMETHOD_NOCWD
656
+ CURB_DEFINE(CURLFTPMETHOD_NOCWD);
657
+ #endif
658
+ #if HAVE_CURLFTPMETHOD_SINGLECWD
659
+ CURB_DEFINE(CURLFTPMETHOD_SINGLECWD);
660
+ #endif
661
+ #if HAVE_CURLOPT_RTSP_REQUEST
662
+ CURB_DEFINE(CURLOPT_RTSP_REQUEST);
663
+ #endif
664
+ #if HAVE_CURL_RTSPREQ_OPTIONS
665
+ CURB_DEFINE(CURL_RTSPREQ_OPTIONS);
666
+ #endif
667
+ #if HAVE_CURL_RTSPREQ_DESCRIBE
668
+ CURB_DEFINE(CURL_RTSPREQ_DESCRIBE);
669
+ #endif
670
+ #if HAVE_CURL_RTSPREQ_ANNOUNCE
671
+ CURB_DEFINE(CURL_RTSPREQ_ANNOUNCE);
672
+ #endif
673
+ #if HAVE_CURL_RTSPREQ_SETUP
674
+ CURB_DEFINE(CURL_RTSPREQ_SETUP);
675
+ #endif
676
+ #if HAVE_CURL_RTSPREQ_PLAY
677
+ CURB_DEFINE(CURL_RTSPREQ_PLAY);
678
+ #endif
679
+ #if HAVE_CURL_RTSPREQ_PAUSE
680
+ CURB_DEFINE(CURL_RTSPREQ_PAUSE);
681
+ #endif
682
+ #if HAVE_CURL_RTSPREQ_TEARDOWN
683
+ CURB_DEFINE(CURL_RTSPREQ_TEARDOWN);
684
+ #endif
685
+ #if HAVE_CURL_RTSPREQ_GET_PARAMETER
686
+ CURB_DEFINE(CURL_RTSPREQ_GET_PARAMETER);
687
+ #endif
688
+ #if HAVE_CURL_RTSPREQ_SET_PARAMETER
689
+ CURB_DEFINE(CURL_RTSPREQ_SET_PARAMETER);
690
+ #endif
691
+ #if HAVE_CURL_RTSPREQ_RECORD
692
+ CURB_DEFINE(CURL_RTSPREQ_RECORD);
693
+ #endif
694
+ #if HAVE_CURL_RTSPREQ_RECEIVE
695
+ CURB_DEFINE(CURL_RTSPREQ_RECEIVE);
696
+ #endif
697
+ #if HAVE_CURLOPT_RTSP_SESSION_ID
698
+ CURB_DEFINE(CURLOPT_RTSP_SESSION_ID);
699
+ #endif
700
+ #if HAVE_CURLOPT_RTSP_STREAM_URI
701
+ CURB_DEFINE(CURLOPT_RTSP_STREAM_URI);
702
+ #endif
703
+ #if HAVE_CURLOPT_RTSP_TRANSPORT
704
+ CURB_DEFINE(CURLOPT_RTSP_TRANSPORT);
705
+ #endif
706
+ #if HAVE_CURLOPT_RTSP_HEADER
707
+ CURB_DEFINE(CURLOPT_RTSP_HEADER);
708
+ #endif
709
+ #if HAVE_CURLOPT_RTSP_CLIENT_CSEQ
710
+ CURB_DEFINE(CURLOPT_RTSP_CLIENT_CSEQ);
711
+ #endif
712
+ #if HAVE_CURLOPT_RTSP_SERVER_CSEQ
713
+ CURB_DEFINE(CURLOPT_RTSP_SERVER_CSEQ);
714
+ #endif
715
+
716
+ CURB_DEFINE(CURLOPT_TRANSFERTEXT);
717
+ #if HAVE_CURLOPT_PROXY_TRANSFER_MODE
718
+ CURB_DEFINE(CURLOPT_PROXY_TRANSFER_MODE);
719
+ #endif
720
+ #if HAVE_CURLOPT_CRLF
721
+ CURB_DEFINE(CURLOPT_CRLF);
722
+ #endif
723
+ #if HAVE_CURLOPT_RANGE
724
+ CURB_DEFINE(CURLOPT_RANGE);
725
+ #endif
726
+ #if HAVE_CURLOPT_RESUME_FROM
727
+ CURB_DEFINE(CURLOPT_RESUME_FROM);
728
+ #endif
729
+ #if HAVE_CURLOPT_RESUME_FROM_LARGE
730
+ CURB_DEFINE(CURLOPT_RESUME_FROM_LARGE);
731
+ #endif
732
+ #if HAVE_CURLOPT_CUSTOMREQUEST
733
+ CURB_DEFINE(CURLOPT_CUSTOMREQUEST);
734
+ #endif
735
+ #if HAVE_CURLOPT_FILETIME
736
+ CURB_DEFINE(CURLOPT_FILETIME);
737
+ #endif
738
+ #if HAVE_CURLOPT_NOBODY
739
+ CURB_DEFINE(CURLOPT_NOBODY);
740
+ #endif
741
+ #if HAVE_CURLOPT_INFILESIZE
742
+ CURB_DEFINE(CURLOPT_INFILESIZE);
743
+ #endif
744
+ #if HAVE_CURLOPT_INFILESIZE_LARGE
745
+ CURB_DEFINE(CURLOPT_INFILESIZE_LARGE);
746
+ #endif
747
+ #if HAVE_CURLOPT_UPLOAD
748
+ CURB_DEFINE(CURLOPT_UPLOAD);
749
+ #endif
750
+ #if HAVE_CURLOPT_MAXFILESIZE
751
+ CURB_DEFINE(CURLOPT_MAXFILESIZE);
752
+ #endif
753
+ #if HAVE_CURLOPT_MAXFILESIZE_LARGE
754
+ CURB_DEFINE(CURLOPT_MAXFILESIZE_LARGE);
755
+ #endif
756
+ #if HAVE_CURLOPT_TIMECONDITION
757
+ CURB_DEFINE(CURLOPT_TIMECONDITION);
758
+ #endif
759
+ #if HAVE_CURLOPT_TIMEVALUE
760
+ CURB_DEFINE(CURLOPT_TIMEVALUE);
761
+ #endif
762
+
763
+ #if HAVE_CURLOPT_TIMEOUT
764
+ CURB_DEFINE(CURLOPT_TIMEOUT);
765
+ #endif
766
+ #if HAVE_CURLOPT_TIMEOUT_MS
767
+ CURB_DEFINE(CURLOPT_TIMEOUT_MS);
768
+ #endif
769
+ #if HAVE_CURLOPT_LOW_SPEED_LIMIT
770
+ CURB_DEFINE(CURLOPT_LOW_SPEED_LIMIT);
771
+ #endif
772
+ #if HAVE_CURLOPT_LOW_SPEED_TIME
773
+ CURB_DEFINE(CURLOPT_LOW_SPEED_TIME);
774
+ #endif
775
+ #if HAVE_CURLOPT_MAX_SEND_SPEED_LARGE
776
+ CURB_DEFINE(CURLOPT_MAX_SEND_SPEED_LARGE);
777
+ #endif
778
+ #if HAVE_CURLOPT_MAX_RECV_SPEED_LARGE
779
+ CURB_DEFINE(CURLOPT_MAX_RECV_SPEED_LARGE);
780
+ #endif
781
+ #if HAVE_CURLOPT_MAXCONNECTS
782
+ CURB_DEFINE(CURLOPT_MAXCONNECTS);
783
+ #endif
784
+ #if HAVE_CURLOPT_CLOSEPOLICY
785
+ CURB_DEFINE(CURLOPT_CLOSEPOLICY);
786
+ #endif
787
+ #if HAVE_CURLOPT_FRESH_CONNECT
788
+ CURB_DEFINE(CURLOPT_FRESH_CONNECT);
789
+ #endif
790
+ #if HAVE_CURLOPT_FORBID_REUSE
791
+ CURB_DEFINE(CURLOPT_FORBID_REUSE);
792
+ #endif
793
+ #if HAVE_CURLOPT_CONNECTTIMEOUT
794
+ CURB_DEFINE(CURLOPT_CONNECTTIMEOUT);
795
+ #endif
796
+ #if HAVE_CURLOPT_CONNECTTIMEOUT_MS
797
+ CURB_DEFINE(CURLOPT_CONNECTTIMEOUT_MS);
798
+ #endif
799
+ #if HAVE_CURLOPT_IPRESOLVE
800
+ CURB_DEFINE(CURLOPT_IPRESOLVE);
801
+ #endif
802
+ #if HAVE_CURL_IPRESOLVE_WHATEVER
803
+ CURB_DEFINE(CURL_IPRESOLVE_WHATEVER);
804
+ #endif
805
+ #if HAVE_CURL_IPRESOLVE_V4
806
+ CURB_DEFINE(CURL_IPRESOLVE_V4);
807
+ #endif
808
+ #if HAVE_CURL_IPRESOLVE_V6
809
+ CURB_DEFINE(CURL_IPRESOLVE_V6);
810
+ #endif
811
+ #if HAVE_CURLOPT_CONNECT_ONLY
812
+ CURB_DEFINE(CURLOPT_CONNECT_ONLY);
813
+ #endif
814
+ #if HAVE_CURLOPT_USE_SSL
815
+ CURB_DEFINE(CURLOPT_USE_SSL);
816
+ #endif
817
+ #if HAVE_CURLUSESSL_NONE
818
+ CURB_DEFINE(CURLUSESSL_NONE);
819
+ #endif
820
+ #if HAVE_CURLUSESSL_TRY
821
+ CURB_DEFINE(CURLUSESSL_TRY);
822
+ #endif
823
+ #if HAVE_CURLUSESSL_CONTROL
824
+ CURB_DEFINE(CURLUSESSL_CONTROL);
825
+ #endif
826
+ #if HAVE_CURLUSESSL_ALL
827
+ CURB_DEFINE(CURLUSESSL_ALL);
828
+ #endif
829
+ #if HAVE_CURLOPT_RESOLVE
830
+ CURB_DEFINE(CURLOPT_RESOLVE);
831
+ #endif
832
+
833
+ #if HAVE_CURLOPT_SSLCERT
834
+ CURB_DEFINE(CURLOPT_SSLCERT);
835
+ #endif
836
+ #if HAVE_CURLOPT_SSLCERTTYPE
837
+ CURB_DEFINE(CURLOPT_SSLCERTTYPE);
838
+ #endif
839
+ #if HAVE_CURLOPT_SSLKEY
840
+ CURB_DEFINE(CURLOPT_SSLKEY);
841
+ #endif
842
+ #if HAVE_CURLOPT_SSLKEYTYPE
843
+ CURB_DEFINE(CURLOPT_SSLKEYTYPE);
844
+ #endif
845
+ #if HAVE_CURLOPT_KEYPASSWD
846
+ CURB_DEFINE(CURLOPT_KEYPASSWD);
847
+ #endif
848
+ #if HAVE_CURLOPT_SSLENGINE
849
+ CURB_DEFINE(CURLOPT_SSLENGINE);
850
+ #endif
851
+ #if HAVE_CURLOPT_SSLENGINE_DEFAULT
852
+ CURB_DEFINE(CURLOPT_SSLENGINE_DEFAULT);
853
+ #endif
854
+ #if HAVE_CURLOPT_SSLVERSION
855
+ CURB_DEFINE(CURLOPT_SSLVERSION);
856
+ #endif
857
+ #if HAVE_CURL_SSLVERSION_TLSv1
858
+ CURB_DEFINE(CURL_SSLVERSION_TLSv1);
859
+ #endif
860
+ #if HAVE_CURL_SSLVERSION_SSLv2
861
+ CURB_DEFINE(CURL_SSLVERSION_SSLv2);
862
+ #endif
863
+ #if HAVE_CURL_SSLVERSION_SSLv3
864
+ CURB_DEFINE(CURL_SSLVERSION_SSLv3);
865
+ #endif
866
+ #if HAVE_CURLOPT_SSL_VERIFYPEER
867
+ CURB_DEFINE(CURLOPT_SSL_VERIFYPEER);
868
+ #endif
869
+ #if HAVE_CURLOPT_CAINFO
870
+ CURB_DEFINE(CURLOPT_CAINFO);
871
+ #endif
872
+ #if HAVE_CURLOPT_ISSUERCERT
873
+ CURB_DEFINE(CURLOPT_ISSUERCERT);
874
+ #endif
875
+ #if HAVE_CURLOPT_CAPATH
876
+ CURB_DEFINE(CURLOPT_CAPATH);
877
+ #endif
878
+ #if HAVE_CURLOPT_CRLFILE
879
+ CURB_DEFINE(CURLOPT_CRLFILE);
880
+ #endif
881
+ #if HAVE_CURLOPT_SSL_VERIFYHOST
882
+ CURB_DEFINE(CURLOPT_SSL_VERIFYHOST);
883
+ #endif
884
+ #if HAVE_CURLOPT_CERTINFO
885
+ CURB_DEFINE(CURLOPT_CERTINFO);
886
+ #endif
887
+ #if HAVE_CURLOPT_RANDOM_FILE
888
+ CURB_DEFINE(CURLOPT_RANDOM_FILE);
889
+ #endif
890
+ #if HAVE_CURLOPT_EGDSOCKET
891
+ CURB_DEFINE(CURLOPT_EGDSOCKET);
892
+ #endif
893
+ #if HAVE_CURLOPT_SSL_CIPHER_LIST
894
+ CURB_DEFINE(CURLOPT_SSL_CIPHER_LIST);
895
+ #endif
896
+ #if HAVE_CURLOPT_SSL_SESSIONID_CACHE
897
+ CURB_DEFINE(CURLOPT_SSL_SESSIONID_CACHE);
898
+ #endif
899
+ #if HAVE_CURLOPT_KRBLEVEL
900
+ CURB_DEFINE(CURLOPT_KRBLEVEL);
901
+ #endif
902
+
903
+ #if HAVE_CURLOPT_SSH_AUTH_TYPES
904
+ CURB_DEFINE(CURLOPT_SSH_AUTH_TYPES);
905
+ #endif
906
+ #if HAVE_CURLOPT_SSH_HOST_PUBLIC_KEY_MD5
907
+ CURB_DEFINE(CURLOPT_SSH_HOST_PUBLIC_KEY_MD5);
908
+ #endif
909
+ #if HAVE_CURLOPT_SSH_PUBLIC_KEYFILE
910
+ CURB_DEFINE(CURLOPT_SSH_PUBLIC_KEYFILE);
911
+ #endif
912
+ #if HAVE_CURLOPT_SSH_PRIVATE_KEYFILE
913
+ CURB_DEFINE(CURLOPT_SSH_PRIVATE_KEYFILE);
914
+ #endif
915
+ #if HAVE_CURLOPT_SSH_KNOWNHOSTS
916
+ CURB_DEFINE(CURLOPT_SSH_KNOWNHOSTS);
917
+ #endif
918
+ #if HAVE_CURLOPT_SSH_KEYFUNCTION
919
+ CURB_DEFINE(CURLOPT_SSH_KEYFUNCTION);
920
+ #endif
921
+ #if HAVE_CURLKHSTAT_FINE_ADD_TO_FILE
922
+ CURB_DEFINE(CURLKHSTAT_FINE_ADD_TO_FILE);
923
+ #endif
924
+ #if HAVE_CURLKHSTAT_FINE
925
+ CURB_DEFINE(CURLKHSTAT_FINE);
926
+ #endif
927
+ #if HAVE_CURLKHSTAT_REJECT
928
+ CURB_DEFINE(CURLKHSTAT_REJECT);
929
+ #endif
930
+ #if HAVE_CURLKHSTAT_DEFER
931
+ CURB_DEFINE(CURLKHSTAT_DEFER);
932
+ #endif
933
+ #if HAVE_CURLOPT_SSH_KEYDATA
934
+ CURB_DEFINE(CURLOPT_SSH_KEYDATA);
935
+ #endif
936
+
937
+ #if HAVE_CURLOPT_PRIVATE
938
+ CURB_DEFINE(CURLOPT_PRIVATE);
939
+ #endif
940
+ #if HAVE_CURLOPT_SHARE
941
+ CURB_DEFINE(CURLOPT_SHARE);
942
+ #endif
943
+ #if HAVE_CURLOPT_NEW_FILE_PERMS
944
+ CURB_DEFINE(CURLOPT_NEW_FILE_PERMS);
945
+ #endif
946
+ #if HAVE_CURLOPT_NEW_DIRECTORY_PERMS
947
+ CURB_DEFINE(CURLOPT_NEW_DIRECTORY_PERMS);
948
+ #endif
949
+
950
+ #if HAVE_CURLOPT_TELNETOPTIONS
951
+ CURB_DEFINE(CURLOPT_TELNETOPTIONS);
952
+ #endif
953
+
954
+ rb_define_const(mCurl, "HTTP_1_1", LONG2NUM(CURL_HTTP_VERSION_1_1));
955
+ rb_define_const(mCurl, "HTTP_1_0", LONG2NUM(CURL_HTTP_VERSION_1_0));
956
+ rb_define_const(mCurl, "HTTP_NONE", LONG2NUM(CURL_HTTP_VERSION_NONE));
957
+
958
+ rb_define_singleton_method(mCurl, "ipv6?", ruby_curl_ipv6_q, 0);
959
+ rb_define_singleton_method(mCurl, "kerberos4?", ruby_curl_kerberos4_q, 0);
960
+ rb_define_singleton_method(mCurl, "ssl?", ruby_curl_ssl_q, 0);
961
+ rb_define_singleton_method(mCurl, "libz?", ruby_curl_libz_q, 0);
962
+ rb_define_singleton_method(mCurl, "ntlm?", ruby_curl_ntlm_q, 0);
963
+ rb_define_singleton_method(mCurl, "gssnegotiate?", ruby_curl_gssnegotiate_q, 0);
964
+ rb_define_singleton_method(mCurl, "debug?", ruby_curl_debug_q, 0);
965
+ rb_define_singleton_method(mCurl, "asyncdns?", ruby_curl_asyncdns_q, 0);
966
+ rb_define_singleton_method(mCurl, "spnego?", ruby_curl_spnego_q, 0);
967
+ rb_define_singleton_method(mCurl, "largefile?", ruby_curl_largefile_q, 0);
968
+ rb_define_singleton_method(mCurl, "idn?", ruby_curl_idn_q, 0);
969
+ rb_define_singleton_method(mCurl, "sspi?", ruby_curl_sspi_q, 0);
970
+ rb_define_singleton_method(mCurl, "conv?", ruby_curl_conv_q, 0);
971
+
972
+ init_curb_errors();
973
+ init_curb_easy();
974
+ init_curb_postfield();
975
+ init_curb_multi();
976
+ init_curb_upload();
977
+ }