net.i2p.client.streaming

## Class I2PSocketEepGet

- java.lang.Object
- - net.i2p.util.EepGet
  - - net.i2p.client.streaming.I2PSocketEepGet

-     public class I2PSocketEepGet
      extends EepGet

  Fetch a URL using a socket from the supplied I2PSocketManager. Hostname must resolve to an i2p destination - no routing to an outproxy. Does not support response gzip decompression (unlike I2PTunnelHTTPProxy) (yet), but of course there is still gzip at the I2CP layer. This is designed for Java apps such as bittorrent clients that wish to do HTTP fetches and use other protocols on a single set of tunnels. This may provide anonymity benefits over using the shared clients HTTP proxy, preventing inadvertent outproxy usage, reduce resource usage by eliminating a second set of tunnels, and eliminate the requirement to to separately configure the proxy host and port. For additional documentation see the superclass. Supports http://example.i2p/blah Supports http://B32KEY.b32.i2p/blah Supports http://i2p/B64KEY/blah for compatibility with the eepproxy Supports http://B64KEY/blah for as of 0.9.42 Supports http://B64KEY.i2p/blah as of 0.9.42 Warning - does not support /eepproxy/blah, address helpers, http://B64KEY.i2p/blah, or other odd things that may be found in the HTTP proxy.

- - ### Nested Class Summary

    - ### 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 and Description
    `I2PSocketEepGet(I2PAppContext ctx, I2PSocketManager mgr, int numRetries, long minSize, long maxSize, String outputFile, OutputStream outputStream, String url)`
    `I2PSocketEepGet(I2PAppContext ctx, I2PSocketManager mgr, int numRetries, String outputFile, String url)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `fetch(long fetchHeaderTimeout, long totalTimeout, long inactivityTimeout)` We have to override this to close _socket, since we can't use _proxy in super as the I2PSocket.
    `protected String` | `getRequest()` Guess we have to override this since super doesn't strip the http://host from the GET line which hoses some servers (opentracker) HTTP proxy was kind enough to do this for us
    `protected void` | `readHeaders()` Overridden to disable inline gunzipping
    `protected void` | `sendRequest(SocketTimeout timeout)` Look up the address, get a socket from the I2PSocketManager supplied in the constructor, and send the request.

    - ### Methods inherited from class net.i2p.util.EepGet

      `addAuthorization, addHeader, addStatusListener, doFetch, fetch, fetch, getAcceptRanges, getCacheControl, getContentEncoding, getContentLanguage, getContentType, getCookie, getCSP, getEtag, getExpiryDate, getLastModified, getNotModified, getReferrerPolicy, getServer, getStatus, getStatusCode, getStatusText, getTransferEncoding, getVary, getXContentTypeOptions, getXframeOptions, getXPoweredBy, getXSSProtection, main, parseAuthArgs, readChunkLength, setPostData, setPostData, setPostData, setWriteErrorToOutput, shouldReadBody, stopFetching, suggestName`

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

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

- - ### Constructor Detail

    - #### I2PSocketEepGet

          public I2PSocketEepGet(I2PAppContext ctx,
                                 I2PSocketManager mgr,
                                 int numRetries,
                                 long minSize,
                                 long maxSize,
                                 String outputFile,
                                 OutputStream outputStream,
                                 String url)

    - #### I2PSocketEepGet

          public I2PSocketEepGet(I2PAppContext ctx,
                                 I2PSocketManager mgr,
                                 int numRetries,
                                 String outputFile,
                                 String url)

  - ### Method Detail

    - #### fetch

          public boolean fetch(long fetchHeaderTimeout,
                               long totalTimeout,
                               long inactivityTimeout)

      We have to override this to close _socket, since we can't use _proxy in super as the I2PSocket.
      Overrides:
        `fetch` in class `EepGet`
      Parameters:
        `fetchHeaderTimeout` - <= 0 for none (proxy will timeout if none, none isn't recommended if no proxy)
        `totalTimeout` - <= 0 for default none
        `inactivityTimeout` - <= 0 for default 60 sec
      Returns:
        success

    - #### getRequest

          protected String getRequest()
                               throws IOException

      Guess we have to override this since super doesn't strip the http://host from the GET line which hoses some servers (opentracker) HTTP proxy was kind enough to do this for us
      Overrides:
        `getRequest` in class `EepGet`
      Throws:
        `IOException`

    - #### readHeaders

          protected void readHeaders()
                              throws IOException

      Overridden to disable inline gunzipping
      Overrides:
        `readHeaders` in class `EepGet`
      Throws:
        `IOException`

    - #### sendRequest

          protected void sendRequest(SocketTimeout timeout)
                              throws IOException

      Look up the address, get a socket from the I2PSocketManager supplied in the constructor, and send the request.
      Overrides:
        `sendRequest` in class `EepGet`
      Parameters:
        `timeout` - ignored
      Throws:
        `IOException`