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