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 00040 #ifndef XRDHTTPUTILS_HH 00041 #define XRDHTTPUTILS_HH 00042 00043 00044 // GetHost from URL 00045 // Parse an URL and extract the host name and port 00046 // Return 0 if OK 00047 int parseURL(char *url, char *host, int &port, char **path); 00048 00049 // Simple itoa function 00050 std::string itos(long i); 00051 00052 // Home made implementation of strchrnul 00053 char *mystrchrnul(const char *s, int c); 00054 00055 void calcHashes( 00056 char *hash, 00057 00058 const char *fn, 00059 00060 kXR_int16 req, 00061 00062 XrdSecEntity *secent, 00063 00064 time_t tim, 00065 00066 const char *key); 00067 00068 00069 int compareHash( 00070 const char *h1, 00071 const char *h2); 00072 00073 00074 bool Fromhexdigest(const unsigned char *input, int length, unsigned char *out); 00075 00076 void Tobase64(const unsigned char *input, int length, char *out); 00077 00078 00079 // Create a new quoted string 00080 char *quote(const char *str); 00081 00082 // unquote a string and return a new one 00083 char *unquote(char *str); 00084 00085 #endif /* XRDHTTPUTILS_HH */ 00086