HaikuBook: housekeeping of the netservices documentation
Change-Id: I6f9444665e061047bfb024ac0274b69fa1396912
This commit is contained in:
@@ -1,117 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Adrien Destugues, [email protected]
|
||||
*
|
||||
* Corresponds to:
|
||||
* headers/os/net/HttpAuthentication.h rev 39161
|
||||
* src/kits/network/libnetapi/HttpAuthentication.cpp rev 45363
|
||||
*/
|
||||
|
||||
/*!
|
||||
\file HttpAuthentication.h
|
||||
\ingroup network
|
||||
\brief Authentication token for use in HTTP protocol communications.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class BHttpAuthentication
|
||||
\ingroup network
|
||||
\brief Authentication token for the HTTP protocol.
|
||||
|
||||
This class allows managing of an authenticated http session. It stores the
|
||||
authentication credentials and realm and provides tools for generating the
|
||||
required nonces and hashes.
|
||||
|
||||
An instance of this class should be used for the whole length of an HTTP
|
||||
authenticated session. Initialize it by calling Initialize() and setting the
|
||||
username and password (from the constructor or the setter methods). Then,
|
||||
for each page that requires authentication, generate a token using the
|
||||
Authorization() method.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BHttpAuthentication::BHttpAuthentication()
|
||||
\brief Default constructor.
|
||||
|
||||
This will create an unconfigured authentication object with the
|
||||
authentication method set to B_HTTP_AUTHENTICATION_NONE.
|
||||
|
||||
You have to set the username and password, and initialize the object using
|
||||
the Initialize method with proper authentication data.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BHttpAuthentication::BHttpAuthentication(const BString& username,
|
||||
const BString& password)
|
||||
\brief Create an authentication session with the given name and password.
|
||||
|
||||
The authentication method is set to B_HTTP_AUTHENTICATION_NONE.
|
||||
This object can then be used with the Initialize method to bind it to an
|
||||
HTTP authenticated session.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void BHttpAuthentication::SetUserName(const BString& username)
|
||||
\brief Set the user name.
|
||||
|
||||
\param username the new user name.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void BHttpAuthentication::SetPassword(const BString& password)
|
||||
\brief Set the password
|
||||
|
||||
\param password the new password.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void BHttpAuthentication::SetMethod(BHttpAuthenticationMethod method)
|
||||
\brief Set the authentication method
|
||||
|
||||
\param method the new authentication method.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn status_t BHttpAuthentication::Initialize(const BString& wwwAuthenticate)
|
||||
\brief Initialize the object from the given authentication data
|
||||
|
||||
This method will parse the given authentication challenge and initialize
|
||||
the authentication type to either B_HTTP_AUTHENTICATION_BASIC or
|
||||
B_HTTP_AUTHENTICATION_DIGEST. The authentication parameters (realm, nonce,
|
||||
algorithm) and state (opaque, stale) are also parsed and stored.
|
||||
|
||||
\param wwwAuthenticate the value of the WWW-Authenticate HTTP header field.
|
||||
\return B_OK if the request was parsed, B_ERROR if there is a parsing error,
|
||||
B_BAD_VALUE if the authentication string is empty.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const BString& BHttpAuthentication::UserName() const
|
||||
\returns the user name.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const BString& BHttpAuthentication::Password() const
|
||||
\returns the password.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BHttpAuthenticationMethod BHttpAuthentication::Method() const
|
||||
\returns the authentication method
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BString BHttpAuthentication::Authorization(const BUrl& url,
|
||||
const BString& method) const
|
||||
\brief Generate an authentication reply for the given URL and method.
|
||||
|
||||
For basic authentication, the reply is constant and is a Base64 encoding of
|
||||
the string made of 'username:password'. In digest mode, each request will
|
||||
have a different reply, so you must call this method for each page you want
|
||||
to authenticate with.
|
||||
|
||||
\return the generated reply
|
||||
*/
|
||||
@@ -1,405 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2013 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Adrien Destugues, [email protected]
|
||||
* John Scipione, [email protected]
|
||||
*
|
||||
* Corresponds to:
|
||||
* headers/os/net/HttpForm.h hrev46314
|
||||
* src/kits/network/libnetapi/HttpForm.cpp hrev46314
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\file HttpForm.h
|
||||
\ingroup network
|
||||
\brief Management of HTTP form data
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\enum form_type
|
||||
\ingroup network
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\var form_type B_HTTP_FORM_URL_ENCODED
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\var form_type B_HTTP_FORM_MULTIPART
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\enum form_content_type
|
||||
\ingroup network
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\var form_content_type B_HTTPFORM_UNKNOWN
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\var form_content_type B_HTTPFORM_STRING
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\var form_content_type B_HTTPFORM_FILE
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\var form_content_type B_HTTPFORM_BUFFER
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class BHttpFormData
|
||||
\ingroup network
|
||||
\brief Stores a form data entry sent or received during an HTTP request.
|
||||
|
||||
Each element in a form is stored in an instance of this class. The values
|
||||
can be either strings, arbitrary binary buffers, or a pointer to a file.
|
||||
|
||||
The latter allows reading data from the file as it is being sent through
|
||||
the network, removing hte need to buffer the whole file contents in memory.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BHttpFormData::BHttpFormData(const BString& name, const BString& value)
|
||||
\brief Construct a BHttpFormData object with a string value.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BHttpFormData::BHttpFormData(const BString& name, const BPath& value)
|
||||
\brief Construct a BHttpFormData object which value is a file contents
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BHttpFormData::BHttpFormData(const BString& name, const void* buffer,
|
||||
ssize_t size)
|
||||
\brief Construct a BHttpFormData object which value is a binary buffer.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BHttpFormData::InitCheck() const
|
||||
\brief Checks the initialization of the object
|
||||
|
||||
\return \c false if attempting to construct a BHttpFormData with a \c NULL
|
||||
buffer.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn const BString& BHttpFormData::Name() const
|
||||
\brief Get the form field name
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn const BString& BHttpFormData::String() const
|
||||
\brief Get the string value of a form field.
|
||||
|
||||
\return An empty string for buffer and file based fields.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn const BPath& BHttpFormData::File() const
|
||||
\brief Get the file path of a form field.
|
||||
|
||||
\return An empty string for buffer and string based fields.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn const void* BHttpFormData::Buffer() const
|
||||
\brief Get a pointer to the data of a form field.
|
||||
|
||||
\return An empty string for string and file based fields
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn ssize_t BHttpFormData::BufferSize() const;
|
||||
\brief Get the buffer size
|
||||
|
||||
\return 0 for string and file based fields.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BHttpFormData::IsFile() const
|
||||
\return \c true if the field data is a file.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn const BString& BHttpFormData::Filename() const;
|
||||
\return The name of the file, for file based fields.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn const BString& BHttpFormData::MimeType() const
|
||||
\return The MIME type of the data.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn form_content_type BHttpFormData::Type() const
|
||||
\return The kind of field.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BHttpFormData::CopyBuffer()
|
||||
\brief Make a copy of the internal buffer
|
||||
|
||||
The constructor for buffer-based fields does not copy the data given to it,
|
||||
it just keeps a pointer. If you want to retain ownership of the data, call
|
||||
this method so the buffer copies and releases it.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BHttpFormData::MarkAsFile(const BString& filename,
|
||||
const BString& mimeType)
|
||||
\brief Mark a field as a file.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpFormData::UnmarkAsFile()
|
||||
\brief Unmark a field as a file.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BHttpFormData::CopyBuffer()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BHttpFormData& BHttpFormData::operator=(const BHttpFormData& other)
|
||||
\brief Assignment operator.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class BHttpForm
|
||||
\ingroup network
|
||||
\brief Container for all the BHttpFormData instances making up an HTTP form contents.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BHttpForm::BHttpForm()
|
||||
\brief Create a new form object.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BHttpForm::BHttpForm(const BHttpForm& other)
|
||||
\brief Create a new form object as a copy of \a other.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BHttpForm::BHttpForm(const BString& formString)
|
||||
\brief Create a new form object and parse the \a formString.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BHttpForm::~BHttpForm()
|
||||
\brief Clear the form and destroy the form object.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpForm::ParseString(const BString& formString)
|
||||
\brief Parse the \a formString.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BString BHttpForm::RawData() const
|
||||
\brief Return the form's raw data as a BString.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BHttpForm::AddString(const BString& fieldName,
|
||||
const BString& value)
|
||||
\brief Add a string to the form with the specified \a fieldName and \a value.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BHttpForm::AddInt(const BString& fieldName, int32 value)
|
||||
\brief Add an int to the form with the specified \a fieldName and \a value.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BHttpForm::AddFile(const BString& fieldName, const BPath& file)
|
||||
\brief Add a file to the form with the specified \a fieldName and \a value.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BHttpForm::AddBuffer(const BString& fieldName,
|
||||
const void* buffer, ssize_t size)
|
||||
\brief Add a buffer to the form with the specified \a fieldName and \a buffer
|
||||
and \a size.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn status_t BHttpForm::AddBufferCopy(const BString& fieldName,
|
||||
const void* buffer, ssize_t size)
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpForm::MarkAsFile(const BString& fieldName,
|
||||
const BString& filename, const BString& mimeType)
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpForm::MarkAsFile(const BString& fieldName,
|
||||
const BString& filename)
|
||||
\brief Mark a field as a filename.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpForm::UnmarkAsFile(const BString& fieldName)
|
||||
\brief Unmark a field as a filename.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpForm::SetFormType(form_type type)
|
||||
\brief Change form type.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BHttpForm::HasField(const BString& name) const
|
||||
\brief Returns whether or not a form has a field with the specified \a name.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BString BHttpForm::GetMultipartHeader(const BString& fieldName) const
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn form_type BHttpForm::GetFormType() const
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn const BString& BHttpForm::GetMultipartBoundary() const
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BString BHttpForm::GetMultipartFooter() const
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn ssize_t BHttpForm::ContentLength() const
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BHttpForm::Iterator BHttpForm::GetIterator()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpForm::Clear()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BHttpFormData& BHttpForm::operator[](const BString& name)
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpForm::_ExtractNameValuePair(const BString& formString, int32* index)
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpForm::_GenerateMultipartBoundary()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpForm::Clear()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class BHttpForm::Iterator
|
||||
\ingroup network
|
||||
\brief Form Iterator.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BHttpForm::Iterator::Iterator(BHttpForm* form)
|
||||
\brief Constructor.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BHttpForm::Iterator::Iterator(const Iterator& other);
|
||||
\brief Copy contstructor.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn bool BHttpForm::Iterator::HasNext() const
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BHttpFormData* BHttpForm::Iterator::Next()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpForm::Iterator::Remove()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BString BHttpForm::Iterator::MultipartHeader()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BHttpForm::Iterator& BHttpForm::Iterator::operator=(const Iterator& other)
|
||||
\brief Assignment operator.
|
||||
*/
|
||||
@@ -1,182 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Adrien Destugues, [email protected]
|
||||
*
|
||||
* Corresponds to:
|
||||
* headers/os/net/HttpHeaders.h rev 39161
|
||||
* src/kits/network/libnetapi/HttpHeaders.cpp rev 45253
|
||||
*/
|
||||
|
||||
/*!
|
||||
\file HttpHeaders.h
|
||||
\ingroup network
|
||||
\brief Management of HTTP headers
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class BHttpHeader
|
||||
\ingroup network
|
||||
\brief Represent a single header field for an HTTP connection
|
||||
|
||||
HTTP headers are key-value pairs, where both the key and the value are
|
||||
strings. The main purpose of this class is storing the pair and encoding it
|
||||
to the HTTP protocol format, where some characters have to be escaped.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BHttpHeader::BHttpHeader()
|
||||
\brief Default constructor.
|
||||
|
||||
The header is initialized with empty key and value.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BHttpHeader::BHttpHeader(const char* string)
|
||||
\brief Construct a BHttpHeader from an already encoded string
|
||||
|
||||
The given string should be in the form "key:value" with all special
|
||||
characters properly escaped. There is no way to detect parsing errors when
|
||||
the given string is not properly formatted. Consider using SetHeader()
|
||||
instead, where this can be checked.
|
||||
|
||||
\param string the http-encoded header to parse
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BHttpHeader::BHttpHeader(const char* name, const char* value)
|
||||
\brief Construct a BHttpHeader from an unencoded key-value pair.
|
||||
|
||||
\param name the key
|
||||
\param value the value
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BHttpHeader::BHttpHeader(const BHttpHeader& copy)
|
||||
\brief Copy constructor.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void BHttpHeader::SetName(const char* name)
|
||||
\brief Sets the key for this header.
|
||||
|
||||
The key is trimmed (BString::Trim()) to remove any whitespace.
|
||||
|
||||
\param name the new key
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void BHttpHeader::SetValue(const char* value)
|
||||
\brief Sets the value for this header.
|
||||
|
||||
The value is trimmed (BString::Trim()) to remove any whitespace.
|
||||
|
||||
\param value the new value
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool BHttpHeader::SetHeader(const char* string)
|
||||
\brief Parse the given string and configure this object
|
||||
|
||||
Extracts and decode the name and value from the given string.
|
||||
|
||||
\param string the header data to parse
|
||||
\return wether parsing succeeded
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const char* BHttpHeader::Name() const
|
||||
\return the key for this header
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const char* BHttpHeader::Value() const
|
||||
\return the value for this header
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const char* BHttpHeader::Header() const
|
||||
\return the encoded header
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool BHttpHeader::NameIs(const char* name) const
|
||||
\brief Compare this header name with the given one
|
||||
|
||||
Both names are trimmed from whitespace, and the comparison is not case
|
||||
sensitive (as per the HTTP specification).
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class BHttpHeaders
|
||||
\ingroup network
|
||||
\brief Container for a set of HTTP headers.
|
||||
|
||||
This class allows management of the set of headers for a single HTTP
|
||||
transaction. They are stored in a list and can be iterated on.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BHttpHeaders::BHttpHeaders()
|
||||
\brief Construct an empty header list.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BHttpHeaders::BHttpHeaders(const BHttpHeaders& copy)
|
||||
\brief Copy constructor
|
||||
|
||||
A deep copy is performed, so modifying the headers in the copy does not
|
||||
change the original.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const char* BHttpHeaders::HeaderValue(const char* name) const
|
||||
\return the value mapped to the given key, or NULL if not found.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BHttpHeader& BHttpHeaders::HeaderAt(int32 index) const
|
||||
\brief Find header by position
|
||||
|
||||
\param index must be in bounds, else this method will crash.
|
||||
\see CountHeaders()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int32 BHttpHeaders::CountHeaders() const
|
||||
\return the number of entries in this set
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int32 BHttpHeaders::HasHeader(const char* name) const
|
||||
\brief Find an header by key
|
||||
\return The index of the header for use with HeaderAt(), or B_ERROR if not
|
||||
found.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool BHttpHeaders::AddHeader(const char* line)
|
||||
\brief Add a new header to the list, from an HTTP header line.
|
||||
|
||||
Duplicates headers are allowed.
|
||||
|
||||
\return false when out of memory.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool BHttpHeaders::AddHeader(const char* name, const char* value)
|
||||
\brief Add a new header from the given key:value pair
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool BHttpHeaders::AddHeader(const char* name, int32 value)
|
||||
\brief Convenience method to add a header with a numeric value.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void BHttpHeaders::Clear()
|
||||
\brief Remove all HTTP headers from the list
|
||||
*/
|
||||
|
||||
@@ -1,182 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Adrien Destugues, [email protected]
|
||||
* John Scipione, [email protected]
|
||||
*
|
||||
* Corresponds to:
|
||||
* headers/os/net/HttpRequest.h hrev46314
|
||||
* src/kits/network/libnetapi/HttpRequest.cpp hrev46314
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\file HttpRequest.h
|
||||
\ingroup network
|
||||
\brief Management of HTTP or HTTPS protocol requests
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class BHttpRequest
|
||||
\ingroup network
|
||||
\brief Handles a request over HTTP or HTTPS.
|
||||
|
||||
Instances of ths class will be created by the BUrlProtocolRoster for
|
||||
BUrl with the "http" or "https" protocol. The HTTP protocol is
|
||||
implemented as specified in RFC2616. The request headers and body can be
|
||||
customized, then sent to the server. The reply is then parsed and made
|
||||
available to the application.
|
||||
|
||||
This class only implements the client-side part of HTTP, it can't be used
|
||||
to build an HTTP server.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpRequest::SetMethod(const char* method)
|
||||
\brief Set the HTTP method.
|
||||
|
||||
You can use either one of the standard methods (B_HTTP_GET is the default)
|
||||
or a custom one. The standard methods are B_HTTP_GET, B_HTTP_POST,
|
||||
B_HTTP_PUT, B_HTTP_DELETE, B_HTTP_HEAD, B_HTTP_OPTIONS, B_HTTP_TRACE and
|
||||
B_HTTP_CONNECT.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpRequest::SetFollowLocation(bool follow)
|
||||
\brief Enable or disable following HTTP redirects.
|
||||
|
||||
An HTTP server can redirect a request to another address, either on the
|
||||
same host or elsewhere. When FollowLocation is set (the default), these
|
||||
redirections will be followed until an actual page (or an error) is found.
|
||||
When it is unset, the redirection will not be followed and will be reported
|
||||
to the client.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpRequest::SetMaxRedirections(int8 maxRedirections)
|
||||
\brief Set the maximal number of redirections to follow before giving up.
|
||||
|
||||
This is only useful when SetFollowLocation is enabled. It will abort
|
||||
the request after the given number of redirections. This avoids and helps
|
||||
diagnosing redirection cycles, where two addresses redirect to each other.
|
||||
|
||||
The default is to follow at most 8 redirections before giving up.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpRequest::SetReferrer(const BString& referrer)
|
||||
\brief Set the referrer.
|
||||
|
||||
The referrer is a string sent to the server in the "Referrer:" HTTP header
|
||||
field. It helps the server know where the request comes from. When
|
||||
following a link in an HTML page, this is usually set to the URL of that
|
||||
page.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpRequest::SetUserAgent(const BString& userAgent)
|
||||
\brief Set the user agent.
|
||||
|
||||
The user agent is an identifier for the client sending an HTTP request.
|
||||
Some servers will use this to send different content depending on the
|
||||
software asking for a page.
|
||||
|
||||
The default user agent is "Services Kit (Haiku)".
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpRequest::SetHeaders(const BHttpHeaders& headers)
|
||||
\brief Set the HTTP headers.
|
||||
|
||||
This method replaces the whole set of headers for this request with a copy
|
||||
of the given ones.
|
||||
|
||||
\param headers the header template to copy from.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpRequest::AdoptHeaders(BHttpHeaders* const headers)
|
||||
\brief Set the HTTP headers.
|
||||
|
||||
This method replaces the whole set of headers for this request. It takes
|
||||
ownership of the parameter, which must not be used afterwards.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
\fn void BHttpRequest::SetDiscardDate(bool discard)
|
||||
|
||||
This is currently unused.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
\fn void BHttpRequest::DisableListener(bool disable)
|
||||
This is currently unused.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpRequest::SetAutoReferrer(bool enable)
|
||||
\brief Automatically set the referrer when the request is done.
|
||||
|
||||
This allows HttpRequest to manage the referrer automatically. Each request
|
||||
will set the referrer to its own URL so the next request automatically
|
||||
uses that one.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpRequest::SetPostFields(const BHttpForm& fields)
|
||||
\brief Set the fields for form POST data.
|
||||
|
||||
Replaces the content of the request with a copy of the given POST fields.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpRequest::AdoptPostFields(BHttpForm* const fields)
|
||||
\brief Set the fields for form POST data.
|
||||
|
||||
Replaces the content of the request with the given POST fields.
|
||||
|
||||
This method takes ownership of the given form, which must not be used
|
||||
elsewhere afterwards.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpRequest::AdoptInputData(BDataIO* const data, const ssize_t size = -1)
|
||||
\brief Set the request body.
|
||||
|
||||
If the size is -1 (the default), the data will be sent using chunked
|
||||
transfers. If the size is known, it will be sent using the Content-Length
|
||||
header and non-chunked mode.
|
||||
|
||||
You should set the size whenever possible, as some servers will not handle
|
||||
chunked mode properly in all cases.
|
||||
|
||||
This method takes ownership of the data, which must not be used elsewhere.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpRequest::SetUserName(const BString& userName)
|
||||
\brief Set the user name for HTTP authentication.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void BHttpRequest::SetPassword(const BString& password)
|
||||
\brief Set the user password for HTTP authentication.
|
||||
*/
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright 2020 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Leorize, [email protected]
|
||||
*
|
||||
* Corresponds to:
|
||||
* headers/os/net/UrlProtocolAsynchronousListener.h hrev54280
|
||||
* src/kits/network/libnetapi/UrlProtocolAsynchronousListener.cpp hrev54280
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\file UrlProtocolAsynchronousListener.h
|
||||
\ingroup network
|
||||
\brief Provides the BUrlProtocolAsynchronousListener interface.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class BUrlProtocolAsynchronousListener
|
||||
\ingroup network
|
||||
\brief Provides a handler for BUrlProtocolDispatchingListener.
|
||||
|
||||
BUrlProtocolAsynchronousListener transparently handles BMessage issued by
|
||||
BUrlProtocolDispatchingListener via callbacks from the BUrlProtocolListener
|
||||
interface.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn BUrlProtocolAsynchronousListener::BUrlProtocolAsynchronousListener(bool transparent = false)
|
||||
\brief Create a BUrlProtocolAsynchronousListener.
|
||||
|
||||
This constructor will also add the created object to the list of be_app
|
||||
handlers.
|
||||
|
||||
\param transparent Whether a BUrlProtocolListener object should be created
|
||||
in conjunction with the current object. This object can be accessed via
|
||||
SynchronousListener().
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual BUrlProtocolAsynchronousListener::~BUrlProtocolAsynchronousListener()
|
||||
\brief Default destructor for BUrlProtocolAsynchronousListener.
|
||||
|
||||
This destructor will free resources associated with the current object.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn BUrlProtocolListener* BUrlProtocolAsynchronousListener::SynchronousListener()
|
||||
\brief The synchronous listener created from the current object.
|
||||
|
||||
\returns A pointer to a BUrlProtocolListener object, or \c NULL if
|
||||
\c transparent was \c false on object creation and/or memory couldn't
|
||||
be allocated for the object at the time of creation.
|
||||
|
||||
\warning The returned pointer lifetime is associated with the current object.
|
||||
Do not attempt to delete this pointer.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void BUrlProtocolAsynchronousListener::MessageReceived(BMessage* message)
|
||||
\brief Handle messages that has been received by the associated looper.
|
||||
|
||||
This handler handles messages received from
|
||||
BUrlProtocolDispatchingListener and handle them via callbacks as defined per
|
||||
BUrlProtocolListener.
|
||||
*/
|
||||
@@ -1,196 +0,0 @@
|
||||
/*
|
||||
* Copyright 2020 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Leorize, [email protected]
|
||||
*
|
||||
* Corresponds to:
|
||||
* headers/os/net/UrlProtocolListener.h hrev54280
|
||||
* src/kits/network/libnetapi/UrlProtocolListener.cpp hrev54280
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\file UrlProtocolListener.h
|
||||
\ingroup network
|
||||
\brief Provides the BUrlProtocolListener abstract interface.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\enum BUrlProtocolDebugMessage
|
||||
\brief The type of the debug message.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\var B_URL_PROTOCOL_DEBUG_TEXT
|
||||
\brief Informational debug message.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\var B_URL_PROTOCOL_DEBUG_ERROR
|
||||
\brief Error debug message.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\var B_URL_PROTOCOL_DEBUG_HEADER_IN
|
||||
\brief Debug messages related to metadata received.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\var B_URL_PROTOCOL_DEBUG_HEADER_OUT
|
||||
\brief Debug messages related to metadata sent.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\var B_URL_PROTOCOL_DEBUG_TRANSFER_IN
|
||||
\brief Debug messages related to data received.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\var B_URL_PROTOCOL_DEBUG_TRANSFER_OUT
|
||||
\brief Debug messages related to data sent.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class BUrlProtocolListener
|
||||
\ingroup network
|
||||
\brief Abstract interface for handling BUrlRequest events.
|
||||
|
||||
BUrlProtocolListener is the base class for handling networking events from
|
||||
BUrlRequest.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn virtual void BUrlProtocolListener::ConnectionOpened(BUrlRequest* caller)
|
||||
\brief Called when the socket is opened.
|
||||
|
||||
\b Frequency: Once
|
||||
|
||||
\param caller The BUrlRequest that invoked this callback.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void BUrlProtocolListener::HostnameResolved(BUrlRequest* caller,
|
||||
const char* ip)
|
||||
\brief Called when the final IP is discovered.
|
||||
|
||||
\b Frequency: Once
|
||||
|
||||
\param caller The BUrlRequest that invoked this callback.
|
||||
\param ip String representing the IP address of the resource host.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void BUrlProtocolListener::ResponseStarted(BUrlRequest* caller)
|
||||
\brief Called when the request has been emitted and the server begins to reply.
|
||||
|
||||
Typically this callback will be called when the HTTP status code is
|
||||
received.
|
||||
|
||||
\b Frequency: Once
|
||||
|
||||
\param caller The BUrlRequest that invoked this callback.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void BUrlProtocolListener::HeadersReceived(BUrlRequest* caller,
|
||||
const BUrlResult& result);
|
||||
\brief Called when all of the server response metadata (such as headers)
|
||||
have been read and parsed.
|
||||
|
||||
\b Frequency: Once
|
||||
|
||||
\param caller The BUrlRequest that invoked this callback.
|
||||
\param result The BUrlResult associated with the request.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void BUrlProtocolListener::DataReceived(BUrlRequest* caller,
|
||||
const char* data, off_t position, size_t size)
|
||||
\brief Called each time a block of data is received.
|
||||
|
||||
\b Frequency: Zero or more
|
||||
|
||||
\param caller The BUrlRequest that invoked this callback.
|
||||
\param data Pointer to the data block in memory.
|
||||
\param position Offset of the data in the stream.
|
||||
\param size Size of the data block.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void BUrlProtocolListener::DownloadProgress(BUrlRequest* caller,
|
||||
ssize_t bytesReceived, ssize_t bytesTotal)
|
||||
\brief Called each time a block of data is downloaded.
|
||||
|
||||
This callback will usually be called after DataReceived().
|
||||
|
||||
\b Frequency: Once or more
|
||||
|
||||
\param caller The BUrlRequest that invoked this callback.
|
||||
\param bytesReceived Number of data bytes received. This is the number of
|
||||
bytes received prior to any processing and can be smaller than the
|
||||
size of the data block sent to DataReceived() as the transport might
|
||||
be compressed.
|
||||
\param bytesTotal Total number of data bytes expected. \c 0 will be passed
|
||||
if the total number of data bytes is not available.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void BUrlProtocolListener::UploadProgress(BUrlRequest* caller,
|
||||
ssize_t bytesSent, ssize_t bytesTotal)
|
||||
\brief Called each time a block of data is sent.
|
||||
|
||||
\note Currently this callback is never called.
|
||||
|
||||
\param caller The BUrlRequest that invoked this callback.
|
||||
\param bytesSent Number of data bytes sent.
|
||||
\param bytesTotal Total number of data bytes left.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void BUrlProtocolListener::RequestCompleted(BUrlRequest* caller,
|
||||
bool success)
|
||||
\brief Called once the request is complete.
|
||||
|
||||
\b Frequency: Once
|
||||
|
||||
\param caller The BUrlRequest that invoked this callback.
|
||||
\param success Whether the request has been successfully completed.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void BUrlProtocolListener::DebugMessage(BUrlRequest* caller,
|
||||
BUrlProtocolDebugMessage type, const char* text)
|
||||
\brief Called each time a debug message is emitted.
|
||||
|
||||
\b Frequency: Zero or more
|
||||
|
||||
\param caller The BUrlRequest that invoked this callback.
|
||||
\param type Type of the message.
|
||||
\param text The message.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool BUrlProtocolListener::CertificateVerificationFailed(
|
||||
BUrlRequest* caller, BCertificate& certificate, const char* message
|
||||
)
|
||||
\brief Called when cerificate verification failed.
|
||||
|
||||
\b Frequency: Once
|
||||
|
||||
\param caller The BUrlRequest that invoked this callback.
|
||||
\param certificate The SSL certificate of which validation failed.
|
||||
\param message The error message describing the issue.
|
||||
|
||||
\returns \c true to ignore and proceed with the request, \c false to abort.
|
||||
*/
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright 2020 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Leorize, [email protected]
|
||||
*
|
||||
* Corresponds to:
|
||||
* headers/os/net/UrlProtocolRoster.h hrev54280
|
||||
* src/kits/network/libnetapi/UrlProtocolRoster.cpp hrev54280
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\file UrlProtocolRoster.h
|
||||
\ingroup network
|
||||
\brief Provides the BUrlProtocolRoster interface.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\class BUrlProtocolRoster
|
||||
\ingroup network
|
||||
\brief Interfaces for protocol-agnostic operations.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn static BUrlRequest* BUrlProtocolRoster::MakeRequest(const BUrl& url,
|
||||
BUrlProtocolListener* listener = NULL, BUrlContext* context = NULL)
|
||||
\brief Create a BUrlRequest that can handle the given BUrl
|
||||
|
||||
\param url The URL to create a request for
|
||||
\param listener The BUrlProtocolListener to be registered with the created
|
||||
BUrlRequest, can be \c NULL
|
||||
\param context The BUrlContext to be registered with the created
|
||||
BUrlRequest, can be \c NULL
|
||||
|
||||
\returns A pointer to the BUrlRequest that can handle the given BUrl.
|
||||
\c NULL will be returned if there aren't any BUrlRequest that can
|
||||
handle the given protocol or if memory couldn't be allocated.
|
||||
*/
|
||||
Reference in New Issue
Block a user