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
  • Constructor Details

    • SSLEepGet

      public SSLEepGet(I2PAppContext ctx, OutputStream outputStream, String url)
      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 response
      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.48
    • SSLEepGet

      public SSLEepGet(I2PAppContext ctx, String outputFile, String url)
      A new SSLEepGet with a new SSLState
      Since:
      0.9.9
    • SSLEepGet

      public SSLEepGet(I2PAppContext ctx, String outputFile, 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.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

      public static void main(String[] args)
      SSLEepGet https://foo/bar or to save cert chain: SSLEepGet -s https://foo/bar
    • getSSLState

      public SSLEepGet.SSLState 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

      protected void doFetch(SocketTimeout timeout) throws IOException
      Description copied from class: EepGet
      This reads the response to a single fetch. Call after sendRequest()
      Overrides:
      doFetch in class EepGet
      Parameters:
      timeout - may be null
      Throws:
      IOException
    • sendRequest

      protected void sendRequest(SocketTimeout timeout) throws IOException
      Overrides:
      sendRequest in class EepGet
      Parameters:
      timeout - may be null
      Throws:
      IOException