Make handling of Http Authentication thread safe

* Each BHttpAuthentication object is locked on all field accesses,
* They are owned by the BUrlContext and never deleted, so there is no
need for reference-counting them,
* The BUrlContext itself is now reference counted, and all BUrlRequests
hold a reference to it.

This makes sure using the BHttpAuthentication objects from requests is
thread-safe.
This commit is contained in:
Adrien Destugues
2014-06-11 14:11:01 +02:00
parent 463ffbfde4
commit 895fa41e0b
6 changed files with 50 additions and 27 deletions
+5 -2
View File
@@ -1,13 +1,14 @@
/*
* Copyright 2010 Haiku Inc. All rights reserved.
* Copyright 2010-2014 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _B_HTTP_AUTHENTICATION_H_
#define _B_HTTP_AUTHENTICATION_H_
#include <Url.h>
#include <Locker.h>
#include <String.h>
#include <Url.h>
// HTTP authentication method
enum BHttpAuthenticationMethod {
@@ -89,6 +90,8 @@ private:
BHttpAuthenticationQop fDigestQop;
BString fAuthorizationString;
mutable BLocker fLock;
};
#endif // _B_HTTP_AUTHENTICATION_H_