# Poco::Net

# class HTTPServerParams

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

### Ptr

typedef Poco::AutoPtr < HTTPServerParams > Ptr;

## Constructors

### HTTPServerParams

HTTPServerParams();

Creates the HTTPServerParams.

Sets the following default values:

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

## Destructor

### ~HTTPServerParams

virtual ~HTTPServerParams();

Destroys the HTTPServerParams.

## Member Functions

### getKeepAlive

bool getKeepAlive() const;

Returns true if and only if persistent connections are enabled.

### getKeepAliveTimeout

const Poco::Timespan & getKeepAliveTimeout() const;

Returns the connection timeout for HTTP connections.

### getMaxKeepAliveRequests

int getMaxKeepAliveRequests() const;

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

### getServerName

const std::string & getServerName() const;

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

### getSoftwareVersion

const std::string & getSoftwareVersion() const;

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

### getTimeout

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 connection timeout for HTTP connections.

### setMaxKeepAliveRequests

void setMaxKeepAliveRequests(
int maxKeepAliveRequests
);

Specifies the maximun 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.