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

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)
@@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
@@init_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::OPTION_TYPE_BASE, Ethon::Curls::Options::OPTION_TYPE_MAP

Class Method Summary collapse

Methods included from Ethon::Curls::Codes

easy_codes, multi_codes

Methods included from Ethon::Curls::Options

easy, option, option_alias, option_type, set_option

Methods included from Ethon::Curls::Infos

debug_info_types, double_ptr, get_info_double, get_info_long, get_info_string, info_types, infos, long_ptr, string_ptr

Methods included from Ethon::Curls::FormOptions

form_options

Methods included from Ethon::Curls::Messages

msg_codes

Methods included from Ethon::Curls::Functions

extended

Class Method Details

.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
  @@init_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?
  !(RbConfig::CONFIG['host_os'] !~ /mingw|mswin|bccwin/)
end