Poco::Net

class HTTPServerParams

File Information

Library: Net
Package: HTTPServer
Header: Poco/Net/HTTPServerParams.h

Description

This class is used to specify parameters to both the HTTPServer, as well as to HTTPRequestHandler objects.

Subclasses may add new parameters to the class.

Inheritance

Direct Base Classes: TCPServerParams

All Base Classes: TCPServerParams, Poco::RefCountedObject

Member Summary

Member Functions: getAutoDecodeHeaders, getKeepAlive, getKeepAliveTimeout, getMaxKeepAliveRequests, getServerName, getSoftwareVersion, getTimeout, setAutoDecodeHeaders, setKeepAlive, setKeepAliveTimeout, setMaxKeepAliveRequests, setServerName, setSoftwareVersion, setTimeout

Inherited Functions: duplicate, getMaxQueued, getMaxThreads, getThreadIdleTime, getThreadPriority, referenceCount, release, setMaxQueued, setMaxThreads, setThreadIdleTime, setThreadPriority

Types Aliases

Ptr

using Ptr = Poco::AutoPtr < HTTPServerParams >;

Constructors

HTTPServerParams

HTTPServerParams();

Creates the HTTPServerParams.

Sets the following default values:

  • timeout: 60 seconds
  • keepAlive: true
  • maxKeepAliveRequests: 0
  • keepAliveTimeout: 10 seconds

Destructor

~HTTPServerParams protected virtual

virtual ~HTTPServerParams();

Destroys the HTTPServerParams.

Member Functions

getAutoDecodeHeaders inline

bool getAutoDecodeHeaders() const;

Returns true if automatic conversion of HTTP header values when reading HTTP header.

getKeepAlive inline

bool getKeepAlive() const;

Returns true if persistent connections are enabled.

getKeepAliveTimeout inline

const Poco::Timespan & getKeepAliveTimeout() const;

Returns the keep-alive timeout for persistent HTTP connections.

getMaxKeepAliveRequests inline

int getMaxKeepAliveRequests() const;

Returns the maximum number of requests allowed during a persistent connection, or 0 if unlimited connections are allowed.

getServerName inline

const std::string & getServerName() const;

Returns the name and port (name:port) that the server uses to identify itself.

getSoftwareVersion inline

const std::string & getSoftwareVersion() const;

Returns the server software name and version that the server uses to identify itself.

getTimeout inline

const Poco::Timespan & getTimeout() const;

Returns the connection timeout for HTTP connections.

setAutoDecodeHeaders

void setAutoDecodeHeaders(
    bool autoDecode
);

Enables or disables automatic HTTP header value conversions, for example RFC2047. Default is true: convert header values when reading HTTP header.

setKeepAlive

void setKeepAlive(
    bool keepAlive
);

Enables (keepAlive == true) or disables (keepAlive == false) persistent connections.

setKeepAliveTimeout

void setKeepAliveTimeout(
    const Poco::Timespan & timeout
);

Sets the keep-alive timeout for persistent HTTP connections.

setMaxKeepAliveRequests

void setMaxKeepAliveRequests(
    int maxKeepAliveRequests
);

Specifies the maximum number of requests allowed during a persistent connection. 0 means unlimited connections.

setServerName

void setServerName(
    const std::string & serverName
);

Sets the name and port (name:port) that the server uses to identify itself.

If this is not set to valid DNS name for your host, server-generated redirections will not work.

setSoftwareVersion

void setSoftwareVersion(
    const std::string & softwareVersion
);

Sets the server software name and version that the server uses to identify itself. If this is set to a non-empty string, the server will automatically include a Server header field with the value given here in every response it sends.

The format of the softwareVersion string should be name/version (e.g. MyHTTPServer/1.0).

setTimeout

void setTimeout(
    const Poco::Timespan & timeout
);

Sets the connection timeout for HTTP connections.