Poco::Net

class HTTPStreamFactory

File Information

Library: Net
Package: HTTP
Header: Poco/Net/HTTPStreamFactory.h

Description

An implementation of the URIStreamFactory interface that handles Hyper-Text Transfer Protocol (http) URIs.

Inheritance

Direct Base Classes: Poco::URIStreamFactory

All Base Classes: Poco::URIStreamFactory

Member Summary

Member Functions: open, registerFactory, unregisterFactory

Inherited Functions: open

Constructors

HTTPStreamFactory

HTTPStreamFactory();

Creates the HTTPStreamFactory.

HTTPStreamFactory

HTTPStreamFactory(
    const std::string & proxyHost,
    Poco::UInt16 proxyPort = HTTPSession::HTTP_PORT
);

Creates the HTTPStreamFactory.

HTTP connections will use the given proxy.

HTTPStreamFactory

HTTPStreamFactory(
    const std::string & proxyHost,
    Poco::UInt16 proxyPort,
    const std::string & proxyUsername,
    const std::string & proxyPassword
);

Creates the HTTPStreamFactory.

HTTP connections will use the given proxy and will be authorized against the proxy using Basic authentication with the given proxyUsername and proxyPassword.

Destructor

~HTTPStreamFactory virtual

virtual ~HTTPStreamFactory();

Destroys the HTTPStreamFactory.

Member Functions

open virtual

virtual std::istream * open(
    const Poco::URI & uri
);

Creates and opens a HTTP stream for the given URI. The URI must be a http://... URI.

Throws a NetException if anything goes wrong.

Redirect responses are handled and the redirect location is automatically resolved, as long as the redirect location is still accessible via the HTTP protocol. If a redirection to a non http://... URI is received, a UnsupportedRedirectException exception is thrown. The offending URI can then be obtained via the message() method of UnsupportedRedirectException.

registerFactory static

static void registerFactory();

Registers the HTTPStreamFactory with the default URIStreamOpener instance.

unregisterFactory static

static void unregisterFactory();

Unregisters the HTTPStreamFactory with the default URIStreamOpener instance.