Utility functions for XrdHTTP. More...
#include "XProtocol/XPtypes.hh"#include "XProtocol/XProtocol.hh"#include "XrdSec/XrdSecEntity.hh"#include "XrdOuc/XrdOucIOVec.hh"#include "XrdOuc/XrdOucTUtils.hh"#include <string>#include <cstring>#include <vector>#include <memory>#include <sstream>#include <cstdint>Go to the source code of this file.
Typedefs | |
| typedef std::vector< XrdOucIOVec2 > | XrdHttpIOList |
Functions | |
| void | base64DecodeHex (const std::string &base64, std::string &hexOutput) |
| void | base64ToBytes (const std::string &base64digest, std::vector< uint8_t > &outputBytes) |
| void | bytesToHex (const std::vector< uint8_t > &bytes, std::string &hexOutput) |
| 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) |
| char * | decode_raw (const std::string &str) |
| std::string | decode_str (const std::string &str) |
| std::string | encode_opaque (const std::string &opaque) |
| char * | encode_raw (const std::string &str) |
| std::string | encode_str (const std::string &str) |
| char * | escapeXML (const char *str) |
| bool | Fromhexdigest (const std::string &hex, std::vector< uint8_t > &outputBytes) |
| std::string | httpStatusToString (int status) |
| std::string | itos (long i) |
| int | mapErrNoToHttp (int err) |
| int | mapXrdErrToHttp (XErrorCode xrdError) |
| char * | mystrchrnul (const char *s, int c) |
| char * | quote (const char *str) |
| void | Tobase64 (const std::vector< uint8_t > &input, std::string &base64Output) |
| void | Tobase64 (const unsigned char *input, int length, char *out) |
| char * | unquote (char *str) |
| typedef std::vector<XrdOucIOVec2> XrdHttpIOList |
Definition at line 255 of file XrdHttpUtils.hh.
| anonymous enum : int |
Definition at line 52 of file XrdHttpUtils.hh.
| void base64DecodeHex | ( | const std::string & | base64, |
| std::string & | hexOutput ) |
Definition at line 155 of file XrdHttpUtils.cc.
References base64ToBytes(), and bytesToHex().
Referenced by XrdHttpHeaderUtils::parseReprDigest().
| void base64ToBytes | ( | const std::string & | base64digest, |
| std::vector< uint8_t > & | outputBytes ) |
Definition at line 118 of file XrdHttpUtils.cc.
Referenced by base64DecodeHex().
| void bytesToHex | ( | const std::vector< uint8_t > & | bytes, |
| std::string & | hexOutput ) |
Definition at line 145 of file XrdHttpUtils.cc.
Referenced by base64DecodeHex().
| void calcHashes | ( | char * | hash, |
| const char * | fn, | ||
| kXR_int16 | req, | ||
| XrdSecEntity * | secent, | ||
| time_t | tim, | ||
| const char * | key ) |
Definition at line 231 of file XrdHttpUtils.cc.
References XrdSecEntity::host, XrdSecEntity::moninfo, XrdSecEntity::name, Tobase64(), and XrdSecEntity::vorg.
Referenced by XrdHttpProtocol::Process(), and XrdHttpReq::Redir().
| int compareHash | ( | const char * | h1, |
| const char * | h2 ) |
Definition at line 367 of file XrdHttpUtils.cc.
Referenced by XrdHttpProtocol::Process().
|
inline |
Creates a non-const copy of the string passed in parameter and calls unquote() on it before returning the pointer to the unquoted string
| str | the string to unquote |
Definition at line 175 of file XrdHttpUtils.hh.
References unquote().
Referenced by decode_str().
|
inline |
Decodes the string passed in parameter (converts all XX codes to their 8bit versions) Calls unquote() Returns the std::string containing the decoded string.
Definition at line 213 of file XrdHttpUtils.hh.
References decode_raw().
Referenced by XrdHttpProtocol::Process().
|
inline |
Encodes opaque query string parameters example: authz=Bearer token --> authz=Bearer%20token
| opaque | the opaque query string to encode |
Definition at line 226 of file XrdHttpUtils.hh.
References encode_str(), and XrdOucTUtils::splitString().
Referenced by XrdHttpReq::appendOpaque(), XrdHttpReq::ProcessHTTPReq(), and XrdHttpReq::Redir().
|
inline |
Calls quote() on the string passed in parameter
| str | the string to quote |
Definition at line 190 of file XrdHttpUtils.hh.
References quote().
Referenced by encode_str().
|
inline |
Encodes the URL passed in parameter (converts all letters consider illegal in URLs to their XX versions). Calls quote() Returns a std::string containing the encoded string
Definition at line 200 of file XrdHttpUtils.hh.
References encode_raw().
Referenced by XrdHttpReq::appendOpaque(), encode_opaque(), and XrdHttpReq::Redir().
| char * escapeXML | ( | const char * | str | ) |
Definition at line 473 of file XrdHttpUtils.cc.
Referenced by XrdHttpReq::Error().
| bool Fromhexdigest | ( | const std::string & | hex, |
| std::vector< uint8_t > & | outputBytes ) |
Definition at line 177 of file XrdHttpUtils.cc.
References char_to_int().
| std::string httpStatusToString | ( | int | status | ) |
Definition at line 594 of file XrdHttpUtils.cc.
| std::string itos | ( | long | i | ) |
Definition at line 195 of file XrdHttpUtils.cc.
| int mapErrNoToHttp | ( | int | err | ) |
Definition at line 521 of file XrdHttpUtils.cc.
References EAUTH, HTTP_BAD_GATEWAY, HTTP_BAD_REQUEST, HTTP_CONFLICT, HTTP_FORBIDDEN, HTTP_GATEWAY_TIMEOUT, HTTP_INSUFFICIENT_STORAGE, HTTP_INTERNAL_SERVER_ERROR, HTTP_LOOP_DETECTED, HTTP_NOT_FOUND, HTTP_NOT_IMPLEMENTED, HTTP_PAYLOAD_TOO_LARGE, HTTP_SERVICE_UNAVAILABLE, HTTP_UNAUTHORIZED, HTTP_UNPROCESSABLE_ENTITY, and HTTP_URI_TOO_LONG.
Referenced by mapXrdErrToHttp().
| int mapXrdErrToHttp | ( | XErrorCode | xrdError | ) |
Definition at line 514 of file XrdHttpUtils.cc.
References mapErrNoToHttp(), and XProtocol::toErrno().
| char * mystrchrnul | ( | const char * | s, |
| int | c ) |
Definition at line 205 of file XrdHttpUtils.cc.
| char * quote | ( | const char * | str | ) |
Definition at line 414 of file XrdHttpUtils.cc.
Referenced by encode_raw().
| void Tobase64 | ( | const std::vector< uint8_t > & | input, |
| std::string & | base64Output ) |
Definition at line 90 of file XrdHttpUtils.cc.
| void Tobase64 | ( | const unsigned char * | input, |
| int | length, | ||
| char * | out ) |
Definition at line 60 of file XrdHttpUtils.cc.
Referenced by calcHashes().
| char * unquote | ( | char * | str | ) |
Definition at line 382 of file XrdHttpUtils.cc.
Referenced by decode_raw().