diff --git a/packaging/debian/xrootd-server-devel.install b/packaging/debian/xrootd-server-devel.install index d1dcf33b6c5..145f8a2434d 100644 --- a/packaging/debian/xrootd-server-devel.install +++ b/packaging/debian/xrootd-server-devel.install @@ -6,3 +6,4 @@ usr/include/xrootd/XrdSfs usr/include/xrootd/XrdXrootd usr/include/xrootd/XrdHttp usr/lib/*/libXrdServer.so +usr/lib/*/libXrdHttpUtils.so diff --git a/packaging/debian/xrootd-server-libs.install b/packaging/debian/xrootd-server-libs.install index de9c8be9e28..ae5f84c83a5 100644 --- a/packaging/debian/xrootd-server-libs.install +++ b/packaging/debian/xrootd-server-libs.install @@ -4,6 +4,7 @@ usr/lib/*/libXrdXrootd-4.so usr/lib/*/libXrdFileCache-4.so usr/lib/*/libXrdBlacklistDecision-4.so usr/lib/*/libXrdHttp-4.so +usr/lib/*/libXrdHttpUtils.so.* usr/lib/*/libXrdN2No2p-4.so usr/lib/*/libXrdOssSIgpfsT-4.so usr/lib/*/libXrdServer.so.* diff --git a/packaging/rhel/xrootd.spec.in b/packaging/rhel/xrootd.spec.in index 2270daf8241..6166cdd05d6 100644 --- a/packaging/rhel/xrootd.spec.in +++ b/packaging/rhel/xrootd.spec.in @@ -778,6 +778,7 @@ fi %{_libdir}/libXrdFileCache-4.so %{_libdir}/libXrdBlacklistDecision-4.so %{_libdir}/libXrdHttp-4.so +%{_libdir}/libXrdHttpUtils.so.* %{_libdir}/libXrdN2No2p-4.so %{_libdir}/libXrdOssSIgpfsT-4.so %{_libdir}/libXrdServer.so.* @@ -797,6 +798,7 @@ fi %{_includedir}/xrootd/XrdXrootd %{_includedir}/xrootd/XrdHttp %{_libdir}/libXrdServer.so +%{_libdir}/libXrdHttpUtils.so %files private-devel %defattr(-,root,root,-) diff --git a/src/XrdHttp.cmake b/src/XrdHttp.cmake index 843f1c0bc8c..19221eb24d7 100644 --- a/src/XrdHttp.cmake +++ b/src/XrdHttp.cmake @@ -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 ) #----------------------------------------------------------------------------- @@ -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 @@ -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 @@ -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" @@ -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() diff --git a/src/XrdHttp/XrdHttpModule.cc b/src/XrdHttp/XrdHttpModule.cc new file mode 100644 index 00000000000..8523ab5503d --- /dev/null +++ b/src/XrdHttp/XrdHttpModule.cc @@ -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; + } +} + diff --git a/src/XrdHttp/XrdHttpProtocol.cc b/src/XrdHttp/XrdHttpProtocol.cc index 4cfc4a62677..cd41ee8190f 100644 --- a/src/XrdHttp/XrdHttpProtocol.cc +++ b/src/XrdHttp/XrdHttpProtocol.cc @@ -117,65 +117,6 @@ XrdObjectQ 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 */ @@ -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, @@ -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 @@ -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 diff --git a/src/XrdTpc.cmake b/src/XrdTpc.cmake index fb64287a853..bc64d4e4785 100644 --- a/src/XrdTpc.cmake +++ b/src/XrdTpc.cmake @@ -29,7 +29,7 @@ if( BUILD_TPC ) ${LIB_XRD_TPC} XrdServer XrdUtils - XrdHttp-${PLUGIN_VERSION} + XrdHttpUtils dl pthread ${CURL_LIBRARIES} )