DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
RestEndpoint.cpp File Reference
#include "restcmd/RestEndpoint.hpp"
#include "logging/Logging.hpp"
#include <chrono>
#include <future>
#include <utility>
#include <sstream>
Include dependency graph for RestEndpoint.cpp:

Go to the source code of this file.

Functions

void extendHeader (Http::Header::Collection &headers)
 
std::string getClientAddress (const Pistache::Rest::Request &request)
 

Detailed Description

This is part of the DUNE DAQ Application Framework, copyright 2020. Licensing/copyright details are in the COPYING file that you should have received with this code.

Definition in file RestEndpoint.cpp.

Function Documentation

◆ extendHeader()

void extendHeader ( Http::Header::Collection & headers)
inline

Definition at line 60 of file RestEndpoint.cpp.

61{
62 headers.add<Http::Header::AccessControlAllowOrigin>("*");
63 headers.add<Http::Header::AccessControlAllowMethods>("POST,GET");
64 headers.add<Http::Header::ContentType>(MIME(Text, Plain));
65}

◆ getClientAddress()

std::string getClientAddress ( const Pistache::Rest::Request & request)
inline

Definition at line 69 of file RestEndpoint.cpp.

69 {
70 const auto xff = request.headers().tryGetRaw("X-Forwarded-For");
71 if (!xff.isEmpty()) {
72 //TODO: Strip of after first comma (to handle chained proxies).
73 return xff.get().value();
74 }
75 return request.address().host();
76}