netservices: remove all old conditional code

Change-Id: Idf3773c081ce103647c5dbea6e82c22bfc5606c9
This commit is contained in:
Niels Sascha Reedijk
2021-09-11 13:08:11 +01:00
parent a00a1da384
commit 70b63f18b3
40 changed files with 77 additions and 1685 deletions
+4 -10
View File
@@ -15,11 +15,10 @@
#include <UrlRequest.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BDataRequest: public BUrlRequest {
public:
@@ -27,25 +26,20 @@ public:
private:
friend class BUrlProtocolRoster;
#ifdef LIBNETAPI_DEPRECATED
BDataRequest(const BUrl& url,
BUrlProtocolListener* listener = NULL,
BUrlContext* context = NULL);
#else
BDataRequest(const BUrl& url,
BDataIO* output,
BUrlProtocolListener* listener = NULL,
BUrlContext* context = NULL);
#endif
status_t _ProtocolLoop();
private:
BUrlResult fResult;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif
+2 -10
View File
@@ -13,11 +13,10 @@
#include <UrlProtocolRoster.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BFileRequest : public BUrlRequest {
public:
@@ -29,26 +28,19 @@ public:
private:
friend class BUrlProtocolRoster;
#ifdef LIBNETAPI_DEPRECATED
BFileRequest(const BUrl& url,
BUrlProtocolListener* listener = NULL,
BUrlContext* context = NULL);
#else
BFileRequest(const BUrl& url,
BDataIO* output,
BUrlProtocolListener* listener = NULL,
BUrlContext* context = NULL);
#endif
status_t _ProtocolLoop();
private:
BUrlResult fResult;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_FILE_REQUEST_H_
+3 -14
View File
@@ -12,11 +12,10 @@
#include <UrlProtocolRoster.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BGopherRequest : public BNetworkRequest {
public:
@@ -29,27 +28,18 @@ public:
private:
friend class BUrlProtocolRoster;
#ifdef LIBNETAPI_DEPRECATED
BGopherRequest(const BUrl& url,
BUrlProtocolListener* listener = NULL,
BUrlContext* context = NULL);
#else
BGopherRequest(const BUrl& url,
BDataIO* output,
BUrlProtocolListener* listener = NULL,
BUrlContext* context = NULL);
#endif
status_t _ProtocolLoop();
void _SendRequest();
bool _NeedsParsing();
bool _NeedsLastDotStrip();
#ifdef LIBNETAPI_DEPRECATED
void _ParseInput(bool last);
#else
status_t _ParseInput(bool last);
#endif
BString& _HTMLEscapeString(BString &str);
@@ -62,10 +52,9 @@ private:
BUrlResult fResult;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_GOPHER_REQUEST_H_
@@ -11,11 +11,10 @@
#include <Url.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
// HTTP authentication method
enum BHttpAuthenticationMethod {
@@ -105,10 +104,10 @@ private:
mutable BLocker fLock;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_HTTP_AUTHENTICATION_H_
+2 -4
View File
@@ -12,11 +12,10 @@
#include <map>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
enum form_type {
B_HTTP_FORM_URL_ENCODED,
@@ -194,10 +193,9 @@ private:
BHttpFormData* fPrevElement;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_HTTP_FORM_H_
+2 -4
View File
@@ -11,11 +11,10 @@
#include <String.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BHttpHeader {
public:
@@ -93,10 +92,9 @@ private:
BList fHeaderList;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_HTTP_HEADERS_H_
+2 -22
View File
@@ -23,11 +23,10 @@ namespace BPrivate {
};
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BHttpRequest : public BNetworkRequest {
public:
@@ -41,9 +40,7 @@ public:
void SetDiscardData(bool discard);
void SetDisableListener(bool disable);
void SetAutoReferrer(bool enable);
#ifndef LIBNETAPI_DEPRECATED
void SetStopOnError(bool stop);
#endif
void SetUserName(const BString& name);
void SetPassword(const BString& password);
void SetRangeStart(off_t position);
@@ -70,20 +67,12 @@ public:
private:
friend class BUrlProtocolRoster;
#ifdef LIBNETAPI_DEPRECATED
BHttpRequest(const BUrl& url,
bool ssl = false,
const char* protocolName = "HTTP",
BUrlProtocolListener* listener = NULL,
BUrlContext* context = NULL);
#else
BHttpRequest(const BUrl& url,
BDataIO* output,
bool ssl = false,
const char* protocolName = "HTTP",
BUrlProtocolListener* listener = NULL,
BUrlContext* context = NULL);
#endif
BHttpRequest(const BHttpRequest& other);
void _ResetOptions();
@@ -113,12 +102,6 @@ private:
// Utility methods
bool _IsDefaultPort();
#ifdef LIBNETAPI_DEPRECATED
// Listener notification
void _NotifyDataReceived(const char* data,
off_t pos, ssize_t length,
off_t bytesReceived, ssize_t bytesTotal);
#endif
private:
bool fSSL;
@@ -160,9 +143,7 @@ private:
bool fOptDiscardData : 1;
bool fOptDisableListener : 1;
bool fOptAutoReferer : 1;
#ifndef LIBNETAPI_DEPRECATED
bool fOptStopOnError : 1;
#endif
};
// Request method
@@ -260,10 +241,9 @@ enum http_status_code {
// HTTP default User-Agent
#define B_HTTP_PROTOCOL_USER_AGENT_FORMAT "ServicesKit (%s)"
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_PROTOCOL_HTTP_H_
+2 -15
View File
@@ -12,11 +12,10 @@
#include <UrlResult.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlRequest;
@@ -26,9 +25,6 @@ class BHttpResult: public BUrlResult {
public:
BHttpResult(const BUrl& url);
#ifdef LIBNETAPI_DEPRECATED
BHttpResult(BMessage*);
#endif
BHttpResult(const BHttpResult& other);
~BHttpResult();
@@ -38,11 +34,7 @@ public:
// Result parameters access
const BUrl& Url() const;
BString ContentType() const;
#ifdef LIBNETAPI_DEPRECATED
size_t Length() const;
#else
off_t Length() const;
#endif
// HTTP-Specific stuff
const BHttpHeaders& Headers() const;
@@ -55,10 +47,6 @@ public:
// Overloaded members
BHttpResult& operator=(const BHttpResult& other);
#ifdef LIBNETAPI_DEPRECATED
virtual status_t Archive(BMessage*, bool) const;
static BArchivable* Instantiate(BMessage*);
#endif
private:
BUrl fUrl;
@@ -67,10 +55,9 @@ private:
BString fStatusString;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_RESULT_H_
+5 -8
View File
@@ -12,9 +12,7 @@
namespace BPrivate {
#ifndef LIBNETAPI_DEPRECATED
namespace Network {
#endif
enum {
B_HTTP_TIME_FORMAT_PARSED = -1,
@@ -31,25 +29,24 @@ public:
BHttpTime();
BHttpTime(BDateTime date);
BHttpTime(const BString& dateString);
// Date modification
void SetString(const BString& string);
void SetDate(BDateTime date);
// Date conversion
BDateTime Parse();
BString ToString(int8 format = B_HTTP_TIME_FORMAT_PARSED);
private:
BString fDateString;
BDateTime fDate;
int8 fDateFormat;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
#endif
} // namespace BPrivate
#endif // _B_HTTP_TIME_H_
+2 -4
View File
@@ -13,11 +13,10 @@
#include <Url.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BNetworkCookie : public BArchivable {
public:
@@ -116,11 +115,10 @@ private:
bool fSessionCookie;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_NETWORK_COOKIE_H_
@@ -16,11 +16,10 @@
#include <Url.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BNetworkCookieList: public BObjectList<const BNetworkCookie> {
public:
@@ -164,10 +163,9 @@ private:
BUrl fUrl;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_NETWORK_COOKIE_JAR_
+2 -12
View File
@@ -14,29 +14,20 @@
class BAbstractSocket;
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BNetworkRequest: public BUrlRequest
{
public:
#ifdef LIBNETAPI_DEPRECATED
BNetworkRequest(const BUrl& url,
BUrlProtocolListener* listener,
BUrlContext* context,
const char* threadName,
const char* protocolName);
#else
BNetworkRequest(const BUrl& url,
BDataIO* output,
BUrlProtocolListener* listener,
BUrlContext* context,
const char* threadName,
const char* protocolName);
#endif
virtual status_t Stop();
virtual void SetTimeout(bigtime_t timeout);
@@ -54,10 +45,9 @@ protected:
BNetBuffer fInputBuffer;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif
+1 -5
View File
@@ -14,11 +14,10 @@
#include <Referenceable.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlContext: public BReferenceable {
public:
@@ -55,11 +54,8 @@ private:
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_CONTEXT_H_
@@ -10,11 +10,11 @@
#include <Message.h>
#include <UrlProtocolDispatchingListener.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlProtocolAsynchronousListener : public BHandler,
public BUrlProtocolListener {
@@ -33,12 +33,10 @@ private:
BUrlProtocolDispatchingListener*
fSynchronousListener;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_PROTOCOL_ASYNCHRONOUS_LISTENER_H_
@@ -10,11 +10,11 @@
#include <Message.h>
#include <UrlProtocolListener.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
//! To be in AppTypes.h
enum {
@@ -28,11 +28,7 @@ enum {
B_URL_PROTOCOL_HOSTNAME_RESOLVED,
B_URL_PROTOCOL_RESPONSE_STARTED,
B_URL_PROTOCOL_HEADERS_RECEIVED,
#ifdef LIBNETAPI_DEPRECATED
B_URL_PROTOCOL_DATA_RECEIVED,
#else
B_URL_PROTOCOL_BYTES_WRITTEN,
#endif
B_URL_PROTOCOL_DOWNLOAD_PROGRESS,
B_URL_PROTOCOL_UPLOAD_PROGRESS,
B_URL_PROTOCOL_REQUEST_COMPLETED,
@@ -54,17 +50,6 @@ public:
const char* ip);
virtual void ResponseStarted(BUrlRequest* caller);
#ifdef LIBNETAPI_DEPRECATED
virtual void HeadersReceived(BUrlRequest* caller,
const BUrlResult& result);
virtual void DataReceived(BUrlRequest* caller,
const char* data, off_t position,
ssize_t size);
virtual void DownloadProgress(BUrlRequest* caller,
ssize_t bytesReceived, ssize_t bytesTotal);
virtual void UploadProgress(BUrlRequest* caller,
ssize_t bytesSent, ssize_t bytesTotal);
#else
virtual void HeadersReceived(BUrlRequest* caller);
virtual void BytesWritten(BUrlRequest* caller,
size_t bytesWritten);
@@ -72,7 +57,6 @@ public:
off_t bytesReceived, off_t bytesTotal);
virtual void UploadProgress(BUrlRequest* caller,
off_t bytesSent, off_t bytesTotal);
#endif
virtual void RequestCompleted(BUrlRequest* caller,
bool success);
@@ -93,11 +77,9 @@ private:
BMessenger fMessenger;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_PROTOCOL_DISPATCHING_LISTENER_H_
@@ -14,11 +14,11 @@
class BCertificate;
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlRequest;
@@ -39,17 +39,6 @@ public:
virtual void HostnameResolved(BUrlRequest* caller,
const char* ip);
virtual void ResponseStarted(BUrlRequest* caller);
#ifdef LIBNETAPI_DEPRECATED
virtual void HeadersReceived(BUrlRequest* caller,
const BUrlResult& result);
virtual void DataReceived(BUrlRequest* caller,
const char* data, off_t position,
ssize_t size);
virtual void DownloadProgress(BUrlRequest* caller,
ssize_t bytesReceived, ssize_t bytesTotal);
virtual void UploadProgress(BUrlRequest* caller,
ssize_t bytesSent, ssize_t bytesTotal);
#else
virtual void HeadersReceived(BUrlRequest* caller);
virtual void BytesWritten(BUrlRequest* caller,
size_t bytesWritten);
@@ -57,7 +46,6 @@ public:
off_t bytesReceived, off_t bytesTotal);
virtual void UploadProgress(BUrlRequest* caller,
off_t bytesSent, off_t bytesTotal);
#endif
virtual void RequestCompleted(BUrlRequest* caller,
bool success);
@@ -70,10 +58,9 @@ public:
const char* message);
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_PROTOCOL_LISTENER_H_
@@ -13,11 +13,11 @@
class BDataIO;
class BUrl;
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlContext;
class BUrlProtocolListener;
@@ -25,21 +25,14 @@ class BUrlRequest;
class BUrlProtocolRoster {
public:
#ifdef LIBNETAPI_DEPRECATED
static BUrlRequest* MakeRequest(const BUrl& url,
BUrlProtocolListener* listener = NULL,
BUrlContext* context = NULL);
#else
static BUrlRequest* MakeRequest(const BUrl& url, BDataIO* output,
BUrlProtocolListener* listener = NULL,
BUrlContext* context = NULL);
#endif
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif
#endif // _B_URL_ROSTER_H_
+3 -22
View File
@@ -14,36 +14,24 @@
#include <Referenceable.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlRequest {
public:
#ifdef LIBNETAPI_DEPRECATED
BUrlRequest(const BUrl& url,
BUrlProtocolListener* listener,
BUrlContext* context,
const char* threadName,
const char* protocolName);
#else
BUrlRequest(const BUrl& url,
BDataIO* output,
BUrlProtocolListener* listener,
BUrlContext* context,
const char* threadName,
const char* protocolName);
#endif
virtual ~BUrlRequest();
// URL protocol thread management
virtual thread_id Run();
#ifdef LIBNETAPI_DEPRECATED
virtual status_t Pause();
virtual status_t Resume();
#endif
virtual status_t Stop();
virtual void SetTimeout(bigtime_t timeout) {}
@@ -52,18 +40,14 @@ public:
status_t SetUrl(const BUrl& url);
status_t SetContext(BUrlContext* context);
status_t SetListener(BUrlProtocolListener* listener);
#ifndef LIBNETAPI_DEPRECATED
status_t SetOutput(BDataIO* output);
#endif
// URL protocol parameters access
const BUrl& Url() const;
BUrlContext* Context() const;
BUrlProtocolListener* Listener() const;
const BString& Protocol() const;
#ifndef LIBNETAPI_DEPRECATED
BDataIO* Output() const;
#endif
// URL protocol informations
bool IsRunning() const;
@@ -81,9 +65,7 @@ protected:
BUrl fUrl;
BReference<BUrlContext> fContext;
BUrlProtocolListener* fListener;
#ifndef LIBNETAPI_DEPRECATED
BDataIO* fOutput;
#endif
bool fQuit;
bool fRunning;
@@ -93,10 +75,9 @@ protected:
BString fProtocol;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_REQUEST_H_
+3 -30
View File
@@ -9,37 +9,11 @@
#include <String.h>
#ifdef LIBNETAPI_DEPRECATED
#include <Archivable.h>
class BUrlResult: public BArchivable {
public:
BUrlResult();
BUrlResult(BMessage*);
virtual ~BUrlResult();
virtual status_t Archive(BMessage*, bool) const;
void SetContentType(BString contentType);
void SetLength(size_t length);
virtual BString ContentType() const;
virtual size_t Length() const;
static BArchivable* Instantiate(BMessage*);
private:
BString fContentType;
size_t fLength;
};
#else
namespace BPrivate {
namespace Network {
class BUrlResult {
public:
BUrlResult();
@@ -56,10 +30,9 @@ private:
off_t fLength;
};
}
}
} // namespace Network
#endif // LIBNETAPI_DEPRECATED
} // namespace BPrivate
#endif // _B_URL_RESULT_H_
@@ -10,11 +10,10 @@
#include <UrlProtocolListener.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlSynchronousRequest : public BUrlRequest, public BUrlProtocolListener {
public:
@@ -30,17 +29,6 @@ public:
virtual void HostnameResolved(BUrlRequest* caller,
const char* ip);
virtual void ResponseStarted(BUrlRequest* caller);
#ifdef LIBNETAPI_DEPRECATED
virtual void HeadersReceived(BUrlRequest* caller,
const BUrlResult& result);
virtual void DataReceived(BUrlRequest* caller,
const char* data, off_t position,
ssize_t size);
virtual void DownloadProgress(BUrlRequest* caller,
ssize_t bytesReceived, ssize_t bytesTotal);
virtual void UploadProgress(BUrlRequest* caller,
ssize_t bytesSent, ssize_t bytesTotal);
#else
virtual void HeadersReceived(BUrlRequest* caller);
virtual void BytesWritten(BUrlRequest* caller,
size_t bytesWritten);
@@ -48,22 +36,18 @@ public:
off_t bytesReceived, off_t bytesTotal);
virtual void UploadProgress(BUrlRequest* caller,
off_t bytesSent, off_t bytesTotal);
#endif
virtual void RequestCompleted(BUrlRequest* caller,
bool success);
protected:
bool fRequestComplete;
BUrlRequest& fWrappedRequest;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_SYNCHRONOUS_REQUEST_H_