diff --git a/headers/private/netservices/DataRequest.h b/headers/private/netservices/DataRequest.h index 82b72eecff..9ad40b0785 100644 --- a/headers/private/netservices/DataRequest.h +++ b/headers/private/netservices/DataRequest.h @@ -15,11 +15,10 @@ #include -#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 diff --git a/headers/private/netservices/FileRequest.h b/headers/private/netservices/FileRequest.h index f2d1931da4..7ad549cbad 100644 --- a/headers/private/netservices/FileRequest.h +++ b/headers/private/netservices/FileRequest.h @@ -13,11 +13,10 @@ #include -#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_ diff --git a/headers/private/netservices/GopherRequest.h b/headers/private/netservices/GopherRequest.h index 635d36ab0b..2878e0a154 100644 --- a/headers/private/netservices/GopherRequest.h +++ b/headers/private/netservices/GopherRequest.h @@ -12,11 +12,10 @@ #include -#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_ diff --git a/headers/private/netservices/HttpAuthentication.h b/headers/private/netservices/HttpAuthentication.h index ff66ba1070..1edf1acaba 100644 --- a/headers/private/netservices/HttpAuthentication.h +++ b/headers/private/netservices/HttpAuthentication.h @@ -11,11 +11,10 @@ #include -#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_ diff --git a/headers/private/netservices/HttpForm.h b/headers/private/netservices/HttpForm.h index 3c56da1505..30bc7f2e51 100644 --- a/headers/private/netservices/HttpForm.h +++ b/headers/private/netservices/HttpForm.h @@ -12,11 +12,10 @@ #include -#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_ diff --git a/headers/private/netservices/HttpHeaders.h b/headers/private/netservices/HttpHeaders.h index ff97953f91..a0710c4b8f 100644 --- a/headers/private/netservices/HttpHeaders.h +++ b/headers/private/netservices/HttpHeaders.h @@ -11,11 +11,10 @@ #include -#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_ diff --git a/headers/private/netservices/HttpRequest.h b/headers/private/netservices/HttpRequest.h index ac8383f903..601c8b6561 100644 --- a/headers/private/netservices/HttpRequest.h +++ b/headers/private/netservices/HttpRequest.h @@ -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_ diff --git a/headers/private/netservices/HttpResult.h b/headers/private/netservices/HttpResult.h index d4203b9f66..12c1adab22 100644 --- a/headers/private/netservices/HttpResult.h +++ b/headers/private/netservices/HttpResult.h @@ -12,11 +12,10 @@ #include -#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_ diff --git a/headers/private/netservices/HttpTime.h b/headers/private/netservices/HttpTime.h index 68f4454243..8f5a4a57fd 100644 --- a/headers/private/netservices/HttpTime.h +++ b/headers/private/netservices/HttpTime.h @@ -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_ diff --git a/headers/private/netservices/NetworkCookie.h b/headers/private/netservices/NetworkCookie.h index 9c5b797c3d..c788ffcb86 100644 --- a/headers/private/netservices/NetworkCookie.h +++ b/headers/private/netservices/NetworkCookie.h @@ -13,11 +13,10 @@ #include -#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_ diff --git a/headers/private/netservices/NetworkCookieJar.h b/headers/private/netservices/NetworkCookieJar.h index fddae9f6a9..e1d2c8eede 100644 --- a/headers/private/netservices/NetworkCookieJar.h +++ b/headers/private/netservices/NetworkCookieJar.h @@ -16,11 +16,10 @@ #include -#ifndef LIBNETAPI_DEPRECATED namespace BPrivate { namespace Network { -#endif + class BNetworkCookieList: public BObjectList { public: @@ -164,10 +163,9 @@ private: BUrl fUrl; }; -#ifndef LIBNETAPI_DEPRECATED + } // namespace Network } // namespace BPrivate -#endif #endif // _B_NETWORK_COOKIE_JAR_ diff --git a/headers/private/netservices/NetworkRequest.h b/headers/private/netservices/NetworkRequest.h index 9357e5322d..578690f07f 100644 --- a/headers/private/netservices/NetworkRequest.h +++ b/headers/private/netservices/NetworkRequest.h @@ -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 diff --git a/headers/private/netservices/UrlContext.h b/headers/private/netservices/UrlContext.h index cc880b4783..b84f0d2f55 100644 --- a/headers/private/netservices/UrlContext.h +++ b/headers/private/netservices/UrlContext.h @@ -14,11 +14,10 @@ #include -#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_ diff --git a/headers/private/netservices/UrlProtocolAsynchronousListener.h b/headers/private/netservices/UrlProtocolAsynchronousListener.h index 2c4521cdd5..e1d1e4cb5e 100644 --- a/headers/private/netservices/UrlProtocolAsynchronousListener.h +++ b/headers/private/netservices/UrlProtocolAsynchronousListener.h @@ -10,11 +10,11 @@ #include #include -#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_ - diff --git a/headers/private/netservices/UrlProtocolDispatchingListener.h b/headers/private/netservices/UrlProtocolDispatchingListener.h index 2d993a0ddd..6f2b14bc27 100644 --- a/headers/private/netservices/UrlProtocolDispatchingListener.h +++ b/headers/private/netservices/UrlProtocolDispatchingListener.h @@ -10,11 +10,11 @@ #include #include -#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_ - diff --git a/headers/private/netservices/UrlProtocolListener.h b/headers/private/netservices/UrlProtocolListener.h index c8d40304fd..3ce78e4321 100644 --- a/headers/private/netservices/UrlProtocolListener.h +++ b/headers/private/netservices/UrlProtocolListener.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_ diff --git a/headers/private/netservices/UrlProtocolRoster.h b/headers/private/netservices/UrlProtocolRoster.h index 3f438e55b9..60341b487d 100644 --- a/headers/private/netservices/UrlProtocolRoster.h +++ b/headers/private/netservices/UrlProtocolRoster.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_ diff --git a/headers/private/netservices/UrlRequest.h b/headers/private/netservices/UrlRequest.h index 35fc40cd18..d9a1148f06 100644 --- a/headers/private/netservices/UrlRequest.h +++ b/headers/private/netservices/UrlRequest.h @@ -14,36 +14,24 @@ #include -#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 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_ diff --git a/headers/private/netservices/UrlResult.h b/headers/private/netservices/UrlResult.h index 386a1ef7b9..8d8d77171b 100644 --- a/headers/private/netservices/UrlResult.h +++ b/headers/private/netservices/UrlResult.h @@ -9,37 +9,11 @@ #include -#ifdef LIBNETAPI_DEPRECATED -#include - - -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_ diff --git a/headers/private/netservices/UrlSynchronousRequest.h b/headers/private/netservices/UrlSynchronousRequest.h index 267376d753..5e3d38dd5d 100644 --- a/headers/private/netservices/UrlSynchronousRequest.h +++ b/headers/private/netservices/UrlSynchronousRequest.h @@ -10,11 +10,10 @@ #include -#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_ diff --git a/src/kits/network/libnetservices/DataRequest.cpp b/src/kits/network/libnetservices/DataRequest.cpp index 1f012ade7e..0b742e895f 100644 --- a/src/kits/network/libnetservices/DataRequest.cpp +++ b/src/kits/network/libnetservices/DataRequest.cpp @@ -14,23 +14,9 @@ #include #include - -#ifndef LIBNETAPI_DEPRECATED using namespace BPrivate::Network; -#endif -#ifdef LIBNETAPI_DEPRECATED -BDataRequest::BDataRequest(const BUrl& url, BUrlProtocolListener* listener, - BUrlContext* context) - : BUrlRequest(url, listener, context, "data URL parser", "data"), - fResult() -{ - fResult.SetContentType("text/plain"); -} - -#else - BDataRequest::BDataRequest(const BUrl& url, BDataIO* output, BUrlProtocolListener* listener, BUrlContext* context) @@ -40,7 +26,6 @@ BDataRequest::BDataRequest(const BUrl& url, BDataIO* output, { fResult.SetContentType("text/plain"); } -#endif // LIBNETAPI_DEPRECATED const BUrlResult& @@ -136,15 +121,6 @@ BDataRequest::_ProtocolLoop() fResult.SetLength(length); -#ifdef LIBNETAPI_DEPRECATED - if (fListener != NULL) { - fListener->HeadersReceived(this, fResult); - if (length > 0) { - fListener->DataReceived(this, payload, 0, length); - fListener->DownloadProgress(this, length, length); - } - } -#else if (fListener != NULL) fListener->HeadersReceived(this); if (length > 0) { @@ -159,7 +135,6 @@ BDataRequest::_ProtocolLoop() fListener->DownloadProgress(this, written, written); } } -#endif // LIBNETAPI_DEPRECATED return B_OK; } diff --git a/src/kits/network/libnetservices/FileRequest.cpp b/src/kits/network/libnetservices/FileRequest.cpp index da571c8187..13633bf627 100644 --- a/src/kits/network/libnetservices/FileRequest.cpp +++ b/src/kits/network/libnetservices/FileRequest.cpp @@ -16,24 +16,9 @@ #include #include - -#ifndef LIBNETAPI_DEPRECATED using namespace BPrivate::Network; -#endif -#ifdef LIBNETAPI_DEPRECATED -BFileRequest::BFileRequest(const BUrl& url, BUrlProtocolListener* listener, - BUrlContext* context) - : - BUrlRequest(url, listener, context, "BUrlProtocol.File", "file"), - fResult() -{ - fUrl.UrlDecode(true); -} - -#else - BFileRequest::BFileRequest(const BUrl& url, BDataIO* output, BUrlProtocolListener* listener, BUrlContext* context) : @@ -42,7 +27,6 @@ BFileRequest::BFileRequest(const BUrl& url, BDataIO* output, { fUrl.UrlDecode(true); } -#endif // LIBNETAPI_DEPRECATED BFileRequest::~BFileRequest() @@ -60,140 +44,6 @@ BFileRequest::Result() const } -#ifdef LIBNETAPI_DEPRECATED -status_t -BFileRequest::_ProtocolLoop() -{ - BNode node(fUrl.Path().String()); - - if (node.IsSymLink()) { - // Traverse the symlink and start over - BEntry entry(fUrl.Path().String(), true); - node = BNode(&entry); - } - - ssize_t transferredSize = 0; - if (node.IsFile()) { - BFile file(fUrl.Path().String(), B_READ_ONLY); - status_t error = file.InitCheck(); - if (error != B_OK) - return error; - - BNodeInfo info(&file); - char mimeType[B_MIME_TYPE_LENGTH + 1]; - if (info.GetType(mimeType) != B_OK) - update_mime_info(fUrl.Path().String(), false, true, false); - if (info.GetType(mimeType) == B_OK) - fResult.SetContentType(mimeType); - - // Send all notifications to listener, if any - if (fListener != NULL) { - fListener->ConnectionOpened(this); - - off_t size = 0; - error = file.GetSize(&size); - if (error != B_OK) - return error; - fResult.SetLength(size); - - fListener->HeadersReceived(this, fResult); - - ssize_t chunkSize = 0; - char chunk[4096]; - while (!fQuit) { - chunkSize = file.Read(chunk, sizeof(chunk)); - if (chunkSize > 0) { - fListener->DataReceived(this, chunk, transferredSize, - chunkSize); - transferredSize += chunkSize; - fListener->DownloadProgress(this, transferredSize, size); - } else - break; - } - if (fQuit) - return B_INTERRUPTED; - // Return error if we didn't transfer everything - if (transferredSize != size) { - if (chunkSize < 0) - return (status_t)chunkSize; - else - return B_IO_ERROR; - } - } - - return B_OK; - } - - node_ref ref; - status_t error = node.GetNodeRef(&ref); - - // Stop here, and don't hit the assert below, if the file doesn't exist. - if (error != B_OK) - return error; - - assert(node.IsDirectory()); - BDirectory directory(&ref); - - fResult.SetContentType("application/x-ftp-directory; charset=utf-8"); - // This tells WebKit to use its FTP directory rendering code. - - if (fListener != NULL) { - fListener->ConnectionOpened(this); - fListener->HeadersReceived(this, fResult); - - // Add a parent directory entry. - fListener->DataReceived(this, "+/,\t..\r\n", transferredSize, 8); - fListener->DownloadProgress(this, transferredSize, 0); - transferredSize += 8; - } - - char name[B_FILE_NAME_LENGTH]; - BEntry entry; - while (!fQuit && directory.GetNextEntry(&entry) != B_ENTRY_NOT_FOUND) { - // We read directories using the EPLF (Easily Parsed List Format) - // This happens to be one of the formats that WebKit can understand, - // and it is not too hard to parse or generate. - // http://tools.ietf.org/html/draft-bernstein-eplf-02 - BString eplf("+"); - if (entry.IsFile() || entry.IsSymLink()) { - eplf += "r,"; - off_t fileSize; - if (entry.GetSize(&fileSize) == B_OK) - eplf << "s" << fileSize << ","; - - } else if (entry.IsDirectory()) - eplf += "/,"; - - time_t modification; - if (entry.GetModificationTime(&modification) == B_OK) - eplf << "m" << modification << ","; - - mode_t permissions; - if (entry.GetPermissions(&permissions) == B_OK) - eplf << "up" << BString().SetToFormat("%03o", permissions) << ","; - - node_ref ref; - if (entry.GetNodeRef(&ref) == B_OK) - eplf << "i" << ref.device << "." << ref.node << ","; - - entry.GetName(name); - eplf << "\t" << name << "\r\n"; - if (fListener != NULL) { - fListener->DataReceived(this, eplf.String(), transferredSize, - eplf.Length()); - fListener->DownloadProgress(this, transferredSize, 0); - } - transferredSize += eplf.Length(); - } - - if (!fQuit) - fResult.SetLength(transferredSize); - - return fQuit ? B_INTERRUPTED : B_OK; -} - -#else - status_t BFileRequest::_ProtocolLoop() { @@ -343,5 +193,3 @@ BFileRequest::_ProtocolLoop() return fQuit ? B_INTERRUPTED : B_OK; } - -#endif // LIBNETAPI_DEPRECATED diff --git a/src/kits/network/libnetservices/GopherRequest.cpp b/src/kits/network/libnetservices/GopherRequest.cpp index 37f4c94837..a38f21922c 100644 --- a/src/kits/network/libnetservices/GopherRequest.cpp +++ b/src/kits/network/libnetservices/GopherRequest.cpp @@ -23,10 +23,8 @@ #include #include - -#ifndef LIBNETAPI_DEPRECATED using namespace BPrivate::Network; -#endif + /* * TODO: fix '+' in selectors, cf. gopher://gophernicus.org/1/doc/gopher/ @@ -183,33 +181,6 @@ static const int32 kGopherBufferSize = 4096; static const bool kInlineImages = true; -#ifdef LIBNETAPI_DEPRECATED -BGopherRequest::BGopherRequest(const BUrl& url, BUrlProtocolListener* listener, - BUrlContext* context) - : - BNetworkRequest(url, listener, context, "BUrlProtocol.Gopher", "gopher"), - fItemType(GOPHER_TYPE_NONE), - fPosition(0), - fResult() -{ - fSocket = new(std::nothrow) BSocket(); - - fUrl.UrlDecode(); - // the first part of the path is actually the document type - - fPath = Url().Path(); - if (!Url().HasPath() || fPath.Length() == 0 || fPath == "/") { - // default entry - fItemType = GOPHER_TYPE_DIRECTORY; - fPath = ""; - } else if (fPath.Length() > 1 && fPath[0] == '/') { - fItemType = fPath[1]; - fPath.Remove(0, 2); - } -} - -#else - BGopherRequest::BGopherRequest(const BUrl& url, BDataIO* output, BUrlProtocolListener* listener, BUrlContext* context) : @@ -234,7 +205,6 @@ BGopherRequest::BGopherRequest(const BUrl& url, BDataIO* output, fPath.Remove(0, 2); } } -#endif // LIBNETAPI_DEPRECATED BGopherRequest::~BGopherRequest() @@ -263,165 +233,6 @@ BGopherRequest::Result() const } -#ifdef LIBNETAPI_DEPRECATED -status_t -BGopherRequest::_ProtocolLoop() -{ - if (fSocket == NULL) - return B_NO_MEMORY; - - if (!_ResolveHostName(fUrl.Host(), fUrl.HasPort() ? fUrl.Port() : 70)) { - _EmitDebug(B_URL_PROTOCOL_DEBUG_ERROR, - "Unable to resolve hostname (%s), aborting.", - fUrl.Host().String()); - return B_SERVER_NOT_FOUND; - } - - _EmitDebug(B_URL_PROTOCOL_DEBUG_TEXT, "Connection to %s on port %d.", - fUrl.Authority().String(), fRemoteAddr.Port()); - status_t connectError = fSocket->Connect(fRemoteAddr); - - if (connectError != B_OK) { - _EmitDebug(B_URL_PROTOCOL_DEBUG_ERROR, "Socket connection error %s", - strerror(connectError)); - return connectError; - } - - //! ProtocolHook:ConnectionOpened - if (fListener != NULL) - fListener->ConnectionOpened(this); - - _EmitDebug(B_URL_PROTOCOL_DEBUG_TEXT, - "Connection opened, sending request."); - - _SendRequest(); - _EmitDebug(B_URL_PROTOCOL_DEBUG_TEXT, "Request sent."); - - // Receive loop - bool receiveEnd = false; - status_t readError = B_OK; - ssize_t bytesRead = 0; - //ssize_t bytesReceived = 0; - //ssize_t bytesTotal = 0; - bool dataValidated = false; - BStackOrHeapArray chunk(kGopherBufferSize); - - while (!fQuit && !receiveEnd) { - bytesRead = fSocket->Read(chunk, kGopherBufferSize); - - if (bytesRead < 0) { - readError = bytesRead; - break; - } else if (bytesRead == 0) - receiveEnd = true; - - fInputBuffer.AppendData(chunk, bytesRead); - - if (!dataValidated) { - size_t i; - // on error (file doesn't exist, ...) the server sends - // a faked directory entry with an error message - if (fInputBuffer.Size() && fInputBuffer.Data()[0] == '3') { - int tabs = 0; - bool crlf = false; - - // make sure the buffer only contains printable characters - // and has at least 3 tabs before a CRLF - for (i = 0; i < fInputBuffer.Size(); i++) { - char c = fInputBuffer.Data()[i]; - if (c == '\t') { - if (!crlf) - tabs++; - } else if (c == '\r' || c == '\n') { - if (tabs < 3) - break; - crlf = true; - } else if (!isprint(fInputBuffer.Data()[i])) { - crlf = false; - break; - } - } - if (crlf && tabs > 2 && tabs < 5) { - // TODO: - //if enough data - // else continue - fItemType = GOPHER_TYPE_DIRECTORY; - readError = B_RESOURCE_NOT_FOUND; - // continue parsing the error text anyway - } - } - // special case for buggy(?) Gophernicus/1.5 - static const char *buggy = "Error: File or directory not found!"; - if (fInputBuffer.Size() > strlen(buggy) - && !memcmp(fInputBuffer.Data(), buggy, strlen(buggy))) { - fItemType = GOPHER_TYPE_DIRECTORY; - readError = B_RESOURCE_NOT_FOUND; - // continue parsing the error text anyway - // but it won't look good - } - - // now we probably have correct data - dataValidated = true; - - //! ProtocolHook:ResponseStarted - if (fListener != NULL) - fListener->ResponseStarted(this); - - // now we can assign MIME type if we know it - const char *mime = "application/octet-stream"; - for (i = 0; gopher_type_map[i].type != GOPHER_TYPE_NONE; i++) { - if (gopher_type_map[i].type == fItemType) { - mime = gopher_type_map[i].mime; - break; - } - } - fResult.SetContentType(mime); - - // we don't really have headers but well... - //! ProtocolHook:HeadersReceived - if (fListener != NULL) - fListener->HeadersReceived(this, fResult); - } - - if (_NeedsParsing()) - _ParseInput(receiveEnd); - else if (fInputBuffer.Size()) { - // send input directly - if (fListener != NULL) { - fListener->DataReceived(this, (const char *)fInputBuffer.Data(), - fPosition, fInputBuffer.Size()); - } - - fPosition += fInputBuffer.Size(); - - if (fListener != NULL) - fListener->DownloadProgress(this, fPosition, 0); - - // XXX: this is plain stupid, we already copied the data - // and just want to drop it... - char *inputTempBuffer = new(std::nothrow) char[bytesRead]; - if (inputTempBuffer == NULL) { - readError = B_NO_MEMORY; - break; - } - fInputBuffer.RemoveData(inputTempBuffer, fInputBuffer.Size()); - delete[] inputTempBuffer; - } - } - - if (fPosition > 0) - fResult.SetLength(fPosition); - - fSocket->Disconnect(); - - if (readError != B_OK) - return readError; - - return fQuit ? B_INTERRUPTED : B_OK; -} - -# else - status_t BGopherRequest::_ProtocolLoop() { @@ -583,7 +394,6 @@ BGopherRequest::_ProtocolLoop() return fQuit ? B_INTERRUPTED : B_OK; } -#endif // LIBNETAPI_DEPRECATED void @@ -623,296 +433,6 @@ BGopherRequest::_NeedsLastDotStrip() } -#ifdef LIBNETAPI_DEPRECATED -void -BGopherRequest::_ParseInput(bool last) -{ - BString line; - - while (_GetLine(line) == B_OK) { - char type = GOPHER_TYPE_NONE; - BStringList fields; - - line.MoveInto(&type, 0, 1); - - line.Split("\t", false, fields); - - if (type != GOPHER_TYPE_ENDOFPAGE - && fields.CountStrings() < FIELD_GPFLAG) - _EmitDebug(B_URL_PROTOCOL_DEBUG_TEXT, - "Unterminated gopher item (type '%c')", type); - - BString pageTitle; - BString item; - BString title = fields.StringAt(FIELD_NAME); - BString link("gopher://"); - BString user; - if (fields.CountStrings() > 3) { - link << fields.StringAt(FIELD_HOST); - if (fields.StringAt(FIELD_PORT).Length()) - link << ":" << fields.StringAt(FIELD_PORT); - link << "/" << type; - //if (fields.StringAt(FIELD_SELECTOR).ByteAt(0) != '/') - // link << "/"; - link << fields.StringAt(FIELD_SELECTOR); - } - _HTMLEscapeString(title); - _HTMLEscapeString(link); - - switch (type) { - case GOPHER_TYPE_ENDOFPAGE: - /* end of the page */ - break; - case GOPHER_TYPE_TEXTPLAIN: - item << "" - "" << title << "" - "
\n"; - break; - case GOPHER_TYPE_BINARY: - case GOPHER_TYPE_BINHEX: - case GOPHER_TYPE_BINARCHIVE: - case GOPHER_TYPE_UUENCODED: - item << "" - "" << title << "" - "
\n"; - break; - case GOPHER_TYPE_DIRECTORY: - /* - * directory link - */ - item << "" - "" << title << "" - "
\n"; - break; - case GOPHER_TYPE_ERROR: - item << "" << title << "" - "
\n"; - if (fPosition == 0 && pageTitle.Length() == 0) - pageTitle << "Error: " << title; - break; - case GOPHER_TYPE_QUERY: - /* TODO: handle search better. - * For now we use an unnamed input field and accept sending ?=foo - * as it seems at least Veronica-2 ignores the = but it's unclean. - */ - item << "
" - "" - "" - "
" - "
\n"; - break; - case GOPHER_TYPE_TELNET: - /* telnet: links - * cf. gopher://78.80.30.202/1/ps3 - * -> gopher://78.80.30.202:23/8/ps3/new -> new@78.80.30.202 - */ - link = "telnet://"; - user = fields.StringAt(FIELD_SELECTOR); - if (user.FindLast('/') > -1) { - user.Remove(0, user.FindLast('/')); - link << user << "@"; - } - link << fields.StringAt(FIELD_HOST); - if (fields.StringAt(FIELD_PORT) != "23") - link << ":" << fields.StringAt(FIELD_PORT); - - item << "" - "" << title << "" - "
\n"; - break; - case GOPHER_TYPE_TN3270: - /* tn3270: URI scheme, cf. http://tools.ietf.org/html/rfc6270 */ - link = "tn3270://"; - user = fields.StringAt(FIELD_SELECTOR); - if (user.FindLast('/') > -1) { - user.Remove(0, user.FindLast('/')); - link << user << "@"; - } - link << fields.StringAt(FIELD_HOST); - if (fields.StringAt(FIELD_PORT) != "23") - link << ":" << fields.StringAt(FIELD_PORT); - - item << "" - "" << title << "" - "
\n"; - break; - case GOPHER_TYPE_CSO_SEARCH: - /* CSO search. - * At least Lynx supports a cso:// URI scheme: - * http://lynx.isc.org/lynx2.8.5/lynx2-8-5/lynx_help/lynx_url_support.html - */ - link = "cso://"; - user = fields.StringAt(FIELD_SELECTOR); - if (user.FindLast('/') > -1) { - user.Remove(0, user.FindLast('/')); - link << user << "@"; - } - link << fields.StringAt(FIELD_HOST); - if (fields.StringAt(FIELD_PORT) != "105") - link << ":" << fields.StringAt(FIELD_PORT); - - item << "" - "" << title << "" - "
\n"; - break; - case GOPHER_TYPE_GIF: - case GOPHER_TYPE_IMAGE: - case GOPHER_TYPE_PNG: - case GOPHER_TYPE_BITMAP: - /* quite dangerous, cf. gopher://namcub.accela-labs.com/1/pics */ - if (kInlineImages) { - item << "" - "" << title << " " - "" - "" - "
\n"; - break; - } - /* fallback to default, link them */ - item << "" - "" << title << "" - "
\n"; - break; - case GOPHER_TYPE_HTML: - /* cf. gopher://pineapple.vg/1 */ - if (fields.StringAt(FIELD_SELECTOR).StartsWith("URL:")) { - link = fields.StringAt(FIELD_SELECTOR); - link.Remove(0, 4); - } - /* cf. gopher://sdf.org/1/sdf/classes/ */ - - item << "" - "" << title << "" - "
\n"; - break; - case GOPHER_TYPE_INFO: - // TITLE resource, cf. - // gopher://gophernicus.org/0/doc/gopher/gopher-title-resource.txt - if (fPosition == 0 && pageTitle.Length() == 0 - && fields.StringAt(FIELD_SELECTOR) == "TITLE") { - pageTitle = title; - break; - } - item << "" << title << "" - "
\n"; - break; - case GOPHER_TYPE_AUDIO: - case GOPHER_TYPE_SOUND: - item << "" - "" << title << "" - "" - "
\n"; - break; - case GOPHER_TYPE_PDF: - case GOPHER_TYPE_DOC: - /* generic case for known-to-work items */ - item << "" - "" << title << "" - "
\n"; - break; - case GOPHER_TYPE_MOVIE: - item << "" - "" << title << "" - "