net.snowflake.client.core

## Class HttpUtil

- java.lang.Object
- - net.snowflake.client.core.HttpUtil

    public class HttpUtil
    extends Object

### Nested Class Summary

Nested Classes
`static class` `HttpUtil.HttpInputStream`

### Constructor Summary

Constructors
Constructor and Description
`HttpUtil()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `configureCustomProxyProperties(Map<SFSessionProperty,Object> connectionPropertiesMap)` configure custom proxy properties from connectionPropertiesMap
`static String` `executeRequest(org.apache.http.client.methods.HttpRequestBase httpRequest, int retryTimeout, int injectSocketTimeout, AtomicBoolean canceling)` Executes a HTTP request for Snowflake.
`static String` `executeRequest(org.apache.http.client.methods.HttpRequestBase httpRequest, int retryTimeout, int injectSocketTimeout, AtomicBoolean canceling, boolean includeRetryParameters)` Executes a HTTP request for Snowflake.
`static String` `executeTelemetryRequest(org.apache.http.client.methods.HttpRequestBase httpRequest, int retryTimeout)` Executes a HTTP request for Snowflake telemetry service.
`static org.apache.http.client.config.RequestConfig` `getDefaultRequestConfigWithSocketTimeout(int soTimeoutMs, boolean withoutCookies)` Return a request configuration inheriting from the default request configuration of the shared HttpClient with a different socket timeout.
`static org.apache.http.impl.client.CloseableHttpClient` `getHttpClient()` Gets HttpClient with insecureMode false
`static org.apache.http.client.config.RequestConfig` `getRequestConfigWithoutcookies()` Return a request configuration inheriting from the default request configuration of the shared HttpClient with the coopkie spec set to ignore.
`static org.apache.http.impl.client.CloseableHttpClient` `initHttpClient(boolean insecureMode, File ocspCacheFile)` Accessor for the HTTP client singleton.
`static boolean` `isSocksProxyDisabled()` Returns whether the SOCKS proxy is disabled for this JVM
`static void` `setSocksProxyDisabled(boolean socksProxyDisabled)` Enables/disables use of the SOCKS proxy when creating sockets

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### HttpUtil

    public HttpUtil()

### Method Detail

#### getHttpClient

    public static org.apache.http.impl.client.CloseableHttpClient getHttpClient()

Gets HttpClient with insecureMode false

Returns:
  HttpClient object shared across all connections

#### initHttpClient

    public static org.apache.http.impl.client.CloseableHttpClient initHttpClient(boolean insecureMode,
                                                                                 File ocspCacheFile)

Accessor for the HTTP client singleton.

Parameters:
  `insecureMode` - skip OCSP revocation check if true.
  `ocspCacheFile` - OCSP response cache file name. if null, the default file will be used.
Returns:
  HttpClient object shared across all connections

#### getDefaultRequestConfigWithSocketTimeout

    public static org.apache.http.client.config.RequestConfig getDefaultRequestConfigWithSocketTimeout(int soTimeoutMs,
                                                                                                       boolean withoutCookies)

Return a request configuration inheriting from the default request configuration of the shared HttpClient with a different socket timeout.

Parameters:
  `soTimeoutMs` - - custom socket timeout in milli-seconds
  `withoutCookies` - - whether this request should ignore cookies or not
Returns:
  RequestConfig object

#### getRequestConfigWithoutcookies

    public static org.apache.http.client.config.RequestConfig getRequestConfigWithoutcookies()

Return a request configuration inheriting from the default request configuration of the shared HttpClient with the coopkie spec set to ignore.

Returns:
  RequestConfig object

#### setSocksProxyDisabled

    public static void setSocksProxyDisabled(boolean socksProxyDisabled)

Enables/disables use of the SOCKS proxy when creating sockets

Parameters:
  `socksProxyDisabled` - new value

#### isSocksProxyDisabled

    public static boolean isSocksProxyDisabled()

Returns whether the SOCKS proxy is disabled for this JVM

Returns:
  whether the SOCKS proxy is disabled

#### executeRequest

    public static String executeRequest(org.apache.http.client.methods.HttpRequestBase httpRequest,
                                        int retryTimeout,
                                        int injectSocketTimeout,
                                        AtomicBoolean canceling)
                                 throws SnowflakeSQLException,
                                        IOException

Executes a HTTP request for Snowflake.

Parameters:
  `httpRequest` - HttpRequestBase
  `retryTimeout` - retry timeout
  `injectSocketTimeout` - injecting socket timeout
  `canceling` - canceling?
Returns:
  response
Throws:
  `SnowflakeSQLException` - if Snowflake error occurs
  `IOException` - raises if a general IO error occurs

#### executeTelemetryRequest

    public static String executeTelemetryRequest(org.apache.http.client.methods.HttpRequestBase httpRequest,
                                                 int retryTimeout)
                                          throws SnowflakeSQLException,
                                                 IOException

Executes a HTTP request for Snowflake telemetry service.

Parameters:
  `httpRequest` - HttpRequestBase
  `retryTimeout` - retry timeout
Returns:
  response
Throws:
  `SnowflakeSQLException` - if Snowflake error occurs
  `IOException` - raises if a general IO error occurs

#### executeRequest

    public static String executeRequest(org.apache.http.client.methods.HttpRequestBase httpRequest,
                                        int retryTimeout,
                                        int injectSocketTimeout,
                                        AtomicBoolean canceling,
                                        boolean includeRetryParameters)
                                 throws SnowflakeSQLException,
                                        IOException

Executes a HTTP request for Snowflake.

Parameters:
  `httpRequest` - HttpRequestBase
  `retryTimeout` - retry timeout
  `injectSocketTimeout` - injecting socket timeout
  `canceling` - canceling?
  `includeRetryParameters` - whether to include retry parameters in retried requests
Returns:
  response
Throws:
  `SnowflakeSQLException` - if Snowflake error occurs
  `IOException` - raises if a general IO error occurs

#### configureCustomProxyProperties

    public static void configureCustomProxyProperties(Map<SFSessionProperty,Object> connectionPropertiesMap)

configure custom proxy properties from connectionPropertiesMap