haiku/headers/os/net/UrlResult.h
Adrien Destugues afd547b368 Refactor UrlRequest/UrlProtocol in the Service Kit
* Remove the BUrlRequest class, which was only delegating work to
BUrlProtocol and subclasses
 * Rename BUrlProtocol to BUrlRequest, and BUrlRequestHttp to BHttpRequest
 * Creating a request is now done through the BUrlProtocolRoster. For
now there is just a static MakeRequest method, this will be completed
when we get to actually allowing add-ons to provide different request
handlers.

This allows cleanup of the API for requests:
 * Remove the universal SetOption method with constants, and have
dedicated setters for each protocol option.
 * Setters can now have multiple parameters, for example you can give
BHTTPRequest a BDataIO and a known size
 * In this case, the BHttpRequest will not use HTTP chunked transfers,
which were always used before and made most servers unhappy (tested and
failed with lighttpd, google accounts and github).
2013-10-08 11:42:05 +02:00

57 lines
1.1 KiB
C++

/*
* Copyright 2010 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _B_URL_RESULT_H_
#define _B_URL_RESULT_H_
#include <iostream>
#include <DataIO.h>
#include <HttpHeaders.h>
#include <String.h>
#include <Url.h>
class BUrlRequest;
class BUrlResult {
friend class BUrlRequest;
public:
BUrlResult(const BUrl& url);
BUrlResult(const BUrlResult& other);
// Result parameters modifications
void SetUrl(const BUrl& url);
// Result parameters access
const BUrl& Url() const;
const BMallocIO& RawData() const;
const BHttpHeaders& Headers() const;
const BString& StatusText() const;
int32 StatusCode() const;
// Result tests
bool HasHeaders() const;
// Overloaded members
BUrlResult& operator=(const BUrlResult& other);
friend std::ostream& operator<<(std::ostream& out,
const BUrlResult& result);
private:
BUrl fUrl;
BMallocIO fRawData;
BHttpHeaders fHeaders;
// TODO: HTTP specific stuff should not live here.
int32 fStatusCode;
BString fStatusString;
};
#endif // _B_URL_RESULT_H_