Move UrlResult to HttpResult

* Remove the fRawData field, as handling it is too complicated (it's
not easy to have proper copy semantics on a BDataIO) and it's not used
anyway, as the listener DataReceived call is enough to get the data and
handle it.
 * All the remaining fields are HTTP-only, so rename the class to
HttpResult and attach it to HttpRequest instead of UrlRequest.
This commit is contained in:
Adrien Destugues
2013-10-24 17:41:02 +02:00
parent 076952bc29
commit f6782201f0
11 changed files with 222 additions and 262 deletions
+10 -2
View File
@@ -12,6 +12,7 @@
#include <HttpAuthentication.h>
#include <HttpForm.h>
#include <HttpHeaders.h>
#include <HttpResult.h>
#include <NetBuffer.h>
#include <NetworkAddress.h>
#include <UrlRequest.h>
@@ -48,6 +49,9 @@ public:
const ssize_t size = -1);
void AdoptHeaders(BHttpHeaders* const headers);
const BHttpResult& Result() const;
const char* StatusString(status_t threadStatus) const;
static bool IsInformationalStatusCode(int16 code);
static bool IsSuccessStatusCode(int16 code);
static bool IsRedirectionStatusCode(int16 code);
@@ -55,8 +59,6 @@ public:
static bool IsServerErrorStatusCode(int16 code);
static int16 StatusCodeClass(int16 code);
virtual const char* StatusString(status_t threadStatus) const;
private:
void _ResetOptions();
status_t _ProtocolLoop();
@@ -73,6 +75,11 @@ private:
void _AddOutputBufferLine(const char* line);
// URL result parameters access
BPositionIO* _ResultRawData();
BHttpHeaders& _ResultHeaders();
void _SetResultStatusCode(int32 statusCode);
BString& _ResultStatusText();
private:
BAbstractSocket* fSocket;
@@ -91,6 +98,7 @@ private:
// Request status
BHttpHeaders fOutputHeaders;
BHttpResult fResult;
// Request state/events
enum {