Class Http11Processor

    • Field Detail

      • keepAlive

        protected volatile boolean keepAlive
      • openSocket

        protected volatile boolean openSocket
        Flag used to indicate that the socket should be kept open (e.g. for keep alive or send file).
      • readComplete

        protected volatile boolean readComplete
        Flag that indicates if the request headers have been completely read.
      • http11

        protected boolean http11
        HTTP/1.1 flag.
      • http09

        protected boolean http09
        HTTP/0.9 flag.
      • contentDelimitation

        protected boolean contentDelimitation
        Content delimiter for the request (if false, the connection will be closed at the end of the request).
      • restrictedUserAgents

        protected java.util.regex.Pattern restrictedUserAgents
        Regular expression that defines the restricted user agents.
      • maxKeepAliveRequests

        protected int maxKeepAliveRequests
        Maximum number of Keep-Alive requests to honor.
      • connectionUploadTimeout

        protected int connectionUploadTimeout
        Maximum timeout on uploads. 5 minutes as in Apache HTTPD server.
      • disableUploadTimeout

        protected boolean disableUploadTimeout
        Flag to disable setting a different time-out on uploads.
      • maxSavePostSize

        protected int maxSavePostSize
        Max saved post size.
      • upgradeToken

        protected UpgradeToken upgradeToken
        Instance of the new protocol to use after the HTTP connection has been upgraded.
    • Method Detail

      • setCompression

        public void setCompression​(java.lang.String compression)
        Set compression level.
        compression - One of on, force, off or the minimum compression size in bytes which implies on
      • setCompressionMinSize

        public void setCompressionMinSize​(int compressionMinSize)
        Set Minimum size to trigger compression.
        compressionMinSize - The minimum content length required for compression in bytes
      • setNoCompressionUserAgents

        public void setNoCompressionUserAgents​(java.lang.String noCompressionUserAgents)
        Set no compression user agent pattern. Regular expression as supported by Pattern. e.g.: gorilla|desesplorer|tigrus.
        noCompressionUserAgents - The regular expression for user agent strings for which compression should not be applied
      • setCompressibleMimeTypes

        public void setCompressibleMimeTypes​(java.lang.String[] compressibleMimeTypes)
        Set compressible mime-type list.
        compressibleMimeTypes - MIME types for which compression should be enabled
      • getCompression

        public java.lang.String getCompression()
        Return compression level.
        The current compression level in string form (off/on/force)
      • setRestrictedUserAgents

        public void setRestrictedUserAgents​(java.lang.String restrictedUserAgents)
        Set restricted user agent list (which will downgrade the connector to HTTP/1.0 mode). Regular expression as supported by Pattern.
        restrictedUserAgents - The regular expression as supported by Pattern for the user agents e.g. "gorilla|desesplorer|tigrus"
      • setMaxKeepAliveRequests

        public void setMaxKeepAliveRequests​(int mkar)
        Set the maximum number of Keep-Alive requests to allow. This is to safeguard from DoS attacks. Setting to a negative value disables the limit.
        mkar - The new maximum number of Keep-Alive requests allowed
      • getMaxKeepAliveRequests

        public int getMaxKeepAliveRequests()
        Get the maximum number of Keep-Alive requests allowed. A negative value means there is no limit.
        the number of Keep-Alive requests that we will allow.
      • setMaxSavePostSize

        public void setMaxSavePostSize​(int msps)
        Set the maximum size of a POST which will be buffered in SSL mode. When a POST is received where the security constraints require a client certificate, the POST body needs to be buffered while an SSL handshake takes place to obtain the certificate.
        msps - The maximum size POST body to buffer in bytes
      • getMaxSavePostSize

        public int getMaxSavePostSize()
        Return the maximum size of a POST which will be buffered in SSL mode.
        The size in bytes
      • setDisableUploadTimeout

        public void setDisableUploadTimeout​(boolean isDisabled)
        Set the flag to control whether a separate connection timeout is used during upload of a request body.
        isDisabled - true if the separate upload timeout should be disabled
      • getDisableUploadTimeout

        public boolean getDisableUploadTimeout()
        Get the flag that controls upload time-outs.
        true if the separate upload timeout is disabled
      • setConnectionUploadTimeout

        public void setConnectionUploadTimeout​(int timeout)
        Set the upload timeout.
        timeout - Upload timeout in milliseconds
      • getConnectionUploadTimeout

        public int getConnectionUploadTimeout()
        Get the upload timeout.
        Upload timeout in milliseconds
      • setServer

        public void setServer​(java.lang.String server)
        Set the server header name.
        server - The new value to use for the server header
      • setServerRemoveAppProvidedValues

        public void setServerRemoveAppProvidedValues​(boolean serverRemoveAppProvidedValues)
      • service

        public AbstractEndpoint.Handler.SocketState service​(SocketWrapperBase<?> socketWrapper)
        Description copied from class: AbstractProcessorLight
        Service a 'standard' HTTP request. This method is called for both new requests and for requests that have partially read the HTTP request line or HTTP headers. Once the headers have been fully read this method is not called again until there is a new HTTP request to process. Note that the request type may change during processing which may result in one or more calls to AbstractProcessorLight.dispatch(SocketEvent). Requests may be pipe-lined.
        Specified by:
        service in class AbstractProcessorLight
        socketWrapper - The connection to process
        The state the caller should put the socket in when this method returns
        Throws: - If an I/O error occurs during the processing of the request
      • prepareResponse

        protected final void prepareResponse()
        When committing the response, we have to validate the set of headers, as well as setup the response filters.
        Specified by:
        prepareResponse in class AbstractProcessor
      • populatePort

        protected void populatePort()
        Called when a host header is not present or is empty in the request (e.g. HTTP/1.0). It populates the server port with appropriate information. The source is expected to vary by protocol.

        The default implementation is a NO-OP.

        This implementation provides the server port from the local port.

        populatePort in class AbstractProcessor
      • flushBufferedWrite

        protected boolean flushBufferedWrite()
        Description copied from class: AbstractProcessor
        Flush any pending writes. Used during non-blocking writes to flush any remaining data from a previous incomplete write.
        Specified by:
        flushBufferedWrite in class AbstractProcessor
        true if data remains to be flushed at the end of method
        Throws: - If an I/O error occurs while attempting to flush the data
      • finishResponse

        protected final void finishResponse()
        Specified by:
        finishResponse in class AbstractProcessor
      • flush

        protected final void flush()
        Specified by:
        flush in class AbstractProcessor
      • sslReHandShake

        protected final void sslReHandShake()
        Description copied from class: AbstractProcessor
        Processors that can perform a TLS re-handshake (e.g. HTTP/1.1) should override this method and implement the re-handshake.
        sslReHandShake in class AbstractProcessor
        Throws: - If authentication is required then there will be I/O with the client and this exception will be thrown if that goes wrong
      • getUpgradeToken

        public UpgradeToken getUpgradeToken()
        Description copied from class: AbstractProcessor
        Generate an upgrade token. Processors that implement HTTP upgrade must override this method and provide the necessary token.
        Specified by:
        getUpgradeToken in interface Processor
        getUpgradeToken in class AbstractProcessor
        An upgrade token encapsulating the information required to process the upgrade request
      • doHttpUpgrade

        protected final void doHttpUpgrade​(UpgradeToken upgradeToken)
        Description copied from class: AbstractProcessor
        Process an HTTP upgrade. Processors that support HTTP upgrade should override this method and process the provided token.
        doHttpUpgrade in class AbstractProcessor
        upgradeToken - Contains all the information necessary for the Processor to process the upgrade
      • getLeftoverInput

        public java.nio.ByteBuffer getLeftoverInput()
        Description copied from class: AbstractProcessor
        Allows retrieving additional input during the upgrade process. Processors that implement HTTP upgrade must override this method.
        Specified by:
        getLeftoverInput in interface Processor
        getLeftoverInput in class AbstractProcessor
        leftover bytes
      • isUpgrade

        public boolean isUpgrade()
        Description copied from class: AbstractProcessor
        Processors that implement HTTP upgrade must override this method.
        Specified by:
        isUpgrade in interface Processor
        isUpgrade in class AbstractProcessor
        true if the Processor is currently processing an upgrade request, otherwise false
      • recycle

        public final void recycle()
        Description copied from interface: Processor
        Recycle the processor, ready for the next request which may be on the same connection or a different connection.
        Specified by:
        recycle in interface Processor
        recycle in class AbstractProcessor
      • pause

        public void pause()
        Description copied from interface: Processor
        Informs the processor that the underlying I/O layer has stopped accepting new connections. This is primarily intended to enable processors that use multiplexed connections to prevent further 'streams' being added to an existing multiplexed connection.