Class Poco::Net::HTTPStreamFactory
Author: Applied Informatics Software Engineering GmbH and Contributors
Date: 2009-11-24

# Poco::Net

# class HTTPStreamFactory

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.

## Destructor

### ~HTTPStreamFactory

virtual ~HTTPStreamFactory();

Destroys the HTTPStreamFactory.

## Member Functions

### open

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 void registerFactory();

Registers the HTTPStreamFactory with the default URIStreamOpener instance.

### unregisterFactory

static void unregisterFactory();

Unregisters the HTTPStreamFactory with the default URIStreamOpener instance.