lib/ethon/curl.rb in ethon-0.0.2 vs lib/ethon/curl.rb in ethon-0.0.3
- old
+ new
@@ -1,7 +1,8 @@
module Ethon
- # :nodoc:
+
+ # FFI Wrapper module for Curl. Holds constants and required initializers.
module Curl
# :nodoc:
def Curl.windows?
!(RbConfig::CONFIG['host_os'] !~ /mingw|mswin|bccwin/)
end
@@ -9,20 +10,21 @@
extend ::FFI::Library
# :nodoc:
VERSION_NOW = 3
- # :nodoc:
+ # Flag. Initialize SSL.
GLOBAL_SSL = 0x01
- # :nodoc:
+ # Flag. Initialize win32 socket libraries.
GLOBAL_WIN32 = 0x02
- # :nodoc:
+ # Flag. Initialize everything possible.
GLOBAL_ALL = (GLOBAL_SSL | GLOBAL_WIN32)
- # :nodoc:
+ # Flag. Initialize everything by default.
GLOBAL_DEFAULT = GLOBAL_ALL
- # :nodoc:
+ # Libcurl error codes, refer
+ # https://github.com/bagder/curl/blob/master/include/curl/curl.h for details
EasyCode = enum :easy_code, [
:ok,
:unsupported_protocol,
:failed_init,
:url_malformat,
@@ -111,11 +113,12 @@
:rtsp_session_error,
:ftp_bad_file_list,
:chunk_failed,
:last]
- # :nodoc:
+ # Curl-Multi socket error codes, refer
+ # https://github.com/bagder/curl/blob/master/include/curl/multi.h for details
MultiCode = enum :multi_code, [
:call_multi_perform, -1,
:ok,
:bad_handle,
:bad_easy_handle,
@@ -130,11 +133,12 @@
:long, 0,
:object_point, 10000,
:function_point, 20000,
:off_t, 30000]
- # :nodoc:
+ # Curl options, refer
+ # https://github.com/bagder/curl/blob/master/src/tool_cfgable.h for details
Option = enum :option, [
:file, OptionType[:object_point] + 1,
:writedata, OptionType[:object_point] + 1,
:url, OptionType[:object_point] + 2,
:port, OptionType[:long] + 3,
@@ -280,11 +284,12 @@
:string, 0x100000,
:long, 0x200000,
:double, 0x300000,
:slist, 0x400000]
- # :nodoc:
+ # Info details, refer
+ # https://github.com/bagder/curl/blob/master/src/tool_writeout.c#L66 for details
Info = enum :info, [
:effective_url, InfoType[:string] + 1,
:response_code, InfoType[:long] + 2,
:total_time, InfoType[:double] + 3,
:namelookup_time, InfoType[:double] + 4,
@@ -326,10 +331,11 @@
:primary_port, InfoType[:long] + 40,
:local_ip, InfoType[:string] + 41,
:local_port, InfoType[:long] + 42,
:last, 42]
- # :nodoc:
+ # Form options, used by FormAdd for temporary storage, refer
+ # https://github.com/bagder/curl/blob/master/lib/formdata.h#L51 for details
FormOption = enum :form_option, [
:none,
:copyname,
:ptrname,
:namelength,