http_connection.hpp (a4326fe2710d12e30cf39dee2aaaba2e4fd0abfd) http_connection.hpp (5ae6f9254161f7229216c08b591e31eaf10f69e4)
1#pragma once
2#include "bmcweb_config.h"
3
4#include "authentication.hpp"
5#include "http_response.hpp"
6#include "http_utility.hpp"
7#include "logging.hpp"
8#include "utility.hpp"

--- 174 unchanged lines hidden (view full) ---

183 if (reqEc)
184 {
185 BMCWEB_LOG_DEBUG << "Request failed to construct" << reqEc;
186 res.result(boost::beast::http::status::bad_request);
187 completeRequest(res);
188 return;
189 }
190 thisReq.session = userSession;
1#pragma once
2#include "bmcweb_config.h"
3
4#include "authentication.hpp"
5#include "http_response.hpp"
6#include "http_utility.hpp"
7#include "logging.hpp"
8#include "utility.hpp"

--- 174 unchanged lines hidden (view full) ---

183 if (reqEc)
184 {
185 BMCWEB_LOG_DEBUG << "Request failed to construct" << reqEc;
186 res.result(boost::beast::http::status::bad_request);
187 completeRequest(res);
188 return;
189 }
190 thisReq.session = userSession;
191 res.keepAlive(thisReq.keepAlive());
191
192 // Fetch the client IP address
193 readClientIp();
194
195 // Check for HTTP version 1.1.
196 if (thisReq.version() == 11)
197 {
198 if (thisReq.getHeaderValue(boost::beast::http::field::host).empty())

--- 96 unchanged lines hidden (view full) ---

295
296 void completeRequest(crow::Response& thisRes)
297 {
298 if (!req)
299 {
300 return;
301 }
302 res = std::move(thisRes);
192
193 // Fetch the client IP address
194 readClientIp();
195
196 // Check for HTTP version 1.1.
197 if (thisReq.version() == 11)
198 {
199 if (thisReq.getHeaderValue(boost::beast::http::field::host).empty())

--- 96 unchanged lines hidden (view full) ---

296
297 void completeRequest(crow::Response& thisRes)
298 {
299 if (!req)
300 {
301 return;
302 }
303 res = std::move(thisRes);
304
303 BMCWEB_LOG_INFO << "Response: " << this << ' ' << req->url << ' '
305 BMCWEB_LOG_INFO << "Response: " << this << ' ' << req->url << ' '
304 << res.resultInt() << " keepalive=" << req->keepAlive();
306 << res.resultInt() << " keepalive=" << res.keepAlive();
305
306 addSecurityHeaders(*req, res);
307
308 crow::authentication::cleanupTempSession(*req);
309
310 if (!isAlive())
311 {
312 // BMCWEB_LOG_DEBUG << this << " delete (socket is closed) " <<

--- 51 unchanged lines hidden (view full) ---

364 // it does, we don't want to throw.
365 BMCWEB_LOG_CRITICAL
366 << this << " Response content provided but code was no-content";
367 res.body().clear();
368 }
369
370 res.addHeader(boost::beast::http::field::date, getCachedDateStr());
371
307
308 addSecurityHeaders(*req, res);
309
310 crow::authentication::cleanupTempSession(*req);
311
312 if (!isAlive())
313 {
314 // BMCWEB_LOG_DEBUG << this << " delete (socket is closed) " <<

--- 51 unchanged lines hidden (view full) ---

366 // it does, we don't want to throw.
367 BMCWEB_LOG_CRITICAL
368 << this << " Response content provided but code was no-content";
369 res.body().clear();
370 }
371
372 res.addHeader(boost::beast::http::field::date, getCachedDateStr());
373
372 res.keepAlive(req->keepAlive());
373
374 doWrite(res);
375
376 // delete lambda with self shared_ptr
377 // to enable connection destruction
378 res.setCompleteRequestHandler(nullptr);
379 }
380
381 void readClientIp()

--- 146 unchanged lines hidden (view full) ---

528
529 cancelDeadlineTimer();
530
531 if (ec)
532 {
533 BMCWEB_LOG_DEBUG << this << " from write(2)";
534 return;
535 }
374 doWrite(res);
375
376 // delete lambda with self shared_ptr
377 // to enable connection destruction
378 res.setCompleteRequestHandler(nullptr);
379 }
380
381 void readClientIp()

--- 146 unchanged lines hidden (view full) ---

528
529 cancelDeadlineTimer();
530
531 if (ec)
532 {
533 BMCWEB_LOG_DEBUG << this << " from write(2)";
534 return;
535 }
536 if (!res.keepAlive())
536 if (!serializer->get().keep_alive())
537 {
538 close();
539 BMCWEB_LOG_DEBUG << this << " from write(1)";
540 return;
541 }
542
543 serializer.reset();
544 BMCWEB_LOG_DEBUG << this << " Clearing response";

--- 99 unchanged lines hidden ---
537 {
538 close();
539 BMCWEB_LOG_DEBUG << this << " from write(1)";
540 return;
541 }
542
543 serializer.reset();
544 BMCWEB_LOG_DEBUG << this << " Clearing response";

--- 99 unchanged lines hidden ---