Niels Sascha Reedijk 13bfff7be3 NetServices: Implement BHttpStatusCode, BHttpStatusClass and Redirects
The user of the API can set whether redirects should be followed, and if so,
how many. This is part of the BHttpRequest API. The BHttpSession then follows
those instructions, and executes the maximum number of redirects the user
would like to follow.

As part of this commit, the BHttpStatusClass and BHttpStatusCodes helper enums
have been added, to give a friendlier access to HTTP status codes and status
classes.

Change-Id: Ic8c9e3fda158e2cce549c8f1d360951f7ac83311
2022-04-23 18:30:38 +01:00

54 lines
1000 B
C++

/*
* Copyright 2022 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _B_HTTP_SESSION_H_
#define _B_HTTP_SESSION_H_
#include <memory>
#include <Messenger.h>
class BUrl;
namespace BPrivate {
namespace Network {
class BHttpRequest;
class BHttpResult;
class BHttpSession {
public:
// Constructors & Destructor
BHttpSession();
BHttpSession(const BHttpSession&) noexcept;
BHttpSession(BHttpSession&&) noexcept = delete;
~BHttpSession() noexcept;
// Assignment operators
BHttpSession& operator=(const BHttpSession&) noexcept;
BHttpSession& operator=(BHttpSession&&) noexcept = delete;
// Requests
BHttpResult Execute(BHttpRequest&& request,
std::unique_ptr<BDataIO> target = nullptr,
BMessenger observer = BMessenger());
private:
struct Redirect;
class Request;
class Impl;
std::shared_ptr<Impl> fImpl;
};
} // namespace Network
} // namespace BPrivate
#endif // _B_HTTP_SESSION_H_