Package net.i2p.util
Class SSLEepGet
java.lang.Object
net.i2p.util.EepGet
net.i2p.util.SSLEepGet
public class SSLEepGet extends EepGet
HTTPS only, no retries, no min and max size options, no timeout option
As of 0.9.45, supports redirect to https (redirect to http will still fail).
Fails on bad certs (must have a valid cert chain)
Self-signed certs or CAs not in the JVM key store must be loaded to be trusted.
Since 0.8.2, loads additional trusted CA certs from $I2P/certificates/ssl/ and ~/.i2p/certificates/ssl/
Since 0.9.33, HTTP proxies (CONNECT) supported. Proxy auth not supported.
- Since:
- 0.7.10
- Author:
- zzz
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SSLEepGet.ProxyType
Not all may be supported.static class
SSLEepGet.SSLState
An opaque class for the caller to pass to repeated instantiations of SSLEepGet.Nested classes/interfaces inherited from class net.i2p.util.EepGet
EepGet.AUTH_MODE, EepGet.AuthState, EepGet.CLIStatusListener, EepGet.Gunzipper, EepGet.StatusListener
-
Field Summary
Fields inherited from class net.i2p.util.EepGet
_aborted, _acceptRanges, _actualURL, _alreadyTransferred, _authState, _bytesRemaining, _bytesTransferred, _cacheControl, _contentEncoding, _contentLanguage, _contentType, _context, _cookie, _csp, _currentAttempt, _decompressException, _encodingChunked, _etag, _etagOrig, _expiryDate, _extraHeaders, _fetchHeaderTimeout, _fetchInactivityTimeout, _fetchTotalTimeout, _isGzippedResponse, _keepFetching, _lastModified, _lastModifiedOrig, _listeners, _log, _notModified, _numRetries, _out, _outputFile, _outputStream, _proxy, _proxyHost, _proxyIn, _proxyOut, _proxyPort, _redirectLocation, _redirects, _referrerPolicy, _responseCode, _responseText, _server, _shouldProxy, _shouldWriteErrorToOutput, _status, _transferEncoding, _transferFailed, _url, _vary, _xContentTypeOptions, _xframeOptions, _xPoweredBy, _xssProtection, CONNECT_TIMEOUT, INACTIVITY_TIMEOUT, MAX_COMPLETE_FAILS, USER_AGENT
-
Constructor Summary
Constructors Constructor Description SSLEepGet(I2PAppContext ctx, OutputStream outputStream, String url)
A new SSLEepGet with a new SSLStateSSLEepGet(I2PAppContext ctx, OutputStream outputStream, String url, long maxSize, SSLEepGet.SSLState state)
SSLEepGet(I2PAppContext ctx, OutputStream outputStream, String url, SSLEepGet.SSLState state)
SSLEepGet(I2PAppContext ctx, String outputFile, String url)
A new SSLEepGet with a new SSLStateSSLEepGet(I2PAppContext ctx, String outputFile, String url, SSLEepGet.SSLState state)
SSLEepGet(I2PAppContext ctx, SSLEepGet.ProxyType type, String proxyHost, int proxyPort, OutputStream outputStream, String url)
Use a proxy.SSLEepGet(I2PAppContext ctx, SSLEepGet.ProxyType type, String proxyHost, int proxyPort, OutputStream outputStream, String url, SSLEepGet.SSLState state)
Use a proxy.SSLEepGet(I2PAppContext ctx, SSLEepGet.ProxyType type, String proxyHost, int proxyPort, String outputFile, String url)
Use a proxy.SSLEepGet(I2PAppContext ctx, SSLEepGet.ProxyType type, String proxyHost, int proxyPort, String outputFile, String url, SSLEepGet.SSLState state)
Use a proxy. -
Method Summary
Modifier and Type Method Description protected void
doFetch(SocketTimeout timeout)
This reads the response to a single fetch.void
forceDNSOverHTTPS(boolean on)
Override the config setting, force DNSoverHTTPS on or off Call before the fetch.SSLEepGet.SSLState
getSSLState()
Pass this back to the next SSLEepGet constructor for faster fetches.static void
main(String[] args)
SSLEepGet https://foo/bar or to save cert chain: SSLEepGet -s https://foo/barprotected void
sendRequest(SocketTimeout timeout)
Methods inherited from class net.i2p.util.EepGet
addAuthorization, addHeader, addStatusListener, fetch, fetch, fetch, getAcceptRanges, getCacheControl, getContentEncoding, getContentLanguage, getContentType, getCookie, getCSP, getEtag, getExpiryDate, getLastModified, getNotModified, getReferrerPolicy, getRequest, getServer, getStatus, getStatusCode, getStatusText, getTransferEncoding, getVary, getXContentTypeOptions, getXframeOptions, getXPoweredBy, getXSSProtection, parseAuthArgs, readChunkLength, readHeaders, setWriteErrorToOutput, shouldReadBody, stopFetching, suggestName
-
Constructor Details
-
SSLEepGet
A new SSLEepGet with a new SSLState -
SSLEepGet
public SSLEepGet(I2PAppContext ctx, OutputStream outputStream, String url, SSLEepGet.SSLState state)- Parameters:
state
- an SSLState retrieved from a previous SSLEepGet with getSSLState(), or null. This makes repeated fetches from the same host MUCH faster, and prevents repeated key store loads even for different hosts.- Since:
- 0.8.2
-
SSLEepGet
public SSLEepGet(I2PAppContext ctx, OutputStream outputStream, String url, long maxSize, SSLEepGet.SSLState state)- Parameters:
maxSize
- The maximum size of the responsestate
- an SSLState retrieved from a previous SSLEepGet with getSSLState(), or null. This makes repeated fetches from the same host MUCH faster, and prevents repeated key store loads even for different hosts.- Since:
- 0.9.48
-
SSLEepGet
A new SSLEepGet with a new SSLState- Since:
- 0.9.9
-
SSLEepGet
- Parameters:
state
- an SSLState retrieved from a previous SSLEepGet with getSSLState(), or null. This makes repeated fetches from the same host MUCH faster, and prevents repeated key store loads even for different hosts.- Since:
- 0.9.9
-
SSLEepGet
public SSLEepGet(I2PAppContext ctx, SSLEepGet.ProxyType type, String proxyHost, int proxyPort, OutputStream outputStream, String url)Use a proxy.- Parameters:
proxyHost
- Must be valid hostname or literal IPv4/v6. If type is INTERNAL, set to "localhost".proxyPort
- Must be valid, -1 disallowed, no default. If type is INTERNAL, set to 4444.- Since:
- 0.9.33
-
SSLEepGet
public SSLEepGet(I2PAppContext ctx, SSLEepGet.ProxyType type, String proxyHost, int proxyPort, OutputStream outputStream, String url, SSLEepGet.SSLState state)Use a proxy.- Parameters:
proxyHost
- Must be valid hostname or literal IPv4/v6. If type is INTERNAL, set to "localhost".proxyPort
- Must be valid, -1 disallowed, no default. If type is INTERNAL, set to 4444.state
- an SSLState retrieved from a previous SSLEepGet with getSSLState(), or null. This makes repeated fetches from the same host MUCH faster, and prevents repeated key store loads even for different hosts.- Since:
- 0.9.33
-
SSLEepGet
public SSLEepGet(I2PAppContext ctx, SSLEepGet.ProxyType type, String proxyHost, int proxyPort, String outputFile, String url)Use a proxy.- Parameters:
proxyHost
- Must be valid hostname or literal IPv4/v6. If type is INTERNAL, set to "localhost".proxyPort
- Must be valid, -1 disallowed, no default. If type is INTERNAL, set to 4444.- Since:
- 0.9.33
-
SSLEepGet
public SSLEepGet(I2PAppContext ctx, SSLEepGet.ProxyType type, String proxyHost, int proxyPort, String outputFile, String url, SSLEepGet.SSLState state)Use a proxy.- Parameters:
proxyHost
- Must be valid hostname or literal IPv4/v6. If type is INTERNAL, set to "localhost".proxyPort
- Must be valid, -1 disallowed, no default. If type is INTERNAL, set to 4444.state
- an SSLState retrieved from a previous SSLEepGet with getSSLState(), or null. This makes repeated fetches from the same host MUCH faster, and prevents repeated key store loads even for different hosts.- Since:
- 0.9.33
-
-
Method Details
-
main
SSLEepGet https://foo/bar or to save cert chain: SSLEepGet -s https://foo/bar -
getSSLState
Pass this back to the next SSLEepGet constructor for faster fetches. This may be called either after the constructor or after the fetch.- Since:
- 0.8.2
-
forceDNSOverHTTPS
public void forceDNSOverHTTPS(boolean on)Override the config setting, force DNSoverHTTPS on or off Call before the fetch.- Since:
- 0.9.49
-
doFetch
Description copied from class:EepGet
This reads the response to a single fetch. Call after sendRequest()- Overrides:
doFetch
in classEepGet
- Parameters:
timeout
- may be null- Throws:
IOException
-
sendRequest
- Overrides:
sendRequest
in classEepGet
- Parameters:
timeout
- may be null- Throws:
IOException
-