2013-10-24 19:26:17 +04:00
|
|
|
/*
|
2017-01-29 21:25:02 +03:00
|
|
|
* Copyright 2010-2017 Haiku Inc. All rights reserved.
|
2013-10-24 19:26:17 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2013-12-09 23:26:13 +04:00
|
|
|
#ifndef _B_HTTP_RESULT_H_
|
|
|
|
#define _B_HTTP_RESULT_H_
|
2013-10-24 19:26:17 +04:00
|
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include <HttpHeaders.h>
|
|
|
|
#include <String.h>
|
|
|
|
#include <Url.h>
|
2013-12-09 23:26:13 +04:00
|
|
|
#include <UrlResult.h>
|
2013-10-24 19:26:17 +04:00
|
|
|
|
|
|
|
|
|
|
|
class BUrlRequest;
|
|
|
|
|
|
|
|
|
2013-12-09 23:26:13 +04:00
|
|
|
class BHttpResult: public BUrlResult {
|
2013-10-24 19:26:17 +04:00
|
|
|
friend class BHttpRequest;
|
|
|
|
|
|
|
|
public:
|
|
|
|
BHttpResult(const BUrl& url);
|
2017-01-29 21:25:02 +03:00
|
|
|
BHttpResult(BMessage*);
|
2013-10-24 19:26:17 +04:00
|
|
|
BHttpResult(const BHttpResult& other);
|
|
|
|
~BHttpResult();
|
2017-01-29 21:25:02 +03:00
|
|
|
|
2013-10-24 19:26:17 +04:00
|
|
|
// Result parameters modifications
|
|
|
|
void SetUrl(const BUrl& url);
|
2017-01-29 21:25:02 +03:00
|
|
|
|
2013-10-24 19:26:17 +04:00
|
|
|
// Result parameters access
|
|
|
|
const BUrl& Url() const;
|
2013-12-09 23:26:13 +04:00
|
|
|
BString ContentType() const;
|
|
|
|
size_t Length() const;
|
2013-10-24 19:26:17 +04:00
|
|
|
|
|
|
|
// HTTP-Specific stuff
|
|
|
|
const BHttpHeaders& Headers() const;
|
|
|
|
const BString& StatusText() const;
|
|
|
|
int32 StatusCode() const;
|
2017-01-29 21:25:02 +03:00
|
|
|
|
2013-10-24 19:26:17 +04:00
|
|
|
// Result tests
|
|
|
|
bool HasHeaders() const;
|
2017-01-29 21:25:02 +03:00
|
|
|
|
2013-10-24 19:26:17 +04:00
|
|
|
// Overloaded members
|
2017-01-29 21:25:02 +03:00
|
|
|
BHttpResult& operator=(const BHttpResult& other);
|
|
|
|
|
|
|
|
virtual status_t Archive(BMessage*, bool) const;
|
|
|
|
static BArchivable* Instantiate(BMessage*);
|
2013-10-24 19:26:17 +04:00
|
|
|
private:
|
|
|
|
BUrl fUrl;
|
|
|
|
|
|
|
|
BHttpHeaders fHeaders;
|
|
|
|
int32 fStatusCode;
|
|
|
|
BString fStatusString;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _B_URL_RESULT_H_
|