XRootD
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 #include "XrdOuc/XrdOucIOVec.hh"
41 #include <string>
42 #include <vector>
43 
44 #ifndef XRDHTTPUTILS_HH
45 #define XRDHTTPUTILS_HH
46 
47 
48 // GetHost from URL
49 // Parse an URL and extract the host name and port
50 // Return 0 if OK
51 int parseURL(char *url, char *host, int &port, char **path);
52 
53 // Simple itoa function
54 std::string itos(long i);
55 
56 // Home made implementation of strchrnul
57 char *mystrchrnul(const char *s, int c);
58 
59 void calcHashes(
60  char *hash,
61 
62  const char *fn,
63 
64  kXR_int16 req,
65 
66  XrdSecEntity *secent,
67 
68  time_t tim,
69 
70  const char *key);
71 
72 
73 int compareHash(
74  const char *h1,
75  const char *h2);
76 
77 
78 bool Fromhexdigest(const unsigned char *input, int length, unsigned char *out);
79 
80 void Tobase64(const unsigned char *input, int length, char *out);
81 
82 
83 // Create a new quoted string
84 char *quote(const char *str);
85 
86 // unquote a string and return a new one
87 char *unquote(char *str);
88 
89 
90 
91 
92 // Escape a string and return a new one
93 char *escapeXML(const char *str);
94 
95 typedef std::vector<XrdOucIOVec2> XrdHttpIOList;
96 
97 
98 
99 #endif /* XRDHTTPUTILS_HH */
100 
short kXR_int16
Definition: XPtypes.hh:66
int parseURL(char *url, char *host, int &port, char **path)
Definition: XrdHttpUtils.cc:77
std::string itos(long i)
void Tobase64(const unsigned char *input, int length, char *out)
int compareHash(const char *h1, const char *h2)
char * unquote(char *str)
bool Fromhexdigest(const unsigned char *input, int length, unsigned char *out)
void calcHashes(char *hash, const char *fn, kXR_int16 req, XrdSecEntity *secent, time_t tim, const char *key)
std::vector< XrdOucIOVec2 > XrdHttpIOList
Definition: XrdHttpUtils.hh:95
char * escapeXML(const char *str)
char * mystrchrnul(const char *s, int c)
char * quote(const char *str)