1/*
2 * Copyright 2010-2015 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5
6
7#ifndef _B_URL_CONTEXT_H_
8#define _B_URL_CONTEXT_H_
9
10
11#include <Certificate.h>
12#include <HttpAuthentication.h>
13#include <NetworkCookieJar.h>
14#include <Referenceable.h>
15
16
17namespace BPrivate {
18
19namespace Network {
20
21
22class BUrlContext: public BReferenceable {
23public:
24								BUrlContext();
25								~BUrlContext();
26
27	// Context modifiers
28			void				SetCookieJar(
29									const BNetworkCookieJar& cookieJar);
30			void				AddAuthentication(const BUrl& url,
31									const BHttpAuthentication& authentication);
32			void				SetProxy(BString host, uint16 port);
33			void				AddCertificateException(const BCertificate& certificate);
34
35	// Context accessors
36			BNetworkCookieJar&	GetCookieJar();
37			BHttpAuthentication& GetAuthentication(const BUrl& url);
38			bool				UseProxy();
39			BString				GetProxyHost();
40			uint16				GetProxyPort();
41			bool				HasCertificateException(const BCertificate& certificate);
42
43private:
44			class 				BHttpAuthenticationMap;
45
46private:
47			BNetworkCookieJar	fCookieJar;
48			BHttpAuthenticationMap* fAuthenticationMap;
49			typedef BObjectList<const BCertificate> BCertificateSet;
50			BCertificateSet		fCertificates;
51
52			BString				fProxyHost;
53			uint16				fProxyPort;
54};
55
56
57} // namespace Network
58
59} // namespace BPrivate
60
61#endif // _B_URL_CONTEXT_H_
62