Module: Ethon::Curl Private

Extended by:
Ethon::Curls::Codes, Ethon::Curls::FormOptions, Ethon::Curls::Functions, Ethon::Curls::Infos, Ethon::Curls::Messages, Ethon::Curls::Options, FFI::Library
Defined in:
lib/ethon/curl.rb,
lib/ethon/curls/classes.rb,
lib/ethon/curls/settings.rb,
lib/ethon/curls/constants.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

FFI Wrapper module for Curl. Holds constants and required initializers.

Defined Under Namespace

Classes: FDSet, Msg, MsgData, Timeval, VersionInfoData

Constant Summary collapse

VERSION_NOW =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:nodoc:

3
GLOBAL_SSL =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Flag. Initialize SSL.

0x01
GLOBAL_WIN32 =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Flag. Initialize win32 socket libraries.

0x02
GLOBAL_ALL =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Flag. Initialize everything possible.

(GLOBAL_SSL | GLOBAL_WIN32)
GLOBAL_DEFAULT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Flag. Initialize everything by default.

GLOBAL_ALL
EasyCode =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:nodoc:

enum(:easy_code, easy_codes)
MultiCode =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:nodoc:

enum(:multi_code, multi_codes)
EasyOption =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:nodoc:

enum(:easy_option, easy_options(:enum).to_a.flatten)
MultiOption =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:nodoc:

enum(:multi_option, multi_options(:enum).to_a.flatten)
DebugInfoType =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Used by curl_debug_callback when setting CURLOPT_DEBUGFUNCTION github.com/bagder/curl/blob/master/include/curl/curl.h#L378 for details

enum(:debug_info_type, debug_info_types)
InfoType =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:nodoc:

enum(info_types.to_a.flatten)
Info =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Info details, refer github.com/bagder/curl/blob/master/src/tool_writeout.c#L66 for details

enum(:info, infos.to_a.flatten)
FormOption =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Form options, used by FormAdd for temporary storage, refer github.com/bagder/curl/blob/master/lib/formdata.h#L51 for details

enum(:form_option, form_options)
MsgCode =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:nodoc:

enum(:msg_code, msg_codes)
VERSION_IPV6 =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

IPv6-enabled

(1<<0)
VERSION_KERBEROS4 =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

kerberos auth is supported

(1<<1)
VERSION_SSL =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

SSL options are present

(1<<2)
VERSION_LIBZ =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

libz features are present

(1<<3)
VERSION_NTLM =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

NTLM auth is supported

(1<<4)
VERSION_GSSNEGOTIATE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Negotiate auth supp

(1<<5)
VERSION_DEBUG =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

built with debug capabilities

(1<<6)
VERSION_ASYNCHDNS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

asynchronous dns resolves

(1<<7)
VERSION_SPNEGO =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

SPNEGO auth is supported

(1<<8)
VERSION_LARGEFILE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

supports files bigger than 2GB

(1<<9)
VERSION_IDN =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

International Domain Names support

(1<<10)
VERSION_SSPI =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

SSPI is supported

(1<<11)
VERSION_CONV =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

character conversions supported

(1<<12)
VERSION_CURLDEBUG =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

debug memory tracking supported

(1<<13)
VERSION_TLSAUTH_SRP =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

TLS-SRP auth is supported

(1<<14)
VERSION_NTLM_WB =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

NTLM delegating to winbind helper

(1<<15)
VERSION_HTTP2 =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

HTTP2 support built

(1<<16)
VERSION_GSSAPI =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

GSS-API is supported

(1<<17)
@@initialized =

This classvariable is part of a private API. You should avoid using this classvariable if possible, as it may be removed or be changed in the future.

false
@@curl_mutex =

This classvariable is part of a private API. You should avoid using this classvariable if possible, as it may be removed or be changed in the future.

Mutex.new

Constants included from Ethon::Curls::Options

Ethon::Curls::Options::FOPTION_STRINGS, Ethon::Curls::Options::FTYPES, Ethon::Curls::Options::FUNCS, Ethon::Curls::Options::OPTION_STRINGS, Ethon::Curls::Options::OPTION_TYPE_BASE, Ethon::Curls::Options::OPTION_TYPE_MAP

Class Method Summary collapse

Methods included from Ethon::Curls::Functions

extended

Methods included from Ethon::Curls::Messages

msg_codes

Methods included from Ethon::Curls::FormOptions

form_options

Methods included from Ethon::Curls::Infos

debug_info_types, get_info_double, get_info_long, get_info_string, info_types, infos

Methods included from Ethon::Curls::Options

easy, option, option_alias, option_type, set_option

Methods included from Ethon::Curls::Codes

easy_codes, multi_codes

Class Method Details

.cleanupObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This function releases resources acquired by curl_global_init. You should call curl_global_cleanup once for each call you make to curl_global_init, after you are done using libcurl. This function is not thread safe. You must not call it when any other thread in the program (i.e. a thread sharing the same memory) is running. This doesn't just mean no other thread that is using libcurl. Because curl_global_cleanup calls functions of other libraries that are similarly thread unsafe, it could conflict with any other thread that uses these other libraries. See the description in libcurl of global environment requirements for details of how to use this function.


77
78
79
80
81
82
83
84
85
# File 'lib/ethon/curl.rb', line 77

def cleanup
  @@curl_mutex.synchronize {
    if @@initialized
      Curl.global_cleanup()
      @@initialized = false
      Ethon.logger.debug("ETHON: Libcurl cleanup") if Ethon.logger
    end
  }
end

.initObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This function sets up the program environment that libcurl needs. Think of it as an extension of the library loader.

This function must be called at least once within a program (a program is all the code that shares a memory space) before the program calls any other function in libcurl. The environment it sets up is constant for the life of the program and is the same for every program, so multiple calls have the same effect as one call.

The flags option is a bit pattern that tells libcurl exactly what features to init, as described below. Set the desired bits by ORing the values together. In normal operation, you must specify CURL_GLOBAL_ALL. Don't use any other value unless you are familiar with it and mean to control internal operations of libcurl.

This function is not thread safe. You must not call it when any other thread in the program (i.e. a thread sharing the same memory) is running. This doesn't just mean no other thread that is using libcurl. Because curl_global_init() calls functions of other libraries that are similarly thread unsafe, it could conflict with any other thread that uses these other libraries.

Raises:


57
58
59
60
61
62
63
64
65
# File 'lib/ethon/curl.rb', line 57

def init
  @@curl_mutex.synchronize {
    if not @@initialized
      raise Errors::GlobalInit.new if Curl.global_init(GLOBAL_ALL) != 0
      @@initialized = true
      Ethon.logger.debug("ETHON: Libcurl initialized") if Ethon.logger
    end
  }
end

.windows?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

:nodoc:

Returns:

  • (Boolean)

22
23
24
# File 'lib/ethon/curl.rb', line 22

def self.windows?
  Libc.windows?
end