http_connection.hpp (83deb7d8bd399469f8167f768cd6bb641584529d) | http_connection.hpp (81ce609e30274435b4f8c3fc65340c6b6b153b0c) |
---|---|
1#pragma once 2#include "config.h" 3 4#include "authorization.hpp" 5#include "http_response.hpp" 6#include "http_utility.hpp" 7#include "logging.hpp" 8#include "timer_queue.hpp" --- 46 unchanged lines hidden (view full) --- 55 (15 / timerQueueTimeoutSeconds); 56 57template <typename Adaptor, typename Handler> 58class Connection : 59 public std::enable_shared_from_this<Connection<Adaptor, Handler>> 60{ 61 public: 62 Connection(Handler* handlerIn, | 1#pragma once 2#include "config.h" 3 4#include "authorization.hpp" 5#include "http_response.hpp" 6#include "http_utility.hpp" 7#include "logging.hpp" 8#include "timer_queue.hpp" --- 46 unchanged lines hidden (view full) --- 55 (15 / timerQueueTimeoutSeconds); 56 57template <typename Adaptor, typename Handler> 58class Connection : 59 public std::enable_shared_from_this<Connection<Adaptor, Handler>> 60{ 61 public: 62 Connection(Handler* handlerIn, |
63 std::function<std::string()>& get_cached_date_str_f, | 63 std::function<std::string()>& getCachedDateStrF, |
64 detail::TimerQueue& timerQueueIn, Adaptor adaptorIn) : 65 adaptor(std::move(adaptorIn)), | 64 detail::TimerQueue& timerQueueIn, Adaptor adaptorIn) : 65 adaptor(std::move(adaptorIn)), |
66 handler(handlerIn), getCachedDateStr(get_cached_date_str_f), | 66 handler(handlerIn), getCachedDateStr(getCachedDateStrF), |
67 timerQueue(timerQueueIn) 68 { 69 parser.emplace(std::piecewise_construct, std::make_tuple()); 70 parser->body_limit(httpReqBodyLimit); 71 parser->header_limit(httpHeaderLimit); 72 req.emplace(parser->get()); 73 74#ifdef BMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION --- 418 unchanged lines hidden (view full) --- 493 { 494 BMCWEB_LOG_DEBUG << this << " doReadHeaders"; 495 496 // Clean up any previous Connection. 497 boost::beast::http::async_read_header( 498 adaptor, buffer, *parser, 499 [this, 500 self(shared_from_this())](const boost::system::error_code& ec, | 67 timerQueue(timerQueueIn) 68 { 69 parser.emplace(std::piecewise_construct, std::make_tuple()); 70 parser->body_limit(httpReqBodyLimit); 71 parser->header_limit(httpHeaderLimit); 72 req.emplace(parser->get()); 73 74#ifdef BMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION --- 418 unchanged lines hidden (view full) --- 493 { 494 BMCWEB_LOG_DEBUG << this << " doReadHeaders"; 495 496 // Clean up any previous Connection. 497 boost::beast::http::async_read_header( 498 adaptor, buffer, *parser, 499 [this, 500 self(shared_from_this())](const boost::system::error_code& ec, |
501 std::size_t bytes_transferred) { | 501 std::size_t bytesTransferred) { |
502 BMCWEB_LOG_ERROR << this << " async_read_header " | 502 BMCWEB_LOG_ERROR << this << " async_read_header " |
503 << bytes_transferred << " Bytes"; | 503 << bytesTransferred << " Bytes"; |
504 bool errorWhileReading = false; 505 if (ec) 506 { 507 errorWhileReading = true; 508 BMCWEB_LOG_ERROR 509 << this << " Error while reading: " << ec.message(); 510 } 511 else --- 82 unchanged lines hidden (view full) --- 594 void doRead() 595 { 596 BMCWEB_LOG_DEBUG << this << " doRead"; 597 598 boost::beast::http::async_read( 599 adaptor, buffer, *parser, 600 [this, 601 self(shared_from_this())](const boost::system::error_code& ec, | 504 bool errorWhileReading = false; 505 if (ec) 506 { 507 errorWhileReading = true; 508 BMCWEB_LOG_ERROR 509 << this << " Error while reading: " << ec.message(); 510 } 511 else --- 82 unchanged lines hidden (view full) --- 594 void doRead() 595 { 596 BMCWEB_LOG_DEBUG << this << " doRead"; 597 598 boost::beast::http::async_read( 599 adaptor, buffer, *parser, 600 [this, 601 self(shared_from_this())](const boost::system::error_code& ec, |
602 std::size_t bytes_transferred) { 603 BMCWEB_LOG_DEBUG << this << " async_read " << bytes_transferred | 602 std::size_t bytesTransferred) { 603 BMCWEB_LOG_DEBUG << this << " async_read " << bytesTransferred |
604 << " Bytes"; 605 606 bool errorWhileReading = false; 607 if (ec) 608 { 609 BMCWEB_LOG_ERROR 610 << this << " Error while reading: " << ec.message(); 611 errorWhileReading = true; --- 42 unchanged lines hidden (view full) --- 654 } 655 BMCWEB_LOG_DEBUG << this << " doWrite"; 656 res.preparePayload(); 657 serializer.emplace(*res.stringResponse); 658 boost::beast::http::async_write( 659 adaptor, *serializer, 660 [this, 661 self(shared_from_this())](const boost::system::error_code& ec, | 604 << " Bytes"; 605 606 bool errorWhileReading = false; 607 if (ec) 608 { 609 BMCWEB_LOG_ERROR 610 << this << " Error while reading: " << ec.message(); 611 errorWhileReading = true; --- 42 unchanged lines hidden (view full) --- 654 } 655 BMCWEB_LOG_DEBUG << this << " doWrite"; 656 res.preparePayload(); 657 serializer.emplace(*res.stringResponse); 658 boost::beast::http::async_write( 659 adaptor, *serializer, 660 [this, 661 self(shared_from_this())](const boost::system::error_code& ec, |
662 std::size_t bytes_transferred) { 663 BMCWEB_LOG_DEBUG << this << " async_write " << bytes_transferred | 662 std::size_t bytesTransferred) { 663 BMCWEB_LOG_DEBUG << this << " async_write " << bytesTransferred |
664 << " bytes"; 665 666 cancelDeadlineTimer(); 667 668 if (ec) 669 { 670 BMCWEB_LOG_DEBUG << this << " from write(2)"; 671 return; --- 116 unchanged lines hidden --- | 664 << " bytes"; 665 666 cancelDeadlineTimer(); 667 668 if (ec) 669 { 670 BMCWEB_LOG_DEBUG << this << " from write(2)"; 671 return; --- 116 unchanged lines hidden --- |