Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP TPC v2 #737

Merged
merged 12 commits into from
Jun 15, 2018
1 change: 1 addition & 0 deletions packaging/debian/xrootd-server-devel.install
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ usr/include/xrootd/XrdSfs
usr/include/xrootd/XrdXrootd
usr/include/xrootd/XrdHttp
usr/lib/*/libXrdServer.so
usr/lib/*/libXrdHttpUtils.so
2 changes: 2 additions & 0 deletions packaging/debian/xrootd-server-libs.install
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ usr/lib/*/libXrdXrootd-4.so
usr/lib/*/libXrdFileCache-4.so
usr/lib/*/libXrdBlacklistDecision-4.so
usr/lib/*/libXrdHttp-4.so
usr/lib/*/libXrdHttpTPC-4.so
usr/lib/*/libXrdHttpUtils.so.*
usr/lib/*/libXrdN2No2p-4.so
usr/lib/*/libXrdOssSIgpfsT-4.so
usr/lib/*/libXrdServer.so.*
Expand Down
3 changes: 3 additions & 0 deletions packaging/rhel/xrootd.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,8 @@ fi
%{_libdir}/libXrdFileCache-4.so
%{_libdir}/libXrdBlacklistDecision-4.so
%{_libdir}/libXrdHttp-4.so
%{_libdir}/libXrdHttpTPC-4.so
%{_libdir}/libXrdHttpUtils.so.*
%{_libdir}/libXrdN2No2p-4.so
%{_libdir}/libXrdOssSIgpfsT-4.so
%{_libdir}/libXrdServer.so.*
Expand All @@ -797,6 +799,7 @@ fi
%{_includedir}/xrootd/XrdXrootd
%{_includedir}/xrootd/XrdHttp
%{_libdir}/libXrdServer.so
%{_libdir}/libXrdHttpUtils.so

%files private-devel
%defattr(-,root,root,-)
Expand Down
30 changes: 25 additions & 5 deletions src/XrdHttp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ include( XRootDCommon )
#-------------------------------------------------------------------------------
# Modules
#-------------------------------------------------------------------------------
set( LIB_XRD_HTTP XrdHttp-${PLUGIN_VERSION} )
set( LIB_XRD_HTTP_UTILS XrdHttpUtils )
set( MOD_XRD_HTTP XrdHttp-${PLUGIN_VERSION} )

#-------------------------------------------------------------------------------
# Shared library version
#-------------------------------------------------------------------------------
set( XRD_HTTP_UTILS_VERSION 1.0.0 )
set( XRD_HTTP_UTILS_SOVERSION 1 )

if( BUILD_HTTP )
#-----------------------------------------------------------------------------
Expand All @@ -18,7 +21,7 @@ if( BUILD_HTTP )
# Note this is marked as a shared library as XrdHttp plugins are expected to
# link against this for the XrdHttpExt class implementations.
add_library(
${LIB_XRD_HTTP}
${LIB_XRD_HTTP_UTILS}
SHARED
XrdHttp/XrdHttpProtocol.cc XrdHttp/XrdHttpProtocol.hh
XrdHttp/XrdHttpReq.cc XrdHttp/XrdHttpReq.hh
Expand All @@ -28,8 +31,13 @@ if( BUILD_HTTP )
XrdHttp/XrdHttpTrace.cc XrdHttp/XrdHttpTrace.hh
XrdHttp/XrdHttpUtils.cc XrdHttp/XrdHttpUtils.hh )

add_library(
${MOD_XRD_HTTP}
MODULE
XrdHttp/XrdHttpModule.cc )

target_link_libraries(
${LIB_XRD_HTTP}
${LIB_XRD_HTTP_UTILS}
XrdServer
XrdUtils
XrdCrypto
Expand All @@ -38,8 +46,20 @@ if( BUILD_HTTP )
${OPENSSL_LIBRARIES}
${OPENSSL_CRYPTO_LIBRARY} )

target_link_libraries(
${MOD_XRD_HTTP}
${LIB_XRD_HTTP_UTILS} )

set_target_properties(
${LIB_XRD_HTTP_UTILS}
PROPERTIES
VERSION ${XRD_HTTP_UTILS_VERSION}
SOVERSION ${XRD_HTTP_UTILS_SOVERSION}
INTERFACE_LINK_LIBRARIES ""
LINK_INTERFACE_LIBRARIES "" )

set_target_properties(
${LIB_XRD_HTTP}
${MOD_XRD_HTTP}
PROPERTIES
INTERFACE_LINK_LIBRARIES ""
SUFFIX ".so"
Expand All @@ -49,7 +69,7 @@ if( BUILD_HTTP )
# Install
#-----------------------------------------------------------------------------
install(
TARGETS ${LIB_XRD_HTTP}
TARGETS ${LIB_XRD_HTTP_UTILS} ${MOD_XRD_HTTP}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )

endif()
63 changes: 63 additions & 0 deletions src/XrdHttp/XrdHttpModule.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

#include "XrdVersion.hh"

#include "XrdHttpProtocol.hh"

/******************************************************************************/
/* P r o t o c o l L o a d e r */
/* X r d g e t P r o t o c o l */
/******************************************************************************/

// This protocol can live in a module. The interface below is used by
// the protocol driver to obtain a copy of the protocol object that can be used
// to decide whether or not a link is talking a particular protocol.
//
XrdVERSIONINFO(XrdgetProtocol, xrdhttp);

extern "C" {

XrdProtocol *XrdgetProtocol(const char *pname, char *parms,
XrdProtocol_Config *pi) {
XrdProtocol *pp = 0;
const char *txt = "completed.";

// Put up the banner
//
pi->eDest->Say("Copr. 2012 CERN IT, an HTTP implementation for the XROOTD framework.");
pi->eDest->Say("++++++ HTTP protocol initialization started.");

// Return the protocol object to be used if static init succeeds
//
if (XrdHttpProtocol::Configure(parms, pi))
pp = (XrdProtocol *)new XrdHttpProtocol(false);
else txt = "failed.";
pi->eDest->Say("------ HTTP protocol initialization ", txt);
return pp;
}
}


/******************************************************************************/
/* */
/* P r o t o c o l P o r t D e t e r m i n a t i o n */
/* X r d g e t P r o t o c o l P o r t */
/******************************************************************************/

// This function is called early on to determine the port we need to use. The
// default is ostensibly 1094 but can be overidden; which we allow.
//
XrdVERSIONINFO(XrdgetProtocolPort, xrdhttp);

extern "C" {

int XrdgetProtocolPort(const char *pname, char *parms, XrdProtocol_Config *pi) {

// Figure out what port number we should return. In practice only one port
// number is allowed. However, we could potentially have a clustered port
// and several unclustered ports. So, we let this practicality slide.
//
if (pi->Port < 0) return 1094;
return pi->Port;
}
}

66 changes: 3 additions & 63 deletions src/XrdHttp/XrdHttpProtocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,65 +117,6 @@ XrdObjectQ<XrdHttpProtocol>
XrdHttpProtocol::ProtStack("ProtStack",
"xrootd protocol anchor");

/******************************************************************************/
/* P r o t o c o l L o a d e r */
/* X r d g e t P r o t o c o l */
/******************************************************************************/

// This protocol can live in a shared library. The interface below is used by
// the protocol driver to obtain a copy of the protocol object that can be used
// to decide whether or not a link is talking a particular protocol.
//
XrdVERSIONINFO(XrdgetProtocol, xrdhttp);

extern "C" {

XrdProtocol *XrdgetProtocol(const char *pname, char *parms,
XrdProtocol_Config *pi) {
XrdProtocol *pp = 0;
const char *txt = "completed.";

// Put up the banner
//
pi->eDest->Say("Copr. 2012 CERN IT, an HTTP implementation for the XROOTD framework.");
pi->eDest->Say("++++++ HTTP protocol initialization started.");

// Return the protocol object to be used if static init succeeds
//
if (XrdHttpProtocol::Configure(parms, pi))
pp = (XrdProtocol *)new XrdHttpProtocol(false);
else txt = "failed.";
pi->eDest->Say("------ HTTP protocol initialization ", txt);
return pp;
}
}

/******************************************************************************/
/* */
/* P r o t o c o l P o r t D e t e r m i n a t i o n */
/* X r d g e t P r o t o c o l P o r t */
/******************************************************************************/

// This function is called early on to determine the port we need to use. The
// default is ostensibly 1094 but can be overidden; which we allow.
//
XrdVERSIONINFO(XrdgetProtocolPort, xrdhttp);

extern "C" {

int XrdgetProtocolPort(const char *pname, char *parms, XrdProtocol_Config *pi) {

// Figure out what port number we should return. In practice only one port
// number is allowed. However, we could potentially have a clustered port
// and several unclustered ports. So, we let this practicality slide.
//
if (pi->Port < 0) return 1094;
return pi->Port;
}
}




/******************************************************************************/
/* U g l y O p e n S S L w o r k a r o u n d s */
Expand Down Expand Up @@ -2714,6 +2655,7 @@ int XrdHttpProtocol::doStat(char *fname) {



static XrdVERSIONINFODEF(compiledVer, XrdHttpProtocolTest, XrdVNUMBER, XrdVERSION);

// Loads the SecXtractor plugin, if available
int XrdHttpProtocol::LoadSecXtractor(XrdSysError *myeDest, const char *libName,
Expand All @@ -2723,8 +2665,7 @@ int XrdHttpProtocol::LoadSecXtractor(XrdSysError *myeDest, const char *libName,
// We don't want to load it more than once
if (secxtractor) return 1;

XrdVersionInfo *myVer = &XrdVERSIONINFOVAR(XrdgetProtocol);
XrdOucPinLoader myLib(myeDest, myVer, "secxtractorlib", libName);
XrdOucPinLoader myLib(myeDest, &compiledVer, "secxtractorlib", libName);
XrdHttpSecXtractor *(*ep)(XrdHttpSecXtractorArgs);

// Get the entry point of the object creator
Expand Down Expand Up @@ -2752,8 +2693,7 @@ int XrdHttpProtocol::LoadExtHandler(XrdSysError *myeDest, const char *libName,
return 1;
}

XrdVersionInfo *myVer = &XrdVERSIONINFOVAR(XrdgetProtocol);
XrdOucPinLoader myLib(myeDest, myVer, "exthandlerlib", libName);
XrdOucPinLoader myLib(myeDest, &compiledVer, "exthandlerlib", libName);
XrdHttpExtHandler *(*ep)(XrdHttpExtHandlerArgs);

// Get the entry point of the object creator
Expand Down
2 changes: 1 addition & 1 deletion src/XrdTpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if( BUILD_TPC )
${LIB_XRD_TPC}
XrdServer
XrdUtils
XrdHttp-${PLUGIN_VERSION}
XrdHttpUtils
dl
pthread
${CURL_LIBRARIES} )
Expand Down