2010-10-27 18:03:31 +04:00
|
|
|
/*
|
2014-06-11 16:11:01 +04:00
|
|
|
* Copyright 2010-2014 Haiku Inc. All rights reserved.
|
2010-10-27 18:03:31 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2014-09-15 16:24:37 +04:00
|
|
|
|
|
|
|
|
2010-10-27 18:03:31 +04:00
|
|
|
#ifndef _B_URL_CONTEXT_H_
|
|
|
|
#define _B_URL_CONTEXT_H_
|
|
|
|
|
|
|
|
|
2013-10-28 20:09:18 +04:00
|
|
|
#include <HttpAuthentication.h>
|
2010-10-27 18:03:31 +04:00
|
|
|
#include <NetworkCookieJar.h>
|
2014-06-11 16:11:01 +04:00
|
|
|
#include <Referenceable.h>
|
2010-10-27 18:03:31 +04:00
|
|
|
|
|
|
|
|
2013-10-28 20:09:18 +04:00
|
|
|
namespace BPrivate {
|
2014-06-11 16:11:01 +04:00
|
|
|
template <class key, class value> class SynchronizedHashMap;
|
2013-10-28 20:09:18 +04:00
|
|
|
class HashString;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-06-11 16:11:01 +04:00
|
|
|
class BUrlContext: public BReferenceable {
|
2010-10-27 18:03:31 +04:00
|
|
|
public:
|
|
|
|
BUrlContext();
|
2013-10-28 20:09:18 +04:00
|
|
|
~BUrlContext();
|
2010-10-27 18:03:31 +04:00
|
|
|
|
|
|
|
// Context modifiers
|
|
|
|
void SetCookieJar(
|
|
|
|
const BNetworkCookieJar& cookieJar);
|
2013-10-28 20:09:18 +04:00
|
|
|
void AddAuthentication(const BUrl& url,
|
2014-06-11 16:11:01 +04:00
|
|
|
const BHttpAuthentication& authentication);
|
2014-09-15 16:24:37 +04:00
|
|
|
void SetProxy(BString host, uint16 port);
|
|
|
|
|
2010-10-27 18:03:31 +04:00
|
|
|
// Context accessors
|
|
|
|
BNetworkCookieJar& GetCookieJar();
|
2013-10-28 20:09:18 +04:00
|
|
|
BHttpAuthentication& GetAuthentication(const BUrl& url);
|
2014-09-15 16:24:37 +04:00
|
|
|
bool UseProxy();
|
|
|
|
BString GetProxyHost();
|
|
|
|
uint16 GetProxyPort();
|
2010-10-27 18:03:31 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
BNetworkCookieJar fCookieJar;
|
2014-06-11 16:11:01 +04:00
|
|
|
typedef BPrivate::SynchronizedHashMap<BPrivate::HashString,
|
2013-10-28 20:09:18 +04:00
|
|
|
BHttpAuthentication*> BHttpAuthenticationMap;
|
|
|
|
BHttpAuthenticationMap* fAuthenticationMap;
|
2014-09-15 16:24:37 +04:00
|
|
|
|
|
|
|
BString fProxyHost;
|
|
|
|
uint16 fProxyPort;
|
2010-10-27 18:03:31 +04:00
|
|
|
};
|
|
|
|
|
2014-09-15 16:24:37 +04:00
|
|
|
|
2010-10-27 18:03:31 +04:00
|
|
|
#endif // _B_URL_CONTEXT_H_
|