xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
XrdHttpUtils.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of XrdHTTP: A pragmatic implementation of the
3 // HTTP/WebDAV protocol for the Xrootd framework
4 //
5 // Copyright (c) 2013 by European Organization for Nuclear Research (CERN)
6 // Author: Fabrizio Furano <furano@cern.ch>
7 // File Date: Apr 2013
8 //------------------------------------------------------------------------------
9 // XRootD is free software: you can redistribute it and/or modify
10 // it under the terms of the GNU Lesser General Public License as published by
11 // the Free Software Foundation, either version 3 of the License, or
12 // (at your option) any later version.
13 //
14 // XRootD is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public License
20 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
21 //------------------------------------------------------------------------------
22 
23 
24 
25 
26 
27 
28 
38 #include "XProtocol/XPtypes.hh"
39 #include "XrdSec/XrdSecEntity.hh"
40 
41 #ifndef XRDHTTPUTILS_HH
42 #define XRDHTTPUTILS_HH
43 
44 
45 // GetHost from URL
46 // Parse an URL and extract the host name and port
47 // Return 0 if OK
48 int parseURL(char *url, char *host, int &port, char **path);
49 
50 // Simple itoa function
51 std::string itos(long i);
52 
53 // Home made implementation of strchrnul
54 char *mystrchrnul(const char *s, int c);
55 
56 void calcHashes(
57  char *hash,
58 
59  const char *fn,
60 
61  kXR_int16 req,
62 
63  XrdSecEntity *secent,
64 
65  time_t tim,
66 
67  const char *key);
68 
69 
70 int compareHash(
71  const char *h1,
72  const char *h2);
73 
74 
75 bool Fromhexdigest(const unsigned char *input, int length, unsigned char *out);
76 
77 void Tobase64(const unsigned char *input, int length, char *out);
78 
79 
80 // Create a new quoted string
81 char *quote(const char *str);
82 
83 // unquote a string and return a new one
84 char *unquote(char *str);
85 
86 
87 
88 
89 // Escape a string and return a new one
90 char *escapeXML(const char *str);
91 
92 
93 
94 #endif /* XRDHTTPUTILS_HH */
95 
int parseURL(char *url, char *host, int &port, char **path)
void calcHashes(char *hash, const char *fn, kXR_int16 req, XrdSecEntity *secent, time_t tim, const char *key)
char * escapeXML(const char *str)
int compareHash(const char *h1, const char *h2)
std::size_t hash(const BasicJsonType &j)
hash a JSON value
Definition: XrdOucJson.hh:5221
void Tobase64(const unsigned char *input, int length, char *out)
char * quote(const char *str)
bool Fromhexdigest(const unsigned char *input, int length, unsigned char *out)
char * mystrchrnul(const char *s, int c)
Definition: XrdSecEntity.hh:63
std::string itos(long i)
char * unquote(char *str)
short kXR_int16
Definition: XPtypes.hh:66