Hi,
On a THttpServer, I need to do a custom processing of some URL. This works since months already with MissedRequest.
I notice that when an URL ends by .json, it will not go through MissedRequest, but always be processed by the ROOT system.
Question: How to force URLs beginning by custom/ to always go through my function MissedRequest?
Example:
- currently,
http://127.0.0.1/custom/path/to/h.jsonis not found, but it does not go through MissedRequest - how to make
http://127.0.0.1/custom/<anything>awalys go throughMissedRequesteven if<anything>containsh.json?
Maybe @linev would you have an idea? Thank you again.
Have a good day.
PS:
Can I do something like this on THttpServer.cxx? :
/// In most cases information is provided by TRootSniffer class
void THttpServer::ProcessRequest(std::shared_ptr<THttpCallArg> arg)
{
std::cout << "test\n\n";
std::string uri = arg->fUri;
if (uri.rfind("/custom/", 0) == 0) {
return MissedRequest(arg);
}
if (fTerminated) {
arg->Set404();
return;
}
...
But then can I just include this modified/patched THttpServer.cxx in my project, without recompiling the whole ROOT?
I tried to add the patched THttpServer.cxx it in CMakeLists.txt:
cmake_minimum_required(VERSION 3.12)
set(CMAKE_CXX_STANDARD 20)
set(PROJECT_NAME test)
project(${PROJECT_NAME})
find_package(ROOT REQUIRED COMPONENTS RIO Net Hist Tree Gui RHTTP)
set(CMAKE_CXX_FLAGS "${ROOT_CXX_FLAGS}")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(test main.cpp THttpServer.cxx) <--- ** here added: THttpServer.cxx**
target_include_directories(test PRIVATE ${ROOT_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(test PRIVATE ${ROOT_LIBRARIES} curl)
set(INSTALL_PATH_BIN ${CMAKE_INSTALL_PREFIX}/bin)
install(TARGETS test DESTINATION ${INSTALL_PATH_BIN})
but then I have other errors like
/home/test/src/THttpServer.cxx:27:10: fatal error: THttpLongPollEngine.h: No such file or directory
27 | #include "THttpLongPollEngine.h"
| ^~~~~~~~~~~~~~~~~~~~~~~
Any idea on how to just include a patched THttpServer.cxx, without recompiling the whole ROOT project?