71e29bbeea
This commit formats all the netservices2 code with the `haiku-format` tool from https://github.com/owenca/haiku-format (commit aa7408e), with the following customizations: * SpaceBeforeRangeBasedForLoopColon is set to false * Braces before a catch block are not wrapped * Most headers, except for ExclusiveBorrow.h, have been manually reformatted to adhere to Haiku's header format (issue #19 in the repository) Change-Id: I693c4515cf26402e48f35d1213ab6d5fcf14bd1e
73 lines
1.5 KiB
C++
73 lines
1.5 KiB
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 <ExclusiveBorrow.h>
|
|
#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, BBorrow<BDataIO> target = nullptr,
|
|
BMessenger observer = BMessenger());
|
|
void Cancel(int32 identifier);
|
|
void Cancel(const BHttpResult& request);
|
|
|
|
// Concurrency limits
|
|
void SetMaxConnectionsPerHost(size_t maxConnections);
|
|
void SetMaxHosts(size_t maxConnections);
|
|
|
|
private:
|
|
struct Redirect;
|
|
class Request;
|
|
class Impl;
|
|
std::shared_ptr<Impl> fImpl;
|
|
};
|
|
|
|
|
|
namespace UrlEvent {
|
|
enum { HttpStatus = '_HST', HttpFields = '_HHF', CertificateError = '_CER', HttpRedirect = '_HRE' };
|
|
}
|
|
|
|
|
|
namespace UrlEventData {
|
|
extern const char* HttpStatusCode;
|
|
extern const char* SSLCertificate;
|
|
extern const char* SSLMessage;
|
|
extern const char* HttpRedirectUrl;
|
|
} // namespace UrlEventData
|
|
|
|
} // namespace Network
|
|
|
|
} // namespace BPrivate
|
|
|
|
#endif // _B_HTTP_SESSION_H_
|