This file is indexed.

/usr/include/pion/http/reader.hpp is in libpion-dev 5.0.4+dfsg-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// ---------------------------------------------------------------------
// pion:  a Boost C++ framework for building lightweight HTTP interfaces
// ---------------------------------------------------------------------
// Copyright (C) 2007-2012 Cloudmeter, Inc.  (http://www.cloudmeter.com)
//
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
//

#ifndef __PION_HTTP_READER_HEADER__
#define __PION_HTTP_READER_HEADER__

#include <boost/asio.hpp>
#include <pion/config.hpp>
#include <pion/http/parser.hpp>
#include <pion/http/message.hpp>
#include <pion/tcp/connection.hpp>
#include <pion/tcp/timer.hpp>


namespace pion {    // begin namespace pion
namespace http {    // begin namespace http


///
/// reader: asynchronously reads and parses HTTP messages
///
class PION_API reader :
    public http::parser
{
public:

    // default destructor
    virtual ~reader() {}
    
    /// Incrementally reads & parses the HTTP message
    void receive(void);
    
    /// returns a shared pointer to the TCP connection
    inline tcp::connection_ptr& get_connection(void) { return m_tcp_conn; }
    
    /// sets the maximum number of seconds for read operations
    inline void set_timeout(boost::uint32_t seconds) { m_read_timeout = seconds; }

    
protected:

    /**
     * protected constructor: only derived classes may create objects
     *
     * @param is_request if true, the message is parsed as an HTTP request;
     *                   if false, the message is parsed as an HTTP response
     * @param tcp_conn TCP connection containing a new message to parse
     */
    reader(const bool is_request, tcp::connection_ptr& tcp_conn)
        : http::parser(is_request), m_tcp_conn(tcp_conn),
        m_read_timeout(DEFAULT_READ_TIMEOUT)
        {}  
    
    /**
     * Consumes bytes that have been read using an HTTP parser
     * 
     * @param read_error error status from the last read operation
     * @param bytes_read number of bytes consumed by the last read operation
     */
    void consume_bytes(const boost::system::error_code& read_error,
                      std::size_t bytes_read);

    /// Consumes bytes that have been read using an HTTP parser
    void consume_bytes(void);
    
    /// Reads more bytes from the TCP connection
    virtual void read_bytes(void) = 0;

    /// Called after we have finished reading/parsing the HTTP message
    virtual void finished_reading(const boost::system::error_code& ec) = 0;

    /// Returns a reference to the HTTP message being parsed
    virtual http::message& get_message(void) = 0;


private:

    /// reads more bytes for parsing, with timeout support
    void read_bytes_with_timeout(void);

    /**
     * Handles errors that occur during read operations
     *
     * @param read_error error status from the last read operation
     */
    void handle_read_error(const boost::system::error_code& read_error);


    /// default maximum number of seconds for read operations
    static const boost::uint32_t            DEFAULT_READ_TIMEOUT;


    /// The HTTP connection that has a new HTTP message to parse
    tcp::connection_ptr                        m_tcp_conn;
    
    /// pointer to a tcp::timer object if read timeouts are enabled
    tcp::timer_ptr                             m_timer_ptr;

    /// maximum number of seconds for read operations
    boost::uint32_t                         m_read_timeout;
};


}   // end namespace http
}   // end namespace pion

#endif