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
@@ -0,0 +1,40 @@
1
+ /* curb_postfield.h - Field class for POST method
2
+ * Copyright (c)2006 Ross Bamford.
3
+ * Licensed under the Ruby License. See LICENSE for details.
4
+ *
5
+ * $Id: curb_postfield.h 4 2006-11-17 18:35:31Z roscopeco $
6
+ */
7
+ #ifndef __CURB_POSTFIELD_H
8
+ #define __CURB_POSTFIELD_H
9
+
10
+ #include "curb.h"
11
+
12
+ /*
13
+ * postfield doesn't actually wrap a curl_httppost - instead,
14
+ * it just holds together some ruby objects and has a C-side
15
+ * method to add it to a given form list during the perform.
16
+ */
17
+ typedef struct {
18
+ /* Objects we associate */
19
+ VALUE name;
20
+ VALUE content;
21
+ VALUE content_type;
22
+ VALUE content_proc;
23
+ VALUE local_file;
24
+ VALUE remote_file;
25
+
26
+ /* this will sometimes hold a string, which is the result
27
+ * of the content_proc invocation. We need it to hang around.
28
+ */
29
+ VALUE buffer_str;
30
+ } ruby_curl_postfield;
31
+
32
+ extern VALUE cCurlPostField;
33
+
34
+ void append_to_form(VALUE self,
35
+ struct curl_httppost **first,
36
+ struct curl_httppost **last);
37
+
38
+ void init_curb_postfield();
39
+
40
+ #endif
@@ -0,0 +1,80 @@
1
+ /* curb_upload.c - Curl upload handle
2
+ * Copyright (c)2009 Todd A Fisher.
3
+ * Licensed under the Ruby License. See LICENSE for details.
4
+ */
5
+ #include "curb_upload.h"
6
+ extern VALUE mCurl;
7
+ VALUE cCurlUpload;
8
+
9
+ #ifdef RDOC_NEVER_DEFINED
10
+ mCurl = rb_define_module("Curl");
11
+ #endif
12
+
13
+ static void curl_upload_mark(ruby_curl_upload *rbcu) {
14
+ if (rbcu->stream && !NIL_P(rbcu->stream)) rb_gc_mark(rbcu->stream);
15
+ }
16
+ static void curl_upload_free(ruby_curl_upload *rbcu) {
17
+ free(rbcu);
18
+ }
19
+
20
+ /*
21
+ * call-seq:
22
+ * internal class for sending large file uploads
23
+ */
24
+ VALUE ruby_curl_upload_new(VALUE klass) {
25
+ VALUE upload;
26
+ ruby_curl_upload *rbcu = ALLOC(ruby_curl_upload);
27
+ rbcu->stream = Qnil;
28
+ rbcu->offset = 0;
29
+ upload = Data_Wrap_Struct(klass, curl_upload_mark, curl_upload_free, rbcu);
30
+ return upload;
31
+ }
32
+
33
+ /*
34
+ * call-seq:
35
+ * internal class for sending large file uploads
36
+ */
37
+ VALUE ruby_curl_upload_stream_set(VALUE self, VALUE stream) {
38
+ ruby_curl_upload *rbcu;
39
+ Data_Get_Struct(self, ruby_curl_upload, rbcu);
40
+ rbcu->stream = stream;
41
+ return stream;
42
+ }
43
+ /*
44
+ * call-seq:
45
+ * internal class for sending large file uploads
46
+ */
47
+ VALUE ruby_curl_upload_stream_get(VALUE self) {
48
+ ruby_curl_upload *rbcu;
49
+ Data_Get_Struct(self, ruby_curl_upload, rbcu);
50
+ return rbcu->stream;
51
+ }
52
+ /*
53
+ * call-seq:
54
+ * internal class for sending large file uploads
55
+ */
56
+ VALUE ruby_curl_upload_offset_set(VALUE self, VALUE offset) {
57
+ ruby_curl_upload *rbcu;
58
+ Data_Get_Struct(self, ruby_curl_upload, rbcu);
59
+ rbcu->offset = FIX2LONG(offset);
60
+ return offset;
61
+ }
62
+ /*
63
+ * call-seq:
64
+ * internal class for sending large file uploads
65
+ */
66
+ VALUE ruby_curl_upload_offset_get(VALUE self) {
67
+ ruby_curl_upload *rbcu;
68
+ Data_Get_Struct(self, ruby_curl_upload, rbcu);
69
+ return INT2FIX(rbcu->offset);
70
+ }
71
+
72
+ /* =================== INIT LIB =====================*/
73
+ void init_curb_upload() {
74
+ cCurlUpload = rb_define_class_under(mCurl, "Upload", rb_cObject);
75
+ rb_define_singleton_method(cCurlUpload, "new", ruby_curl_upload_new, 0);
76
+ rb_define_method(cCurlUpload, "stream=", ruby_curl_upload_stream_set, 1);
77
+ rb_define_method(cCurlUpload, "stream", ruby_curl_upload_stream_get, 0);
78
+ rb_define_method(cCurlUpload, "offset=", ruby_curl_upload_offset_set, 1);
79
+ rb_define_method(cCurlUpload, "offset", ruby_curl_upload_offset_get, 0);
80
+ }
@@ -0,0 +1,30 @@
1
+ /* curb_upload.h - Curl upload handle
2
+ * Copyright (c)2009 Todd A Fisher.
3
+ * Licensed under the Ruby License. See LICENSE for details.
4
+ */
5
+ #ifndef __CURB_UPLOAD_H
6
+ #define __CURB_UPLOAD_H
7
+
8
+ #include "curb.h"
9
+
10
+ #include <curl/easy.h>
11
+
12
+ /*
13
+ * Maintain the state of an upload e.g. for putting large streams with very little memory
14
+ * out to a server. via PUT requests
15
+ */
16
+ typedef struct {
17
+ VALUE stream;
18
+ size_t offset;
19
+ } ruby_curl_upload;
20
+
21
+ extern VALUE cCurlUpload;
22
+ void init_curb_upload();
23
+
24
+ VALUE ruby_curl_upload_new(VALUE klass);
25
+ VALUE ruby_curl_upload_stream_set(VALUE self, VALUE stream);
26
+ VALUE ruby_curl_upload_stream_get(VALUE self);
27
+ VALUE ruby_curl_upload_offset_set(VALUE self, VALUE offset);
28
+ VALUE ruby_curl_upload_offset_get(VALUE self);
29
+
30
+ #endif
data/ext/curb/Makefile ADDED
@@ -0,0 +1,157 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ #### Start of system configuration section. ####
5
+
6
+ srcdir = .
7
+ topdir = /usr/lib/ruby/1.8/i686-linux
8
+ hdrdir = $(topdir)
9
+ VPATH = $(srcdir):$(topdir):$(hdrdir)
10
+ exec_prefix = $(prefix)
11
+ prefix = $(DESTDIR)/usr
12
+ sharedstatedir = $(prefix)/com
13
+ mandir = $(DESTDIR)/usr/share/man
14
+ psdir = $(docdir)
15
+ oldincludedir = $(DESTDIR)/usr/include
16
+ localedir = $(datarootdir)/locale
17
+ bindir = $(exec_prefix)/bin
18
+ libexecdir = $(exec_prefix)/libexec
19
+ sitedir = $(DESTDIR)/usr/lib/ruby/site_ruby
20
+ htmldir = $(docdir)
21
+ vendorarchdir = $(vendorlibdir)/$(sitearch)
22
+ includedir = $(prefix)/include
23
+ infodir = $(DESTDIR)/usr/share/info
24
+ vendorlibdir = $(vendordir)/$(ruby_version)
25
+ sysconfdir = $(DESTDIR)/etc
26
+ libdir = $(exec_prefix)/lib
27
+ sbindir = $(exec_prefix)/sbin
28
+ rubylibdir = $(libdir)/ruby/$(ruby_version)
29
+ docdir = $(datarootdir)/doc/$(PACKAGE)
30
+ dvidir = $(docdir)
31
+ vendordir = $(libdir)/ruby/vendor_ruby
32
+ datarootdir = $(prefix)/share
33
+ pdfdir = $(docdir)
34
+ archdir = $(rubylibdir)/$(arch)
35
+ sitearchdir = $(sitelibdir)/$(sitearch)
36
+ datadir = $(DESTDIR)/usr/share
37
+ localstatedir = $(DESTDIR)/var/lib
38
+ sitelibdir = $(sitedir)/$(ruby_version)
39
+
40
+ CC = i686-pc-linux-gnu-gcc
41
+ LIBRUBY = $(LIBRUBY_SO)
42
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
43
+ LIBRUBYARG_SHARED = -Wl,-R -Wl,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)
44
+ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
45
+
46
+ RUBY_EXTCONF_H = curb_config.h
47
+ CFLAGS = -fPIC -O2 -march=i686 -pipe -fno-strict-aliasing -fPIC $(cflags) -g -Wall
48
+ INCFLAGS = -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I.
49
+ DEFS = -D_FILE_OFFSET_BITS=64
50
+ CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\" -D_FILE_OFFSET_BITS=64
51
+ CXXFLAGS = $(CFLAGS)
52
+ ldflags = -L. -Wl,-O1 -Wl,--as-needed -rdynamic -Wl,-export-dynamic -Wl,--no-undefined
53
+ dldflags =
54
+ archflag =
55
+ DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
56
+ LDSHARED = $(CC) -shared
57
+ AR = i686-pc-linux-gnu-ar
58
+ EXEEXT =
59
+
60
+ RUBY_INSTALL_NAME = ruby18
61
+ RUBY_SO_NAME = ruby18
62
+ arch = i686-linux
63
+ sitearch = i686-linux
64
+ ruby_version = 1.8
65
+ ruby = /usr/bin/ruby18
66
+ RUBY = $(ruby)
67
+ RM = rm -f
68
+ MAKEDIRS = mkdir -p
69
+ INSTALL = /usr/bin/install -c
70
+ INSTALL_PROG = $(INSTALL) -m 0755
71
+ INSTALL_DATA = $(INSTALL) -m 644
72
+ COPY = cp
73
+
74
+ #### End of system configuration section. ####
75
+
76
+ preload =
77
+
78
+ libpath = . $(libdir)
79
+ LIBPATH = -L. -L$(libdir) -Wl,-R$(libdir)
80
+ DEFFILE =
81
+
82
+ CLEANFILES = mkmf.log
83
+ DISTCLEANFILES =
84
+
85
+ extout =
86
+ extout_prefix =
87
+ target_prefix =
88
+ LOCAL_LIBS =
89
+ LIBS = $(LIBRUBYARG_SHARED) -lpthread -lrt -ldl -lcrypt -lm -lc -lcurl -lrt -lz -L/usr/lib -lgnutls -lgcrypt -lgpg-error
90
+ SRCS = curb_errors.c curb_multi.c curb_upload.c curb.c curb_easy.c curb_postfield.c
91
+ OBJS = curb_errors.o curb_multi.o curb_upload.o curb.o curb_easy.o curb_postfield.o
92
+ TARGET = curb_core
93
+ DLLIB = $(TARGET).so
94
+ EXTSTATIC =
95
+ STATIC_LIB =
96
+
97
+ BINDIR = $(bindir)
98
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
99
+ RUBYLIBDIR = /usr/lib/ruby/gems/1.8/gems/curb-0.8.1/lib$(target_prefix)
100
+ RUBYARCHDIR = /usr/lib/ruby/gems/1.8/gems/curb-0.8.1/lib$(target_prefix)
101
+
102
+ TARGET_SO = $(DLLIB)
103
+ CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
104
+ CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
105
+
106
+ all: $(DLLIB)
107
+ static: $(STATIC_LIB)
108
+
109
+ clean:
110
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
111
+
112
+ distclean: clean
113
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
114
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
115
+
116
+ realclean: distclean
117
+ install: install-so install-rb
118
+
119
+ install-so: $(RUBYARCHDIR)
120
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
121
+ $(RUBYARCHDIR)/$(DLLIB): $(RUBYARCHDIR) $(DLLIB)
122
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
123
+ install-rb: pre-install-rb install-rb-default
124
+ install-rb-default: pre-install-rb-default
125
+ pre-install-rb: Makefile
126
+ pre-install-rb-default: Makefile
127
+ $(RUBYARCHDIR):
128
+ $(MAKEDIRS) $@
129
+
130
+ site-install: site-install-so site-install-rb
131
+ site-install-so: install-so
132
+ site-install-rb: install-rb
133
+
134
+ .SUFFIXES: .c .m .cc .cxx .cpp .C .o
135
+
136
+ .cc.o:
137
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
138
+
139
+ .cxx.o:
140
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
141
+
142
+ .cpp.o:
143
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
144
+
145
+ .C.o:
146
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
147
+
148
+ .c.o:
149
+ $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
150
+
151
+ $(DLLIB): $(OBJS) Makefile
152
+ @-$(RM) $@
153
+ $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
154
+
155
+
156
+
157
+ $(OBJS): ruby.h defines.h $(RUBY_EXTCONF_H)
data/ext/curb/curb.c ADDED
@@ -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
+ }