net.i2p.i2ptunnel

## Class I2PTunnelHTTPServer

- java.lang.Object
- - net.i2p.i2ptunnel.I2PTunnelTask
  - - net.i2p.i2ptunnel.I2PTunnelServer
    - - net.i2p.i2ptunnel.I2PTunnelHTTPServer

- All Implemented Interfaces:
    Runnable, EventDispatcher
  Direct Known Subclasses:
    I2PTunnelHTTPBidirServer

      public class I2PTunnelHTTPServer
      extends I2PTunnelServer

  Simple extension to the I2PTunnelServer that filters the HTTP headers sent from the client to the server, replacing the Host header with whatever this instance has been configured with, and if the browser set Accept-encoding: x-i2p-gzip, gzip the http message body and set Content-encoding: x-i2p-gzip.

- - ### Field Summary

    - ### Fields inherited from class net.i2p.i2ptunnel.I2PTunnelServer

      `__serverId, _log, bidir, i2pss, localPort, readTimeout, remoteHost, remotePort, slock, sockMgr, task`

    - ### Fields inherited from class net.i2p.i2ptunnel.I2PTunnelTask

      `open`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `I2PTunnelHTTPServer(InetAddress host, int port, File privkey, String privkeyname, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel)`
    `I2PTunnelHTTPServer(InetAddress host, int port, InputStream privData, String privkeyname, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel)`
    `I2PTunnelHTTPServer(InetAddress host, int port, String privData, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `blockingHandle(I2PSocket socket)` Called by the thread pool of I2PSocket handlers
    `protected static String` | `formatHeaders(Map<String,List<String>> headers, StringBuilder command)`
    `protected static Map<String,List<String>>` | `readHeaders(InputStream in, StringBuilder command, String[] skipHeaders, I2PAppContext ctx)`

    - ### Methods inherited from class net.i2p.i2ptunnel.I2PTunnelServer

      `close, getHandlerCount, getReadTimeout, run, setReadTimeout, shouldUsePool, startRunning`

    - ### Methods inherited from class net.i2p.i2ptunnel.I2PTunnelTask

      `attachEventDispatcher, detachEventDispatcher, disconnected, errorOccurred, getEventDispatcher, getEvents, getEventValue, getId, getTunnel, ignoreEvents, isOpen, notifyEvent, reportAbuse, routerDisconnected, setId, setName, setTunnel, toString, unIgnoreEvents, waitEventValue`

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

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

- - ### Constructor Detail

    - #### I2PTunnelHTTPServer

          public I2PTunnelHTTPServer(InetAddress host,
                             int port,
                             String privData,
                             String spoofHost,
                             Logging l,
                             EventDispatcher notifyThis,
                             I2PTunnel tunnel)

    - #### I2PTunnelHTTPServer

          public I2PTunnelHTTPServer(InetAddress host,
                             int port,
                             File privkey,
                             String privkeyname,
                             String spoofHost,
                             Logging l,
                             EventDispatcher notifyThis,
                             I2PTunnel tunnel)

    - #### I2PTunnelHTTPServer

          public I2PTunnelHTTPServer(InetAddress host,
                             int port,
                             InputStream privData,
                             String privkeyname,
                             String spoofHost,
                             Logging l,
                             EventDispatcher notifyThis,
                             I2PTunnel tunnel)

  - ### Method Detail

    - #### blockingHandle

          protected void blockingHandle(I2PSocket socket)

      Called by the thread pool of I2PSocket handlers
      Overrides:
        `blockingHandle` in class `I2PTunnelServer`

    - #### formatHeaders

          protected static String formatHeaders(Map<String,List<String>> headers,
                             StringBuilder command)

    - #### readHeaders

          protected static Map<String,List<String>> readHeaders(InputStream in,
                                             StringBuilder command,
                                             String[] skipHeaders,
                                             I2PAppContext ctx)
                                                         throws IOException

      Throws:
        `IOException`