00001 //------------------------------------------------------------------------------ 00002 // This file is part of XrdHTTP: A pragmatic implementation of the 00003 // HTTP/WebDAV protocol for the Xrootd framework 00004 // 00005 // Copyright (c) 2013 by European Organization for Nuclear Research (CERN) 00006 // Author: Fabrizio Furano <furano@cern.ch> 00007 // File Date: Apr 2013 00008 //------------------------------------------------------------------------------ 00009 // XRootD is free software: you can redistribute it and/or modify 00010 // it under the terms of the GNU Lesser General Public License as published by 00011 // the Free Software Foundation, either version 3 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // XRootD is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU Lesser General Public License 00020 // along with XRootD. If not, see <http://www.gnu.org/licenses/>. 00021 //------------------------------------------------------------------------------ 00022 00023 00024 00025 00026 00027 00028 00038 #include "XProtocol/XPtypes.hh" 00039 #include "XrdSec/XrdSecEntity.hh" 00040 00041 #ifndef XRDHTTPUTILS_HH 00042 #define XRDHTTPUTILS_HH 00043 00044 00045 // GetHost from URL 00046 // Parse an URL and extract the host name and port 00047 // Return 0 if OK 00048 int parseURL(char *url, char *host, int &port, char **path); 00049 00050 // Simple itoa function 00051 std::string itos(long i); 00052 00053 // Home made implementation of strchrnul 00054 char *mystrchrnul(const char *s, int c); 00055 00056 void calcHashes( 00057 char *hash, 00058 00059 const char *fn, 00060 00061 kXR_int16 req, 00062 00063 XrdSecEntity *secent, 00064 00065 time_t tim, 00066 00067 const char *key); 00068 00069 00070 int compareHash( 00071 const char *h1, 00072 const char *h2); 00073 00074 00075 bool Fromhexdigest(const unsigned char *input, int length, unsigned char *out); 00076 00077 void Tobase64(const unsigned char *input, int length, char *out); 00078 00079 00080 // Create a new quoted string 00081 char *quote(const char *str); 00082 00083 // unquote a string and return a new one 00084 char *unquote(char *str); 00085 00086 #endif /* XRDHTTPUTILS_HH */ 00087