Make sure we never give a NULL context to requests.

Use a default context instead. This allows apps without a context
management to still have cookies and HTTP digest authentication (without
persistence to disk).

First part of fix to #10239 (it also needs changes in WebKit).
This commit is contained in:
Adrien Destugues 2013-11-25 11:57:54 +01:00
parent c9a5d95df2
commit 4192f44dc4

View File

@ -17,10 +17,16 @@
#include <Debug.h> #include <Debug.h>
static BUrlContext gDefaultContext;
/* static */ BUrlRequest* /* static */ BUrlRequest*
BUrlProtocolRoster::MakeRequest(const BUrl& url, BUrlProtocolRoster::MakeRequest(const BUrl& url,
BUrlProtocolListener* listener, BUrlContext* context) BUrlProtocolListener* listener, BUrlContext* context)
{ {
if(context == NULL)
context = &gDefaultContext;
// TODO: instanciate the correct BUrlProtocol using add-on interface // TODO: instanciate the correct BUrlProtocol using add-on interface
if (url.Protocol() == "http") { if (url.Protocol() == "http") {
return new(std::nothrow) BHttpRequest(url, false, "HTTP", listener, return new(std::nothrow) BHttpRequest(url, false, "HTTP", listener,