Add HTTP proxy support.

* Move default context management to BUrlRequest since some code
(including the testsuite) bypass the BUrlProtocolRoster.
* Introduce proxy host and port in BUrlContext
* Have BHttpRequest use the proxy when making requests
This commit is contained in:
Adrien Destugues
2014-09-15 14:24:37 +02:00
parent cee64ce507
commit c98378e51a
10 changed files with 124 additions and 32 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ public:
virtual status_t Stop();
protected:
bool _ResolveHostName(uint16_t port);
bool _ResolveHostName(BString host, uint16_t port);
void _ProtocolSetup();
status_t _GetLine(BString& destString);
+11 -1
View File
@@ -2,6 +2,8 @@
* Copyright 2010-2014 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _B_URL_CONTEXT_H_
#define _B_URL_CONTEXT_H_
@@ -27,16 +29,24 @@ public:
const BNetworkCookieJar& cookieJar);
void AddAuthentication(const BUrl& url,
const BHttpAuthentication& authentication);
void SetProxy(BString host, uint16 port);
// Context accessors
BNetworkCookieJar& GetCookieJar();
BHttpAuthentication& GetAuthentication(const BUrl& url);
bool UseProxy();
BString GetProxyHost();
uint16 GetProxyPort();
private:
BNetworkCookieJar fCookieJar;
typedef BPrivate::SynchronizedHashMap<BPrivate::HashString,
BHttpAuthentication*> BHttpAuthenticationMap;
BHttpAuthenticationMap* fAuthenticationMap;
BString fProxyHost;
uint16 fProxyPort;
};
#endif // _B_URL_CONTEXT_H_