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