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 BHttpResult(BMessage*); 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 size_t Length() const; 42 43 // HTTP-Specific stuff 44 const BHttpHeaders& Headers() const; 45 const BString& StatusText() const; 46 int32 StatusCode() const; 47 48 // Result tests 49 bool HasHeaders() const; 50 51 // Overloaded members 52 BHttpResult& operator=(const BHttpResult& other); 53 54 virtual status_t Archive(BMessage*, bool) const; 55 static BArchivable* Instantiate(BMessage*); 56 private: 57 BUrl fUrl; 58 59 BHttpHeaders fHeaders; 60 int32 fStatusCode; 61 BString fStatusString; 62 }; 63 64 #ifndef LIBNETAPI_DEPRECATED 65 } // namespace Network 66 67 } // namespace BPrivate 68 #endif 69 70 #endif // _B_URL_RESULT_H_ 71