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: getKeepAlive, getKeepAliveTimeout, getMaxKeepAliveRequests, getServerName, getSoftwareVersion, getTimeout, 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

getKeepAlive inline

bool getKeepAlive() const;

Returns true iff 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.

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.

Securely control IoT edge devices from anywhere   Connect a Device