public class SSLEepGetextends 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.

  • Constructor Details

    • SSLEepGet

      public SSLEepGet(I2PAppContext ctx, OutputStream outputStream, String url)
      A new SSLEepGet with a new SSLState.
      Parameters:
      ctx - the router context supplying config, logging, and the cert directories
      outputStream - stream to write the response body to; takes precedence over outputFile
      url - the https URL to fetch; redirects back to http are not followed
    • SSLEepGet

      public SSLEepGet(I2PAppContext ctx, OutputStream outputStream, String url, SSLEepGet.SSLState state)
      Create an SSLEepGet that writes to a stream, using an existing SSL state.
      Parameters:
      ctx - the router context supplying config, logging, and the cert directories
      outputStream - stream to write the response body to; takes precedence over outputFile
      url - the https URL to fetch; redirects back to http are not followed
      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.
    • SSLEepGet

      public SSLEepGet(I2PAppContext ctx, OutputStream outputStream, String url, long maxSize, SSLEepGet.SSLState state)
      Create an SSLEepGet that writes to a stream, using an existing SSL state, limited to a maximum response size.
      Parameters:
      ctx - the router context supplying config, logging, and the cert directories
      outputStream - stream to write the response body to; takes precedence over outputFile
      url - the https URL to fetch; redirects back to http are not followed
      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.
    • SSLEepGet

      public SSLEepGet(I2PAppContext ctx, String outputFile, String url)
      A new SSLEepGet with a new SSLState.
      Parameters:
      ctx - the router context supplying config, logging, and the cert directories
      outputFile - path of the file to write the response body to; takes precedence over outputStream
      url - the https URL to fetch; redirects back to http are not followed
    • SSLEepGet

      public SSLEepGet(I2PAppContext ctx, String outputFile, String url, SSLEepGet.SSLState state)
      Create an SSLEepGet that writes to a file, using an existing SSL state.
      Parameters:
      ctx - the router context supplying config, logging, and the cert directories
      outputFile - path of the file to write the response body to; takes precedence over outputStream
      url - the https URL to fetch; redirects back to http are not followed
      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.
    • SSLEepGet

      public SSLEepGet(I2PAppContext ctx, SSLEepGet.ProxyType type, String proxyHost, int proxyPort, OutputStream outputStream, String url)
      Use a proxy.
      Parameters:
      ctx - the router context supplying config, logging, and the cert directories
      type - proxy scheme used to reach the origin, or NONE for a direct connection
      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.
      outputStream - stream to write the response body to; takes precedence over outputFile
      url - the https URL to fetch; redirects back to http are not followed
    • SSLEepGet

      public SSLEepGet(I2PAppContext ctx, SSLEepGet.ProxyType type, String proxyHost, int proxyPort, OutputStream outputStream, String url, SSLEepGet.SSLState state)
      Use a proxy.
      Parameters:
      ctx - the router context supplying config, logging, and the cert directories
      type - proxy scheme used to reach the origin, or NONE for a direct connection
      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.
      outputStream - stream to write the response body to; takes precedence over outputFile
      url - the https URL to fetch; redirects back to http are not followed
      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.
    • SSLEepGet

      public SSLEepGet(I2PAppContext ctx, SSLEepGet.ProxyType type, String proxyHost, int proxyPort, String outputFile, String url)
      Use a proxy.
      Parameters:
      ctx - the router context supplying config, logging, and the cert directories
      type - proxy scheme used to reach the origin, or NONE for a direct connection
      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.
      outputFile - path of the file to write the response body to; takes precedence over outputStream
      url - the https URL to fetch; redirects back to http are not followed
    • SSLEepGet

      public SSLEepGet(I2PAppContext ctx, SSLEepGet.ProxyType type, String proxyHost, int proxyPort, String outputFile, String url, SSLEepGet.SSLState state)
      Use a proxy.
      Parameters:
      ctx - the router context supplying config, logging, and the cert directories
      type - proxy scheme used to reach the origin, or NONE for a direct connection
      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.
      outputFile - path of the file to write the response body to; takes precedence over outputStream
      url - the https URL to fetch; redirects back to http are not followed
      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.
  • Method Details

    • 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.
      Returns:
      the SSL state
    • forceDNSOverHTTPS

      public void forceDNSOverHTTPS(boolean on)
      Override the config setting, force DNSoverHTTPS on or off Call before the fetch.
      Parameters:
      on - true to force DoH on, false to force it off, overriding eepget.useDNSOverHTTPS
    • forceDNSOverHTTPS

      public void forceDNSOverHTTPS(boolean on, boolean forceIPv6)
      Override the config setting, force DNSoverHTTPS on or off Call before the fetch.
      Parameters:
      on - true to force DoH on, false to force it off, overriding eepget.useDNSOverHTTPS
      forceIPv6 - use IPv6 for BOTH the connection to the DoH server AND for the queried address. on must be true.
    • doFetch

      protected void doFetch(SocketTimeout timeout) throws IOException
      Fetch the resource over SSL.
      Overrides:
      doFetch in class EepGet
      Parameters:
      timeout - may be null
      Throws:
      IOException - on IO error
    • sendRequest

      protected void sendRequest(SocketTimeout timeout) throws IOException
      Send the HTTP request over SSL.
      Overrides:
      sendRequest in class EepGet
      Parameters:
      timeout - may be null
      Throws:
      IOException - on IO error