1ec865cb8SNiels Sascha Reedijk/* 2ec865cb8SNiels Sascha Reedijk * Copyright 2022 Haiku, Inc. All rights reserved. 3ec865cb8SNiels Sascha Reedijk * Distributed under the terms of the MIT License. 4ec865cb8SNiels Sascha Reedijk * 5ec865cb8SNiels Sascha Reedijk * Authors: 6ec865cb8SNiels Sascha Reedijk * Niels Sascha Reedijk, niels.reedijk@gmail.com 7ec865cb8SNiels Sascha Reedijk * 8ec865cb8SNiels Sascha Reedijk * Corresponds to: 9ec865cb8SNiels Sascha Reedijk * headers/private/netservices2/HttpRequest.h hrev????? 10ec865cb8SNiels Sascha Reedijk * src/kits/network/libnetservices2/HttpRequest.cpp hrev????? 11ec865cb8SNiels Sascha Reedijk */ 12ec865cb8SNiels Sascha Reedijk 13ec865cb8SNiels Sascha Reedijk 14ec865cb8SNiels Sascha Reedijk#if __cplusplus >= 201703L 15ec865cb8SNiels Sascha Reedijk 16ec865cb8SNiels Sascha Reedijk 17ec865cb8SNiels Sascha Reedijk/*! 18ec865cb8SNiels Sascha Reedijk \file HttpRequest.h 19ec865cb8SNiels Sascha Reedijk \ingroup netservices 20ec865cb8SNiels Sascha Reedijk \brief Provides the classes and tools to build HTTP Requests. 21ec865cb8SNiels Sascha Reedijk 22ec865cb8SNiels Sascha Reedijk \since Haiku R1 23ec865cb8SNiels Sascha Reedijk*/ 24ec865cb8SNiels Sascha Reedijk 25ec865cb8SNiels Sascha Reedijk 26ec865cb8SNiels Sascha Reedijknamespace BPrivate { 27ec865cb8SNiels Sascha Reedijk 28ec865cb8SNiels Sascha Reedijknamespace Network { 29ec865cb8SNiels Sascha Reedijk 30ec865cb8SNiels Sascha Reedijk 31ec865cb8SNiels Sascha Reedijk/*! 32ec865cb8SNiels Sascha Reedijk \class BHttpMethod 33ec865cb8SNiels Sascha Reedijk \ingroup netservices 34ec865cb8SNiels Sascha Reedijk \brief Represent a HTTP method. 35ec865cb8SNiels Sascha Reedijk 36ec865cb8SNiels Sascha Reedijk The <a href="https://datatracker.ietf.org/doc/html/rfc7231#section-4.1">HTTP standard</a> 37ec865cb8SNiels Sascha Reedijk specifies that HTTP requests have a method. Common methods are \c GET and \c HEAD methods. 38ec865cb8SNiels Sascha Reedijk Standardized and common methods are in the form of \em verbs and are in capitalized letters 39ec865cb8SNiels Sascha Reedijk from the ASCII token set, though any valid token can be used. 40ec865cb8SNiels Sascha Reedijk 41ec865cb8SNiels Sascha Reedijk It is most likely that you will not use the methods of this class directly, instead you will 42ec865cb8SNiels Sascha Reedijk use the implicit constructors while interacting with the \ref BHttpRequest class. 43ec865cb8SNiels Sascha Reedijk 44ec865cb8SNiels Sascha Reedijk \code 45ec865cb8SNiels Sascha Reedijk auto url = BUrl2("https://www.haiku-os.org/"); 46ec865cb8SNiels Sascha Reedijk // implicitly construct a standard get request 47ec865cb8SNiels Sascha Reedijk auto standard = BHttpRequest(url, BHttpMethod::Get); 48ec865cb8SNiels Sascha Reedijk // implicitly construct a nonstandard patch request 49ec865cb8SNiels Sascha Reedijk auto custom = BHttpRequest(url, "PATCH"sv); 50ec865cb8SNiels Sascha Reedijk \endcode 51ec865cb8SNiels Sascha Reedijk 52ec865cb8SNiels Sascha Reedijk \note When you are using the standard list of verbs, there will never be an exception when 53ec865cb8SNiels Sascha Reedijk creating objects of this type. When you create a custom method, exceptions may be raised 54ec865cb8SNiels Sascha Reedijk when the system runs out of memory, or when your custom method contains invalid characters. 55ec865cb8SNiels Sascha Reedijk In almost all cases, you can probably safely assume you will not run into these exceptions, 56ec865cb8SNiels Sascha Reedijk except for cases where you use user input to create methods or you are very defensive 57ec865cb8SNiels Sascha Reedijk about memory management. 58ec865cb8SNiels Sascha Reedijk 59ec865cb8SNiels Sascha Reedijk \since Haiku R1 60ec865cb8SNiels Sascha Reedijk*/ 61ec865cb8SNiels Sascha Reedijk 62ec865cb8SNiels Sascha Reedijk 63ec865cb8SNiels Sascha Reedijk/*! 64ec865cb8SNiels Sascha Reedijk \class BHttpMethod::InvalidMethod 65ec865cb8SNiels Sascha Reedijk \ingroup netservices 66ec865cb8SNiels Sascha Reedijk \brief Error that represents when a custom method does not conform to the HTTP standard. 67ec865cb8SNiels Sascha Reedijk 68ec865cb8SNiels Sascha Reedijk \since Haiku R1 69ec865cb8SNiels Sascha Reedijk*/ 70ec865cb8SNiels Sascha Reedijk 71ec865cb8SNiels Sascha Reedijk 72ec865cb8SNiels Sascha Reedijk/*! 73ec865cb8SNiels Sascha Reedijk \var BString BHttpMethod::InvalidMethod::input 74ec865cb8SNiels Sascha Reedijk \brief The input that contains the invalid contents. 75ec865cb8SNiels Sascha Reedijk 76ec865cb8SNiels Sascha Reedijk \since Haiku R1 77ec865cb8SNiels Sascha Reedijk*/ 78ec865cb8SNiels Sascha Reedijk 79ec865cb8SNiels Sascha Reedijk 80ec865cb8SNiels Sascha Reedijk/*! 81ec865cb8SNiels Sascha Reedijk \fn BHttpMethod::InvalidMethod::InvalidMethod(const char *origin, BString input) 82ec865cb8SNiels Sascha Reedijk \brief Constructor that sets the \a origin and the invalid \a input. 83ec865cb8SNiels Sascha Reedijk 84ec865cb8SNiels Sascha Reedijk \since Haiku R1 85ec865cb8SNiels Sascha Reedijk*/ 86ec865cb8SNiels Sascha Reedijk 87ec865cb8SNiels Sascha Reedijk 88ec865cb8SNiels Sascha Reedijk/*! 89ec865cb8SNiels Sascha Reedijk \enum BHttpMethod::Verb 90ec865cb8SNiels Sascha Reedijk \ingroup netservices 91ec865cb8SNiels Sascha Reedijk \brief A list of standard HTTP methods. 92ec865cb8SNiels Sascha Reedijk 93ec865cb8SNiels Sascha Reedijk \since Haiku R1 94ec865cb8SNiels Sascha Reedijk*/ 95ec865cb8SNiels Sascha Reedijk 96ec865cb8SNiels Sascha Reedijk 97ec865cb8SNiels Sascha Reedijk/*! 98ec865cb8SNiels Sascha Reedijk \var BHttpMethod::Verb BHttpMethod::Get 99ec865cb8SNiels Sascha Reedijk \brief Represents the \c GET method. 100ec865cb8SNiels Sascha Reedijk 101ec865cb8SNiels Sascha Reedijk \since Haiku R1 102ec865cb8SNiels Sascha Reedijk*/ 103ec865cb8SNiels Sascha Reedijk 104ec865cb8SNiels Sascha Reedijk 105ec865cb8SNiels Sascha Reedijk/*! 106ec865cb8SNiels Sascha Reedijk \var BHttpMethod::Verb BHttpMethod::Head 107ec865cb8SNiels Sascha Reedijk \brief Represents the \c HEAD method. 108ec865cb8SNiels Sascha Reedijk 109ec865cb8SNiels Sascha Reedijk \since Haiku R1 110ec865cb8SNiels Sascha Reedijk*/ 111ec865cb8SNiels Sascha Reedijk 112ec865cb8SNiels Sascha Reedijk 113ec865cb8SNiels Sascha Reedijk/*! 114ec865cb8SNiels Sascha Reedijk \var BHttpMethod::Verb BHttpMethod::Post 115ec865cb8SNiels Sascha Reedijk \brief Represents the \c POST method. 116ec865cb8SNiels Sascha Reedijk 117ec865cb8SNiels Sascha Reedijk \since Haiku R1 118ec865cb8SNiels Sascha Reedijk*/ 119ec865cb8SNiels Sascha Reedijk 120ec865cb8SNiels Sascha Reedijk 121ec865cb8SNiels Sascha Reedijk/*! 122ec865cb8SNiels Sascha Reedijk \var BHttpMethod::Verb BHttpMethod::Put 123ec865cb8SNiels Sascha Reedijk \brief Represents the \c PUT method. 124ec865cb8SNiels Sascha Reedijk 125ec865cb8SNiels Sascha Reedijk \since Haiku R1 126ec865cb8SNiels Sascha Reedijk*/ 127ec865cb8SNiels Sascha Reedijk 128ec865cb8SNiels Sascha Reedijk 129ec865cb8SNiels Sascha Reedijk/*! 130ec865cb8SNiels Sascha Reedijk \var BHttpMethod::Verb BHttpMethod::Delete 131ec865cb8SNiels Sascha Reedijk \brief Represents the \c DELETE method. 132ec865cb8SNiels Sascha Reedijk 133ec865cb8SNiels Sascha Reedijk \since Haiku R1 134ec865cb8SNiels Sascha Reedijk*/ 135ec865cb8SNiels Sascha Reedijk 136ec865cb8SNiels Sascha Reedijk 137ec865cb8SNiels Sascha Reedijk/*! 138ec865cb8SNiels Sascha Reedijk \var BHttpMethod::Verb BHttpMethod::Connect 139ec865cb8SNiels Sascha Reedijk \brief Represents the \c CONNECT method. 140ec865cb8SNiels Sascha Reedijk 141ec865cb8SNiels Sascha Reedijk \since Haiku R1 142ec865cb8SNiels Sascha Reedijk*/ 143ec865cb8SNiels Sascha Reedijk 144ec865cb8SNiels Sascha Reedijk 145ec865cb8SNiels Sascha Reedijk/*! 146ec865cb8SNiels Sascha Reedijk \var BHttpMethod::Verb BHttpMethod::Options 147ec865cb8SNiels Sascha Reedijk \brief Represents the \c OPTIONS method. 148ec865cb8SNiels Sascha Reedijk 149ec865cb8SNiels Sascha Reedijk \since Haiku R1 150ec865cb8SNiels Sascha Reedijk*/ 151ec865cb8SNiels Sascha Reedijk 152ec865cb8SNiels Sascha Reedijk 153ec865cb8SNiels Sascha Reedijk/*! 154ec865cb8SNiels Sascha Reedijk \var BHttpMethod::Verb BHttpMethod::Trace 155ec865cb8SNiels Sascha Reedijk \brief Represents the \c TRACE method. 156ec865cb8SNiels Sascha Reedijk 157ec865cb8SNiels Sascha Reedijk \since Haiku R1 158ec865cb8SNiels Sascha Reedijk*/ 159ec865cb8SNiels Sascha Reedijk 160ec865cb8SNiels Sascha Reedijk 161ec865cb8SNiels Sascha Reedijk/*! 162ec865cb8SNiels Sascha Reedijk \fn BHttpMethod::BHttpMethod(BHttpMethod &&other) noexcept 163ec865cb8SNiels Sascha Reedijk \brief Move constructor. 164ec865cb8SNiels Sascha Reedijk 165ec865cb8SNiels Sascha Reedijk Moves the data from the \a other to this object. The \a other object will be set to 166ec865cb8SNiels Sascha Reedijk \ref BHttpMethod::Get. 167ec865cb8SNiels Sascha Reedijk 168ec865cb8SNiels Sascha Reedijk \since Haiku R1 169ec865cb8SNiels Sascha Reedijk*/ 170ec865cb8SNiels Sascha Reedijk 171ec865cb8SNiels Sascha Reedijk 172ec865cb8SNiels Sascha Reedijk/*! 173ec865cb8SNiels Sascha Reedijk \fn BHttpMethod::BHttpMethod(const BHttpMethod &other) 174ec865cb8SNiels Sascha Reedijk \brief Copy constructor. 175ec865cb8SNiels Sascha Reedijk 176ec865cb8SNiels Sascha Reedijk Copy data from an \a other object. 177ec865cb8SNiels Sascha Reedijk 178ec865cb8SNiels Sascha Reedijk \exception std::bad_alloc When the \a other object contains a custom verb, this exception 179ec865cb8SNiels Sascha Reedijk will be raised if it is impossible to allocate memory. 180ec865cb8SNiels Sascha Reedijk 181ec865cb8SNiels Sascha Reedijk \since Haiku R1 182ec865cb8SNiels Sascha Reedijk*/ 183ec865cb8SNiels Sascha Reedijk 184ec865cb8SNiels Sascha Reedijk 185ec865cb8SNiels Sascha Reedijk/*! 186ec865cb8SNiels Sascha Reedijk \fn BHttpMethod::BHttpMethod(const std::string_view &method) 187ec865cb8SNiels Sascha Reedijk \brief Construct a custom method. 188ec865cb8SNiels Sascha Reedijk 189ec865cb8SNiels Sascha Reedijk \param method The verb for the method. 190ec865cb8SNiels Sascha Reedijk 191ec865cb8SNiels Sascha Reedijk \exception std::bad_alloc In case it is not possible to allocate memory for the custom string. 192ec865cb8SNiels Sascha Reedijk \exception BHttpMethod::InvalidMethod In case the \a method is empty or contains invalid 193ec865cb8SNiels Sascha Reedijk characters. 194ec865cb8SNiels Sascha Reedijk 195ec865cb8SNiels Sascha Reedijk \since Haiku R1 196ec865cb8SNiels Sascha Reedijk*/ 197ec865cb8SNiels Sascha Reedijk 198ec865cb8SNiels Sascha Reedijk 199ec865cb8SNiels Sascha Reedijk/*! 200ec865cb8SNiels Sascha Reedijk \fn BHttpMethod::BHttpMethod(Verb verb) noexcept 201ec865cb8SNiels Sascha Reedijk \brief Construct a standard method. 202ec865cb8SNiels Sascha Reedijk 203ec865cb8SNiels Sascha Reedijk \param verb The chosen method. 204ec865cb8SNiels Sascha Reedijk 205ec865cb8SNiels Sascha Reedijk \since Haiku R1 206ec865cb8SNiels Sascha Reedijk*/ 207ec865cb8SNiels Sascha Reedijk 208ec865cb8SNiels Sascha Reedijk 209ec865cb8SNiels Sascha Reedijk/*! 210ec865cb8SNiels Sascha Reedijk \fn BHttpMethod::~BHttpMethod() 211ec865cb8SNiels Sascha Reedijk \brief Destructor. 212ec865cb8SNiels Sascha Reedijk 213ec865cb8SNiels Sascha Reedijk \since Haiku R1 214ec865cb8SNiels Sascha Reedijk*/ 215ec865cb8SNiels Sascha Reedijk 216ec865cb8SNiels Sascha Reedijk 217ec865cb8SNiels Sascha Reedijk/*! 218ec865cb8SNiels Sascha Reedijk \fn const std::string_view BHttpMethod::Method() const noexcept 219ec865cb8SNiels Sascha Reedijk \brief Get a string representation of the method. 220ec865cb8SNiels Sascha Reedijk 221ec865cb8SNiels Sascha Reedijk \return A \c std::string_view that is a string representation of the standard or custom method 222ec865cb8SNiels Sascha Reedijk in this object. The lifetime of the string view is bound to the lifetime of this method. 223ec865cb8SNiels Sascha Reedijk 224ec865cb8SNiels Sascha Reedijk \since Haiku R1 225ec865cb8SNiels Sascha Reedijk*/ 226ec865cb8SNiels Sascha Reedijk 227ec865cb8SNiels Sascha Reedijk 228ec865cb8SNiels Sascha Reedijk/*! 229ec865cb8SNiels Sascha Reedijk \fn BHttpMethod& BHttpMethod::operator=(BHttpMethod &&other) noexcept 230ec865cb8SNiels Sascha Reedijk \brief Move assignment. 231ec865cb8SNiels Sascha Reedijk Moves the data from the \a other to this object. The \a other object will be set to 232ec865cb8SNiels Sascha Reedijk \ref BHttpMethod::Get. 233ec865cb8SNiels Sascha Reedijk 234ec865cb8SNiels Sascha Reedijk \since Haiku R1 235ec865cb8SNiels Sascha Reedijk*/ 236ec865cb8SNiels Sascha Reedijk 237ec865cb8SNiels Sascha Reedijk 238ec865cb8SNiels Sascha Reedijk/*! 239ec865cb8SNiels Sascha Reedijk \fn BHttpMethod& BPrivate::Network::BHttpMethod::operator=(const BHttpMethod &other) 240ec865cb8SNiels Sascha Reedijk \brief Copy assignment. 241ec865cb8SNiels Sascha Reedijk 242ec865cb8SNiels Sascha Reedijk Copy data from an \a other object. 243ec865cb8SNiels Sascha Reedijk 244ec865cb8SNiels Sascha Reedijk \exception std::bad_alloc When the \a other object contains a custom verb, this exception 245ec865cb8SNiels Sascha Reedijk will be raised if it is impossible to allocate memory. 246ec865cb8SNiels Sascha Reedijk 247ec865cb8SNiels Sascha Reedijk \since Haiku R1 248ec865cb8SNiels Sascha Reedijk*/ 249ec865cb8SNiels Sascha Reedijk 250ec865cb8SNiels Sascha Reedijk 251*6ce6e964SNiels Sascha Reedijk/*! 252*6ce6e964SNiels Sascha Reedijk \class BHttpRequest 253*6ce6e964SNiels Sascha Reedijk \ingroup netservices 254*6ce6e964SNiels Sascha Reedijk \brief Represent a HTTP request. 255*6ce6e964SNiels Sascha Reedijk 256*6ce6e964SNiels Sascha Reedijk This class can be used to construct HTTP requests that can be executed by the Network Services 257*6ce6e964SNiels Sascha Reedijk Kit. A request has two states, either it is is a valid request, or it is an empty request. The 258*6ce6e964SNiels Sascha Reedijk criterium is whether or not the request has a URL. 259*6ce6e964SNiels Sascha Reedijk 260*6ce6e964SNiels Sascha Reedijk This class has all kinds of convenience methods set and retrieve particular options. Most 261*6ce6e964SNiels Sascha Reedijk options are wrapped in specialized container classes that do some form of validation. 262*6ce6e964SNiels Sascha Reedijk 263*6ce6e964SNiels Sascha Reedijk The default options are: 264*6ce6e964SNiels Sascha Reedijk <table> 265*6ce6e964SNiels Sascha Reedijk <tr><th>Getter</th><th>Setter</th><th>Description</th><th>Default</th></tr> 266*6ce6e964SNiels Sascha Reedijk <tr> 267*6ce6e964SNiels Sascha Reedijk <td> \ref Url() </td> 268*6ce6e964SNiels Sascha Reedijk <td> \ref SetUrl() </td> 269*6ce6e964SNiels Sascha Reedijk <td> The URL. This must start with http or https. </td> 270*6ce6e964SNiels Sascha Reedijk <td> Defaults to an empty \ref BUrl </td> 271*6ce6e964SNiels Sascha Reedijk </tr> 272*6ce6e964SNiels Sascha Reedijk <tr> 273*6ce6e964SNiels Sascha Reedijk <td> \ref Method() </td> 274*6ce6e964SNiels Sascha Reedijk <td> \ref SetMethod() </td> 275*6ce6e964SNiels Sascha Reedijk <td> The HTTP method for the request </td> 276*6ce6e964SNiels Sascha Reedijk <td> Defaults to \ref BHttpMethod::Get </td> 277*6ce6e964SNiels Sascha Reedijk </tr> 278*6ce6e964SNiels Sascha Reedijk </table> 279*6ce6e964SNiels Sascha Reedijk 280*6ce6e964SNiels Sascha Reedijk \since Haiku R1 281*6ce6e964SNiels Sascha Reedijk*/ 282*6ce6e964SNiels Sascha Reedijk 283*6ce6e964SNiels Sascha Reedijk 284*6ce6e964SNiels Sascha Reedijk/*! 285*6ce6e964SNiels Sascha Reedijk \name Constructors and Destructor 286*6ce6e964SNiels Sascha Reedijk*/ 287*6ce6e964SNiels Sascha Reedijk 288*6ce6e964SNiels Sascha Reedijk 289*6ce6e964SNiels Sascha Reedijk//! @{ 290*6ce6e964SNiels Sascha Reedijk 291*6ce6e964SNiels Sascha Reedijk 292*6ce6e964SNiels Sascha Reedijk/*! 293*6ce6e964SNiels Sascha Reedijk \fn BHttpRequest::BHttpRequest() 294*6ce6e964SNiels Sascha Reedijk \brief Construct an empty HTTP request. 295*6ce6e964SNiels Sascha Reedijk 296*6ce6e964SNiels Sascha Reedijk \exception std::bad_alloc This exception may be raised if it is impossible to allocate memory. 297*6ce6e964SNiels Sascha Reedijk 298*6ce6e964SNiels Sascha Reedijk \since Haiku R1 299*6ce6e964SNiels Sascha Reedijk*/ 300*6ce6e964SNiels Sascha Reedijk 301*6ce6e964SNiels Sascha Reedijk 302*6ce6e964SNiels Sascha Reedijk/*! 303*6ce6e964SNiels Sascha Reedijk \fn BHttpRequest::BHttpRequest(const BUrl &url) 304*6ce6e964SNiels Sascha Reedijk \brief Construct a HTTP request for an \a url. 305*6ce6e964SNiels Sascha Reedijk 306*6ce6e964SNiels Sascha Reedijk \param url A valid URL with the \c http or \c https protocol. 307*6ce6e964SNiels Sascha Reedijk 308*6ce6e964SNiels Sascha Reedijk \exception std::bad_alloc This exception may be raised if it is impossible to allocate memory. 309*6ce6e964SNiels Sascha Reedijk \exception BUnsupportedProtocol This exception is raised when the protocol of the URL cannot be 310*6ce6e964SNiels Sascha Reedijk handled. 311*6ce6e964SNiels Sascha Reedijk \exception BInvalidUrl This exception is raised when the \a url is invalid. 312*6ce6e964SNiels Sascha Reedijk 313*6ce6e964SNiels Sascha Reedijk \since Haiku R1 314*6ce6e964SNiels Sascha Reedijk*/ 315*6ce6e964SNiels Sascha Reedijk 316*6ce6e964SNiels Sascha Reedijk 317*6ce6e964SNiels Sascha Reedijk/*! 318*6ce6e964SNiels Sascha Reedijk \fn BHttpRequest::BHttpRequest(const BHttpRequest &other)=delete 319*6ce6e964SNiels Sascha Reedijk \brief Copying is not allowed. 320*6ce6e964SNiels Sascha Reedijk 321*6ce6e964SNiels Sascha Reedijk \since Haiku R1 322*6ce6e964SNiels Sascha Reedijk*/ 323*6ce6e964SNiels Sascha Reedijk 324*6ce6e964SNiels Sascha Reedijk 325*6ce6e964SNiels Sascha Reedijk/*! 326*6ce6e964SNiels Sascha Reedijk \fn BHttpRequest::BHttpRequest(BHttpRequest &&other) noexcept 327*6ce6e964SNiels Sascha Reedijk \brief Move constructor. 328*6ce6e964SNiels Sascha Reedijk 329*6ce6e964SNiels Sascha Reedijk After a move, the \a other object is left in an empty state. 330*6ce6e964SNiels Sascha Reedijk 331*6ce6e964SNiels Sascha Reedijk \param other The request to move data from. 332*6ce6e964SNiels Sascha Reedijk 333*6ce6e964SNiels Sascha Reedijk \since Haiku R1 334*6ce6e964SNiels Sascha Reedijk*/ 335*6ce6e964SNiels Sascha Reedijk 336*6ce6e964SNiels Sascha Reedijk 337*6ce6e964SNiels Sascha Reedijk/*! 338*6ce6e964SNiels Sascha Reedijk \fn BPrivate::Network::BHttpRequest::~BHttpRequest() 339*6ce6e964SNiels Sascha Reedijk \brief Destructor 340*6ce6e964SNiels Sascha Reedijk 341*6ce6e964SNiels Sascha Reedijk \since Haiku R1 342*6ce6e964SNiels Sascha Reedijk*/ 343*6ce6e964SNiels Sascha Reedijk 344*6ce6e964SNiels Sascha Reedijk 345*6ce6e964SNiels Sascha Reedijk//! @} 346*6ce6e964SNiels Sascha Reedijk 347*6ce6e964SNiels Sascha Reedijk 348*6ce6e964SNiels Sascha Reedijk/*! 349*6ce6e964SNiels Sascha Reedijk \name Assignment operators 350*6ce6e964SNiels Sascha Reedijk*/ 351*6ce6e964SNiels Sascha Reedijk 352*6ce6e964SNiels Sascha Reedijk 353*6ce6e964SNiels Sascha Reedijk//! @{ 354*6ce6e964SNiels Sascha Reedijk 355*6ce6e964SNiels Sascha Reedijk 356*6ce6e964SNiels Sascha Reedijk/*! 357*6ce6e964SNiels Sascha Reedijk \fn BHttpRequest& BHttpRequest::operator=(const BHttpRequest &other)=delete 358*6ce6e964SNiels Sascha Reedijk \brief Copy assignment is not allowed. 359*6ce6e964SNiels Sascha Reedijk 360*6ce6e964SNiels Sascha Reedijk \since Haiku R1 361*6ce6e964SNiels Sascha Reedijk*/ 362*6ce6e964SNiels Sascha Reedijk 363*6ce6e964SNiels Sascha Reedijk 364*6ce6e964SNiels Sascha Reedijk/*! 365*6ce6e964SNiels Sascha Reedijk \fn BHttpRequest& BHttpRequest::operator=(BHttpRequest &&other) noexcept 366*6ce6e964SNiels Sascha Reedijk \brief Move assignment 367*6ce6e964SNiels Sascha Reedijk 368*6ce6e964SNiels Sascha Reedijk After a move, the \a other object is left in an empty state. 369*6ce6e964SNiels Sascha Reedijk 370*6ce6e964SNiels Sascha Reedijk \param other The request to move data from. 371*6ce6e964SNiels Sascha Reedijk 372*6ce6e964SNiels Sascha Reedijk \since Haiku R1 373*6ce6e964SNiels Sascha Reedijk*/ 374*6ce6e964SNiels Sascha Reedijk 375*6ce6e964SNiels Sascha Reedijk 376*6ce6e964SNiels Sascha Reedijk//! @} 377*6ce6e964SNiels Sascha Reedijk 378*6ce6e964SNiels Sascha Reedijk 379*6ce6e964SNiels Sascha Reedijk/*! 380*6ce6e964SNiels Sascha Reedijk \name Valid or empty 381*6ce6e964SNiels Sascha Reedijk*/ 382*6ce6e964SNiels Sascha Reedijk 383*6ce6e964SNiels Sascha Reedijk 384*6ce6e964SNiels Sascha Reedijk//! @{ 385*6ce6e964SNiels Sascha Reedijk 386*6ce6e964SNiels Sascha Reedijk 387*6ce6e964SNiels Sascha Reedijk/*! 388*6ce6e964SNiels Sascha Reedijk \fn bool BHttpRequest::IsEmpty() const noexcept 389*6ce6e964SNiels Sascha Reedijk \brief Check if the request is valid or empty 390*6ce6e964SNiels Sascha Reedijk 391*6ce6e964SNiels Sascha Reedijk \retval true The request is empty. 392*6ce6e964SNiels Sascha Reedijk \retval false The request is valid. 393*6ce6e964SNiels Sascha Reedijk 394*6ce6e964SNiels Sascha Reedijk \since Haiku R1 395*6ce6e964SNiels Sascha Reedijk*/ 396*6ce6e964SNiels Sascha Reedijk 397*6ce6e964SNiels Sascha Reedijk 398*6ce6e964SNiels Sascha Reedijk//! @} 399*6ce6e964SNiels Sascha Reedijk 400*6ce6e964SNiels Sascha Reedijk 401*6ce6e964SNiels Sascha Reedijk/*! 402*6ce6e964SNiels Sascha Reedijk \name Current Options 403*6ce6e964SNiels Sascha Reedijk*/ 404*6ce6e964SNiels Sascha Reedijk 405*6ce6e964SNiels Sascha Reedijk 406*6ce6e964SNiels Sascha Reedijk//! @{ 407*6ce6e964SNiels Sascha Reedijk 408*6ce6e964SNiels Sascha Reedijk 409*6ce6e964SNiels Sascha Reedijk/*! 410*6ce6e964SNiels Sascha Reedijk \fn const BHttpMethod& BHttpRequest::Method() const noexcept 411*6ce6e964SNiels Sascha Reedijk \brief Get the current method for the request. 412*6ce6e964SNiels Sascha Reedijk 413*6ce6e964SNiels Sascha Reedijk This will either return the custom value set for this request, or the default as is listed in 414*6ce6e964SNiels Sascha Reedijk the overview documentation of this class. 415*6ce6e964SNiels Sascha Reedijk 416*6ce6e964SNiels Sascha Reedijk \since Haiku R1 417*6ce6e964SNiels Sascha Reedijk*/ 418*6ce6e964SNiels Sascha Reedijk 419*6ce6e964SNiels Sascha Reedijk 420*6ce6e964SNiels Sascha Reedijk/*! 421*6ce6e964SNiels Sascha Reedijk \fn const BUrl& BHttpRequest::Url() const noexcept 422*6ce6e964SNiels Sascha Reedijk \brief Get the current Url for the request. 423*6ce6e964SNiels Sascha Reedijk 424*6ce6e964SNiels Sascha Reedijk This will either return the custom value set for this request, or the default as is listed in 425*6ce6e964SNiels Sascha Reedijk the overview documentation of this class. 426*6ce6e964SNiels Sascha Reedijk 427*6ce6e964SNiels Sascha Reedijk \since Haiku R1 428*6ce6e964SNiels Sascha Reedijk*/ 429*6ce6e964SNiels Sascha Reedijk 430*6ce6e964SNiels Sascha Reedijk 431*6ce6e964SNiels Sascha Reedijk//! @} 432*6ce6e964SNiels Sascha Reedijk 433*6ce6e964SNiels Sascha Reedijk 434*6ce6e964SNiels Sascha Reedijk/*! 435*6ce6e964SNiels Sascha Reedijk \name Setting Options 436*6ce6e964SNiels Sascha Reedijk*/ 437*6ce6e964SNiels Sascha Reedijk 438*6ce6e964SNiels Sascha Reedijk 439*6ce6e964SNiels Sascha Reedijk//! @{ 440*6ce6e964SNiels Sascha Reedijk 441*6ce6e964SNiels Sascha Reedijk 442*6ce6e964SNiels Sascha Reedijk/*! 443*6ce6e964SNiels Sascha Reedijk \fn void BHttpRequest::SetMethod(const BHttpMethod &method) 444*6ce6e964SNiels Sascha Reedijk \brief Set the \a method for this request. 445*6ce6e964SNiels Sascha Reedijk 446*6ce6e964SNiels Sascha Reedijk Note that there currently is no additional validation done on any semantical incompatibilities. 447*6ce6e964SNiels Sascha Reedijk This means that it is currently allowed to do a \c GET or \c HEAD request with data, while that 448*6ce6e964SNiels Sascha Reedijk is forbidden by the standard. 449*6ce6e964SNiels Sascha Reedijk 450*6ce6e964SNiels Sascha Reedijk \param method The method to use for the request. 451*6ce6e964SNiels Sascha Reedijk 452*6ce6e964SNiels Sascha Reedijk \exception std::bad_alloc This exception may be raised if it is impossible to allocate memory. 453*6ce6e964SNiels Sascha Reedijk 454*6ce6e964SNiels Sascha Reedijk \since Haiku R1 455*6ce6e964SNiels Sascha Reedijk*/ 456*6ce6e964SNiels Sascha Reedijk 457*6ce6e964SNiels Sascha Reedijk 458*6ce6e964SNiels Sascha Reedijk/*! 459*6ce6e964SNiels Sascha Reedijk \fn void BHttpRequest::SetUrl(const BUrl &url) 460*6ce6e964SNiels Sascha Reedijk \brief Set the \a url for this request. 461*6ce6e964SNiels Sascha Reedijk 462*6ce6e964SNiels Sascha Reedijk \param url A valid URL with the \c http or \c https protocol. 463*6ce6e964SNiels Sascha Reedijk 464*6ce6e964SNiels Sascha Reedijk \exception std::bad_alloc This exception may be raised if it is impossible to allocate memory. 465*6ce6e964SNiels Sascha Reedijk \exception BUnsupportedProtocol This exception is raised when the protocol of the URL cannot be 466*6ce6e964SNiels Sascha Reedijk handled. 467*6ce6e964SNiels Sascha Reedijk \exception BInvalidUrl This exception is raised when the \a url is invalid. 468*6ce6e964SNiels Sascha Reedijk 469*6ce6e964SNiels Sascha Reedijk \since Haiku R1 470*6ce6e964SNiels Sascha Reedijk*/ 471*6ce6e964SNiels Sascha Reedijk 472*6ce6e964SNiels Sascha Reedijk 473*6ce6e964SNiels Sascha Reedijk//! @} 474*6ce6e964SNiels Sascha Reedijk 475*6ce6e964SNiels Sascha Reedijk 476ec865cb8SNiels Sascha Reedijk} // namespace Network 477ec865cb8SNiels Sascha Reedijk 478ec865cb8SNiels Sascha Reedijk} // namespace BPrivate 479ec865cb8SNiels Sascha Reedijk 480ec865cb8SNiels Sascha Reedijk#endif 481