# pion::http::request_writer Class Reference

`#include <request_writer.hpp>`

Inherits pion::http::writer.

List of all members.

## Public Member Functions

virtual | ~request_writer ()
| default destructor
http::request & | get_request (void)
| returns a non-const reference to the request that will be sent

## Static Public Member Functions

static boost::shared_ptr < request_writer > | create (tcp::connection_ptr &tcp_conn, finished_handler_t handler=finished_handler_t())
static boost::shared_ptr < request_writer > | create (tcp::connection_ptr &tcp_conn, http::request_ptr &http_request_ptr, finished_handler_t handler=finished_handler_t())

## Protected Member Functions

| request_writer (tcp::connection_ptr &tcp_conn, finished_handler_t handler)
| request_writer (tcp::connection_ptr &tcp_conn, http::request_ptr &http_request_ptr, finished_handler_t handler)
virtual void | prepare_buffers_for_send (http::message::write_buffers_t &write_buffers)
virtual write_handler_t | bind_to_write_handler (void)
| returns a function bound to http::writer::handle_write()
virtual void | handle_write (const boost::system::error_code &write_error, std::size_t bytes_written)

## Detailed Description

request_writer: used to asynchronously send HTTP requests

Definition at line 30 of file request_writer.hpp.

## Constructor & Destructor Documentation

pion::http::request_writer::request_writer | ( | tcp::connection_ptr & | tcp_conn,
|  | finished_handler_t | handler |
| ) |  |  | `[inline, protected]`

protected constructor restricts creation of objects (use create())

Parameters:

  | tcp_conn | TCP connection used to send the request
  | handler | function called after the request has been sent

Definition at line 83 of file request_writer.hpp.

References pion::http::writer::set_logger().

Referenced by create().

pion::http::request_writer::request_writer | ( | tcp::connection_ptr & | tcp_conn,
|  | http::request_ptr & | http_request_ptr,
|  | finished_handler_t | handler |
| ) |  |  | `[inline, protected]`

protected constructor restricts creation of objects (use create())

Parameters:

  | tcp_conn | TCP connection used to send the request
  | http_request_ptr | pointer to the request that will be sent
  | handler | function called after the request has been sent

Definition at line 96 of file request_writer.hpp.

References pion::http::writer::set_logger(), and pion::http::writer::write_no_copy().

## Member Function Documentation

static boost::shared_ptr<request_writer> pion::http::request_writer::create | ( | tcp::connection_ptr & | tcp_conn,
|  | http::request_ptr & | http_request_ptr,
|  | finished_handler_t | handler = `finished_handler_t()` |
| ) |  |  | `[inline, static]`

creates new request_writer objects

Parameters:

  | tcp_conn | TCP connection used to send the request
  | http_request_ptr | pointer to the request that will be sent
  | handler | function called after the request has been sent

Returns:
  boost::shared_ptr<request_writer> shared pointer to the new writer object that was created

Definition at line 64 of file request_writer.hpp.

References request_writer().

static boost::shared_ptr<request_writer> pion::http::request_writer::create | ( | tcp::connection_ptr & | tcp_conn,
|  | finished_handler_t | handler = `finished_handler_t()` |
| ) |  |  | `[inline, static]`

creates new request_writer objects

Parameters:

  | tcp_conn | TCP connection used to send the request
  | handler | function called after the request has been sent

Returns:
  boost::shared_ptr<request_writer> shared pointer to the new writer object that was created

Definition at line 48 of file request_writer.hpp.

References request_writer().

virtual void pion::http::request_writer::handle_write | ( | const boost::system::error_code & | write_error,
|  | std::size_t | bytes_written |
| ) |  |  | `[inline, protected, virtual]`

called after the request is sent

Parameters:

  | write_error | error status from the last write operation
  | bytes_written | number of bytes sent by the last write operation

Implements pion::http::writer.

Definition at line 139 of file request_writer.hpp.

References pion::http::writer::clear(), pion::http::writer::finished_writing(), pion::http::writer::get_logger(), and pion::http::writer::sending_chunked_message().

Referenced by bind_to_write_handler().

virtual void pion::http::request_writer::prepare_buffers_for_send | ( | http::message::write_buffers_t & | write_buffers | ) | `[inline, protected, virtual]`

initializes a vector of write buffers with the HTTP message information

Parameters:

  | write_buffers | vector of write buffers to initialize

Implements pion::http::writer.

Definition at line 118 of file request_writer.hpp.

References pion::http::writer::get_connection(), pion::http::writer::get_content_length(), and pion::http::writer::sending_chunked_message().

The documentation for this class was generated from the following file:

- include/pion/http/request_writer.hpp