1
0
mirror of https://github.com/stefanocasazza/ULib.git synced 2025-09-28 19:05:55 +08:00
ULib/examples/http_header/include/HttpBaAuthorization.h
2015-01-23 17:24:36 +01:00

47 lines
1.1 KiB
C++

// HttpBaAuthorization.h
#ifndef HTTP_BA_AUTHORIZATION_H
#define HTTP_BA_AUTHORIZATION_H 1
#include <HttpField.h>
class HttpBaAuthorization : public HttpField {
public:
HttpBaAuthorization(const char* name_, unsigned name_len, const char* value_, unsigned value_len);
/**
* @param user_ User for basic authorization
* @param passwd_ Password for basic authorization
*/
HttpBaAuthorization(const UString& user_, const UString& passwd_) : HttpField(U_STRING_FROM_CONSTANT("Authorization")),
user(user_), passwd(passwd_)
{
U_TRACE_REGISTER_OBJECT(5, HttpBaAuthorization, "%.*S,%.*S", U_STRING_TO_TRACE(user_), U_STRING_TO_TRACE(passwd_))
}
/** Destructor of the class.
*/
virtual ~HttpBaAuthorization()
{
U_TRACE_UNREGISTER_OBJECT(5, HttpBaAuthorization)
}
/**
* @param field_ String where to save header as string
*/
virtual void stringify(UString& field);
/// DEBUG
#if defined(U_STDCPP_ENABLE) && defined(DEBUG)
const char* dump(bool reset) const;
#endif
protected:
UString buffer;
public:
UString user, passwd;
};
#endif