net.Curl.Easy
Used to configure and perform a single web request. Requests are executed by adding an Easy instance to a Multi instance.
Methods
easy.setOpt(option, parameter)
Sets an option for the request.
| Parameter | Type | Description |
|---|---|---|
option | Number | An option from net.Curl.Easy.option. |
parameter | any | The option value. |
Returns: Number — See net.Curl.Easy.code.
easy.getInfo(info)
Retrieves information about the request.
| Parameter | Type | Description |
|---|---|---|
info | Number | A constant from net.Curl.info. |
easy.reset()
Removes all previously configured options.
net.Curl.Easy.strError(code)
Returns a description of the given result code.
Returns: String
net.Curl.Easy.option
Options for setOpt(), grouped by category.
Behavior
| Option | Description |
|---|---|
VERBOSE | Display verbose information |
HEADER | Include the header in the body output |
NOPROGRESS | Shut off the progress meter |
Callbacks
| Option | Description |
|---|---|
WRITEFUNCTION | Callback for writing received data (receives ArrayBuffer) |
READFUNCTION | Callback for reading data to send |
SEEKFUNCTION | Callback for seek operations |
XFERINFOFUNCTION | Callback for progress meter |
HEADERFUNCTION | Callback for writing received headers |
Error
| Option | Description |
|---|---|
FAILONERROR | Fail on HTTP 4xx errors |
Network
| Option | Description |
|---|---|
URL | URL to work on |
PROXY | Proxy to use |
PROXYPORT | Proxy port |
PROXYTYPE | Proxy type |
NOPROXY | Filter out hosts from proxy use |
HTTPPROXYTUNNEL | Tunnel through the HTTP proxy |
INTERFACE | Bind connection locally to this interface |
LOCALPORT | Bind to this local port |
LOCALPORTRANGE | Bind to this local port range |
DNS_CACHE_TIMEOUT | Timeout for DNS cache |
BUFFERSIZE | Ask for smaller buffer size |
PORT | Port number to connect to |
TCP_NODELAY | Disable the Nagle algorithm |
TCP_KEEPALIVE | Enable TCP keep-alive |
TCP_KEEPIDLE | Idle time before sending keep-alive |
TCP_KEEPINTVL | Interval between keep-alive probes |
Authentication
| Option | Description |
|---|---|
USERPWD | User name and password |
USERNAME | User name |
PASSWORD | Password |
HTTPAUTH | HTTP server authentication methods |
PROXYUSERNAME | Proxy user name |
PROXYPASSWORD | Proxy password |
PROXYAUTH | HTTP proxy authentication methods |
XOAUTH2_BEARER | OAuth2 bearer token |
HTTP
| Option | Description |
|---|---|
AUTOREFERER | Automatically set Referer header |
ACCEPT_ENCODING | Accept-Encoding and auto-decompression |
FOLLOWLOCATION | Follow HTTP redirects |
MAXREDIRS | Maximum number of redirects |
PUT | Issue a HTTP PUT request |
POST | Issue a HTTP POST request |
POSTFIELDS | POST data |
POSTFIELDSIZE | Size of POST data |
HTTPGET | Do a HTTP GET request |
HTTPHEADER | Custom HTTP headers |
COOKIE | Cookie(s) to send |
HTTP_VERSION | HTTP version to use |
USERAGENT | User-Agent header |
REFERER | Referer header |
Connection
| Option | Description |
|---|---|
TIMEOUT | Timeout for the entire request (seconds) |
TIMEOUT_MS | Timeout for the entire request (milliseconds) |
CONNECTTIMEOUT | Timeout for the connection phase (seconds) |
CONNECTTIMEOUT_MS | Timeout for the connection phase (milliseconds) |
MAXCONNECTS | Maximum connections in pool |
FRESH_CONNECT | Use a new connection |
FORBID_REUSE | Prevent connection reuse |
IPRESOLVE | IP version to resolve to |
USE_SSL | Use TLS/SSL |
SSL / Security
| Option | Description |
|---|---|
SSL_VERIFYPEER | Verify the SSL certificate |
SSL_VERIFYHOST | Verify the host name in the SSL certificate |
SSLVERSION | SSL version to use |
SSL_CIPHER_LIST | Ciphers to use |
PINNEDPUBLICKEY | Pinned SSL public key |
net.Curl.Easy.code
Result codes passed in Multi.onMessage() callbacks.
| Code | Description |
|---|---|
OK | No error |
UNSUPPORTED_PROTOCOL | Unsupported protocol |
URL_MALFORMAT | URL using bad/illegal format or missing URL |
COULDNT_RESOLVE_PROXY | Couldn't resolve proxy name |
COULDNT_RESOLVE_HOST | Couldn't resolve host name |
COULDNT_CONNECT | Couldn't connect to server |
OPERATION_TIMEDOUT | Timeout was reached |
SSL_CONNECT_ERROR | SSL connect error |
PEER_FAILED_VERIFICATION | SSL peer certificate or SSH remote key was not OK |
GOT_NOTHING | Server returned nothing |
SEND_ERROR | Failed sending data to peer |
RECV_ERROR | Failure when receiving data from peer |
SSL_CACERT | Peer certificate cannot be authenticated with given CA certificates |
TOO_MANY_REDIRECTS | Number of redirects hit maximum |
LOGIN_DENIED | Login denied |
OUT_OF_MEMORY | Out of memory |
(Additional codes available — use net.Curl.Easy.strError(code) to get a description for any code.)