Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions) Summary: [Constants](https://developer.android.com/reference/android/net/http/HttpEngine.Builder#constants) \| [Ctors](https://developer.android.com/reference/android/net/http/HttpEngine.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/net/http/HttpEngine.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/http/HttpEngine.Builder#inhmethods)

# HttpEngine.Builder

*** ** * ** ***


`
public
static


class
HttpEngine.Builder
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.http.HttpEngine.Builder |

<br />

*** ** * ** ***

A builder for `https://developer.android.com/reference/android/net/http/HttpEngine`s, which allows runtime configuration of
`https://developer.android.com/reference/android/net/http/HttpEngine`. Configuration options are set on the builder and
then `https://developer.android.com/reference/android/net/http/HttpEngine.Builder#build()` is called to create the `https://developer.android.com/reference/android/net/http/HttpEngine`.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/net/http/HttpEngine.Builder#HTTP_CACHE_DISABLED` Setting to disable HTTP cache. |
| `int` | `https://developer.android.com/reference/android/net/http/HttpEngine.Builder#HTTP_CACHE_DISK` Setting to enable on-disk cache, including HTTP data. |
| `int` | `https://developer.android.com/reference/android/net/http/HttpEngine.Builder#HTTP_CACHE_DISK_NO_HTTP` Setting to enable on-disk cache, excluding HTTP data. |
| `int` | `https://developer.android.com/reference/android/net/http/HttpEngine.Builder#HTTP_CACHE_IN_MEMORY` Setting to enable in-memory HTTP cache, including HTTP data. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder#Builder(android.content.Context)(https://developer.android.com/reference/android/content/Context context) ` Constructs a `https://developer.android.com/reference/android/net/http/HttpEngine.Builder` object that facilitates creating a `https://developer.android.com/reference/android/net/http/HttpEngine`. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder#addPublicKeyPins(java.lang.String,%20java.util.Set<byte[]>,%20boolean,%20java.time.Instant)(https://developer.android.com/reference/java/lang/String hostName, https://developer.android.com/reference/java/util/Set<byte[]> pinsSha256, boolean includeSubdomains, https://developer.android.com/reference/java/time/Instant expirationInstant) ` Pins a set of public keys for a given host. |
| ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder#addQuicHint(java.lang.String,%20int,%20int)(https://developer.android.com/reference/java/lang/String host, int port, int alternatePort) ` Adds hint that `host` supports QUIC. |
| ` https://developer.android.com/reference/android/net/http/HttpEngine` | ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder#build()() ` Build a `https://developer.android.com/reference/android/net/http/HttpEngine` using this builder's configuration. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder#getDefaultUserAgent()() ` Constructs a default User-Agent string including the system build version, model and id, and the HTTP stack version. |
| ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setConnectionMigrationOptions(android.net.http.ConnectionMigrationOptions)(https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions options) ` Configures the behavior of connection migration. |
| ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setDnsOptions(android.net.http.DnsOptions)(https://developer.android.com/reference/android/net/http/DnsOptions options) ` Configures the behavior of hostname lookup. |
| ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setEnableBrotli(boolean)(boolean value) ` Sets whether [Brotli](https://tools.ietf.org/html/rfc7932) compression is enabled. |
| ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setEnableHttp2(boolean)(boolean value) ` Sets whether [HTTP/2](https://tools.ietf.org/html/rfc7540) protocol is enabled. |
| ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setEnableHttpCache(int,%20long)(int cacheMode, long maxSize) ` Enables or disables caching of HTTP data and other information like QUIC server information. |
| ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setEnablePublicKeyPinningBypassForLocalTrustAnchors(boolean)(boolean value) ` Enables or disables public key pinning bypass for local trust anchors. |
| ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setEnableQuic(boolean)(boolean value) ` Sets whether [QUIC](https://www.chromium.org/quic) protocol is enabled. |
| ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setProxyOptions(android.net.http.ProxyOptions)(https://developer.android.com/reference/android/net/http/ProxyOptions options) ` Configures proxying behavior. |
| ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setQuicOptions(android.net.http.QuicOptions)(https://developer.android.com/reference/android/net/http/QuicOptions options) ` Configures the behavior of the HTTP stack when using QUIC. |
| ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setStoragePath(java.lang.String)(https://developer.android.com/reference/java/lang/String value) ` Sets directory for HTTP Cache and Cookie Storage. |
| ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | ` https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setUserAgent(java.lang.String)(https://developer.android.com/reference/java/lang/String userAgent) ` Overrides the User-Agent header for all requests. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Constants

### HTTP_CACHE_DISABLED

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public static final int HTTP_CACHE_DISABLED
```

Setting to disable HTTP cache. Some data may still be temporarily stored in memory.
Passed to `https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setEnableHttpCache(int,%20long)`.

<br />

Constant Value:

0
(0x00000000)


### HTTP_CACHE_DISK

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public static final int HTTP_CACHE_DISK
```

Setting to enable on-disk cache, including HTTP data.
`https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setStoragePath(java.lang.String)` must be called prior to passing this constant to
`https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setEnableHttpCache(int,%20long)`.

<br />

Constant Value:

3
(0x00000003)


### HTTP_CACHE_DISK_NO_HTTP

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public static final int HTTP_CACHE_DISK_NO_HTTP
```

Setting to enable on-disk cache, excluding HTTP data.
`https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setStoragePath(java.lang.String)` must be called prior to passing this constant to
`https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setEnableHttpCache(int,%20long)`.

<br />

Constant Value:

2
(0x00000002)


### HTTP_CACHE_IN_MEMORY

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public static final int HTTP_CACHE_IN_MEMORY
```

Setting to enable in-memory HTTP cache, including HTTP data.
Passed to `https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setEnableHttpCache(int,%20long)`.

<br />

Constant Value:

1
(0x00000001)


## Public constructors

### Builder

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public Builder (Context context)
```

Constructs a `https://developer.android.com/reference/android/net/http/HttpEngine.Builder` object that facilitates creating a
`https://developer.android.com/reference/android/net/http/HttpEngine`. The default configuration enables HTTP/2 and
QUIC, but disables the HTTP cache.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: Android `https://developer.android.com/reference/android/content/Context`, which is used by `https://developer.android.com/reference/android/net/http/HttpEngine.Builder` to retrieve the application context. A reference to only the application context will be kept, so as to avoid extending the lifetime of `context` unnecessarily. This value cannot be `null`. <br /> |

## Public methods

### addPublicKeyPins

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public HttpEngine.Builder addPublicKeyPins (String hostName, 
                Set<byte[]> pinsSha256, 
                boolean includeSubdomains, 
                Instant expirationInstant)
```

Pins a set of public keys for a given host. By pinning a set of public keys, `pinsSha256`, communication with `hostName` is required to authenticate with a
certificate with a public key from the set of pinned ones. An app can pin the public key
of the root certificate, any of the intermediate certificates or the end-entry
certificate. Authentication will fail and secure communication will not be established if
none of the public keys is present in the host's certificate chain, even if the host
attempts to authenticate with a certificate allowed by the device's trusted store of
certificates.

Calling this method multiple times with the same host name overrides the previously
set pins for the host.

More information about the public key pinning can be found in [RFC 7469](https://tools.ietf.org/html/rfc7469).

<br />

| Parameters ||
|---|---|
| `hostName` | `String`: name of the host to which the public keys should be pinned. A host that consists only of digits and the dot character is treated as invalid. This value cannot be `null`. <br /> |
| `pinsSha256` | `Set`: a set of pins. Each pin is the SHA-256 cryptographic hash of the DER-encoded ASN.1 representation of the Subject Public Key Info (SPKI) of the host's X.509 certificate. Use `https://developer.android.com/reference/java/security/cert/Certificate#getPublicKey()` and `https://developer.android.com/reference/java/security/Key#getEncoded()` to obtain DER-encoded ASN.1 representation of the SPKI. Although, the method does not mandate the presence of the backup pin that can be used if the control of the primary private key has been lost, it is highly recommended to supply one. This value cannot be `null`. <br /> |
| `includeSubdomains` | `boolean`: indicates whether the pinning policy should be applied to subdomains of `hostName`. <br /> |
| `expirationInstant` | `Instant`: specifies the expiration instant for the pins. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | the builder to facilitate chaining. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the given host name is invalid or `pinsSha256` contains a byte array that does not represent a valid SHA-256 hash. |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if any of the input parameters are `null`. |

### addQuicHint

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public HttpEngine.Builder addQuicHint (String host, 
                int port, 
                int alternatePort)
```

Adds hint that `host` supports QUIC.
Note that `https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setEnableHttpCache(int,%20long)`
(`https://developer.android.com/reference/android/net/http/HttpEngine.Builder#HTTP_CACHE_DISK`) is needed to take advantage of 0-RTT
connection establishment between sessions.

<br />

| Parameters ||
|---|---|
| `host` | `String`: hostname of the server that supports QUIC. This value cannot be `null`. <br /> |
| `port` | `int`: host of the server that supports QUIC. <br /> |
| `alternatePort` | `int`: alternate port to use for QUIC. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | the builder to facilitate chaining. This value cannot be `null`. <br /> |

### build

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public HttpEngine build ()
```

Build a `https://developer.android.com/reference/android/net/http/HttpEngine` using this builder's configuration.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/HttpEngine` | constructed `https://developer.android.com/reference/android/net/http/HttpEngine`. This value cannot be `null`. <br /> |

### getDefaultUserAgent

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public String getDefaultUserAgent ()
```

Constructs a default User-Agent string including the system build version, model and id,
and the HTTP stack version.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | User-Agent string. This value cannot be `null`. <br /> |

### setConnectionMigrationOptions

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public HttpEngine.Builder setConnectionMigrationOptions (ConnectionMigrationOptions options)
```

Configures the behavior of connection migration. For more details, see documentation of
`https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions` and the individual methods of `https://developer.android.com/reference/android/net/http/ConnectionMigrationOptions.Builder`.

Only relevant if `https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setEnableQuic(boolean)` is enabled.

<br />

| Parameters ||
|---|---|
| `options` | `ConnectionMigrationOptions`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | the builder to facilitate chaining. This value cannot be `null`. <br /> |

### setDnsOptions

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public HttpEngine.Builder setDnsOptions (DnsOptions options)
```

Configures the behavior of hostname lookup. For more details, see documentation of `https://developer.android.com/reference/android/net/http/DnsOptions` and the individual methods of `https://developer.android.com/reference/android/net/http/DnsOptions.Builder`.

Only relevant if `https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setEnableQuic(boolean)` is enabled.

<br />

| Parameters ||
|---|---|
| `options` | `DnsOptions`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | the builder to facilitate chaining. This value cannot be `null`. <br /> |

### setEnableBrotli

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public HttpEngine.Builder setEnableBrotli (boolean value)
```

Sets whether [Brotli](https://tools.ietf.org/html/rfc7932) compression is
enabled. If enabled, Brotli will be advertised in Accept-Encoding request headers.
Defaults to disabled.

<br />

| Parameters ||
|---|---|
| `value` | `boolean`: `true` to enable Brotli, `false` to disable. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | the builder to facilitate chaining. This value cannot be `null`. <br /> |

### setEnableHttp2

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public HttpEngine.Builder setEnableHttp2 (boolean value)
```

Sets whether [HTTP/2](https://tools.ietf.org/html/rfc7540) protocol is
enabled. Defaults to enabled.

<br />

| Parameters ||
|---|---|
| `value` | `boolean`: `true` to enable HTTP/2, `false` to disable. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | the builder to facilitate chaining. This value cannot be `null`. <br /> |

### setEnableHttpCache

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public HttpEngine.Builder setEnableHttpCache (int cacheMode, 
                long maxSize)
```

Enables or disables caching of HTTP data and other information like QUIC server
information.

<br />

| Parameters ||
|---|---|
| `cacheMode` | `int`: control location and type of cached data. Must be one of `https://developer.android.com/reference/android/net/http/HttpEngine.Builder#HTTP_CACHE_DISABLED`. <br /> |
| `maxSize` | `long`: maximum size in bytes used to cache data (advisory and maybe exceeded at times). <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | the builder to facilitate chaining. This value cannot be `null`. <br /> |

### setEnablePublicKeyPinningBypassForLocalTrustAnchors

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public HttpEngine.Builder setEnablePublicKeyPinningBypassForLocalTrustAnchors (boolean value)
```

Enables or disables public key pinning bypass for local trust anchors. Disabling the
bypass for local trust anchors is highly discouraged since it may prohibit the app from
communicating with the pinned hosts. E.g., a user may want to send all traffic through an
SSL enabled proxy by changing the device proxy settings and adding the proxy certificate
to the list of local trust anchor. Disabling the bypass will most likely prevent the app
from sending any traffic to the pinned hosts. For more information see 'How does key
pinning interact with local proxies and filters?' at
https://www.chromium.org/Home/chromium-security/security-faq

<br />

| Parameters ||
|---|---|
| `value` | `boolean`: `true` to enable the bypass, `false` to disable. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | the builder to facilitate chaining. This value cannot be `null`. <br /> |

### setEnableQuic

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public HttpEngine.Builder setEnableQuic (boolean value)
```

Sets whether [QUIC](https://www.chromium.org/quic) protocol
is enabled. Defaults to enabled.

<br />

| Parameters ||
|---|---|
| `value` | `boolean`: `true` to enable QUIC, `false` to disable. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | the builder to facilitate chaining. This value cannot be `null`. <br /> |

### setProxyOptions

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 22](https://developer.android.com/sdkExtensions)

```
public HttpEngine.Builder setProxyOptions (ProxyOptions options)
```

Configures proxying behavior. This affects, in different ways: connections establishment,
`https://developer.android.com/reference/android/net/http/UrlRequest` and `https://developer.android.com/reference/android/net/http/BidirectionalStream`. For more details, refer to the
documentation of `https://developer.android.com/reference/android/net/http/Proxy`.

This is not to be confused with proxy configuration that have been set up by: the
user; or some enterprise profile configuration, or (most likely) some network
autoconfiguration (e.g., Web Proxy Auto-Discovery Protocol). This is usually referred to
as "system" proxy configuration. If present, respecting the system proxy configuration is
often a requirement to obtain local and/or internet connectivity. HttpEngine already
handles the system proxy configuration internally.

A proxy configuration defined via this API are refererred to as "app" proxy
configuration. App and system proxy configuration are separate and, most importantly,
differ. Currently, app and system proxy configurations are mutually exclusive: specifying
`https://developer.android.com/reference/android/net/http/ProxyOptions` overrides the system proxy configuration, if present. This might
cause connectivity problems in some scenarios where a system proxy configuration is
present. In such scenarios, users might end up with no internet access, unless `https://developer.android.com/reference/android/net/http/ProxyOptions` has been configured with a final, `null`, fallback. Refer to `https://developer.android.com/reference/android/net/http/ProxyOptions` documentation.

<br />

| Parameters ||
|---|---|
| `options` | `ProxyOptions`: ProxyOptions to be used for `https://developer.android.com/reference/android/net/http/UrlRequest`, `https://developer.android.com/` and connections established by the `https://developer.android.com/reference/android/net/http/HttpEngine` created by this builder. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | the builder to facilitate chaining. <br /> |

### setQuicOptions

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public HttpEngine.Builder setQuicOptions (QuicOptions options)
```

Configures the behavior of the HTTP stack when using QUIC. For more details, see
documentation of `https://developer.android.com/reference/android/net/http/QuicOptions` and the individual methods of `https://developer.android.com/reference/android/net/http/QuicOptions.Builder`.

Only relevant if `https://developer.android.com/reference/android/net/http/HttpEngine.Builder#setEnableQuic(boolean)` is enabled.

<br />

| Parameters ||
|---|---|
| `options` | `QuicOptions`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | the builder to facilitate chaining. This value cannot be `null`. <br /> |

### setStoragePath

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public HttpEngine.Builder setStoragePath (String value)
```

Sets directory for HTTP Cache and Cookie Storage. The directory must
exist.


**NOTE:** Do not use the same storage directory with more than one
`https://developer.android.com/reference/android/net/http/HttpEngine` at a time. Access to the storage directory does
not support concurrent access by multiple `https://developer.android.com/reference/android/net/http/HttpEngine` instances.

<br />

| Parameters ||
|---|---|
| `value` | `String`: path to existing directory. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | the builder to facilitate chaining. This value cannot be `null`. <br /> |

### setUserAgent

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 7](https://developer.android.com/sdkExtensions)

```
public HttpEngine.Builder setUserAgent (String userAgent)
```

Overrides the User-Agent header for all requests. An explicitly set User-Agent header
(set using `https://developer.android.com/reference/android/net/http/UrlRequest.Builder#addHeader(java.lang.String,%20java.lang.String)`) will override a value set using this
function.

<br />

| Parameters ||
|---|---|
| `userAgent` | `String`: the User-Agent string to use for all requests. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/HttpEngine.Builder` | the builder to facilitate chaining. This value cannot be `null`. <br /> |