1 /* 2 * Copyright 2010-2017 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _B_HTTP_RESULT_H_ 6 #define _B_HTTP_RESULT_H_ 7 8 9 #include <HttpHeaders.h> 10 #include <String.h> 11 #include <Url.h> 12 #include <UrlResult.h> 13 14 15 #ifndef LIBNETAPI_DEPRECATED 16 namespace BPrivate { 17 18 namespace Network { 19 #endif 20 21 class BUrlRequest; 22 23 24 class BHttpResult: public BUrlResult { 25 friend class BHttpRequest; 26 27 public: 28 BHttpResult(const BUrl& url); 29 #ifdef LIBNETAPI_DEPRECATED 30 BHttpResult(BMessage*); 31 #endif 32 BHttpResult(const BHttpResult& other); 33 ~BHttpResult(); 34 35 // Result parameters modifications 36 void SetUrl(const BUrl& url); 37 38 // Result parameters access 39 const BUrl& Url() const; 40 BString ContentType() const; 41 #ifdef LIBNETAPI_DEPRECATED 42 size_t Length() const; 43 #else 44 off_t Length() const; 45 #endif 46 47 // HTTP-Specific stuff 48 const BHttpHeaders& Headers() const; 49 const BString& StatusText() const; 50 int32 StatusCode() const; 51 52 // Result tests 53 bool HasHeaders() const; 54 55 // Overloaded members 56 BHttpResult& operator=(const BHttpResult& other); 57 58 #ifdef LIBNETAPI_DEPRECATED 59 virtual status_t Archive(BMessage*, bool) const; 60 static BArchivable* Instantiate(BMessage*); 61 #endif 62 private: 63 BUrl fUrl; 64 65 BHttpHeaders fHeaders; 66 int32 fStatusCode; 67 BString fStatusString; 68 }; 69 70 #ifndef LIBNETAPI_DEPRECATED 71 } // namespace Network 72 73 } // namespace BPrivate 74 #endif 75 76 #endif // _B_URL_RESULT_H_ 77