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.

API:

  • private

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:

API:

  • private

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.

API:

  • private

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.

API:

  • private

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.

API:

  • private

(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.

API:

  • private

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:

API:

  • private

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:

API:

  • private

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:

API:

  • private

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:

API:

  • private

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

API:

  • private

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:

API:

  • private

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

API:

  • private

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

API:

  • private

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:

API:

  • private

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

API:

  • private

(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

API:

  • private

(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

API:

  • private

(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

API:

  • private

(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

API:

  • private

(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

API:

  • private

(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

API:

  • private

(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

API:

  • private

(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

API:

  • private

(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

API:

  • private

(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

API:

  • private

(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

API:

  • private

(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

API:

  • private

(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

API:

  • private

(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

API:

  • private

(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

API:

  • private

(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

API:

  • private

(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

API:

  • private

(1<<17)
SOCKET_BAD =

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.

API:

  • private

-1
SOCKET_TIMEOUT =

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.

API:

  • private

SOCKET_BAD
PollAction =

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.

API:

  • private

enum(:poll_action, [
  :none,
  :in,
  :out,
  :inout,
  :remove
])
SocketReadiness =

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.

API:

  • private

bitmask(:socket_readiness, [
  :in,  # CURL_CSELECT_IN  - 0x01 (bit 0)
  :out, # CURL_CSELECT_OUT - 0x02 (bit 1)
  :err, # CURL_CSELECT_ERR - 0x04 (bit 2)
])
@@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.

API:

  • private

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.

API:

  • private

Mutex.new

Constants included from Ethon::Curls::Options

Ethon::Curls::Options::FOPTION_STRINGS, 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::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, get_info_double, get_info_long, get_info_string, info_types, infos

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

.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.

API:

  • private



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

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:

  • If Curl.global_init fails.

API:

  • private



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

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:

API:

  • private



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

def self.windows?
  Libc.windows?
end