File include/brisk/network/Fetch.hpp¶
HttpMethod enum¶
enum class HttpMethod
Enum representing different HTTP methods.
Auto enumerator (HttpMethod::Auto)¶
HTTP POST if requestBody is not null, GET otherwise.
Get enumerator (HttpMethod::Get)¶
HTTP GET method.
Post enumerator (HttpMethod::Post)¶
HTTP POST method.
Put enumerator (HttpMethod::Put)¶
HTTP PUT method.
Head enumerator (HttpMethod::Head)¶
HTTP HEAD method.
Delete enumerator (HttpMethod::Delete)¶
HTTP DELETE method.
Patch enumerator (HttpMethod::Patch)¶
HTTP PATCH method.
HttpBasicAuth class¶
HttpBasicAuth
Structure representing HTTP Basic Authentication.
username variable (HttpBasicAuth::username)¶
std::string username
Username for basic authentication.
password variable (HttpBasicAuth::password)¶
std::string password
Password for basic authentication.
HttpBearerAuth class¶
HttpBearerAuth
Structure representing HTTP Bearer Authentication.
token variable (HttpBearerAuth::token)¶
std::string token
Bearer token for authentication.
HttpRequest class¶
HttpRequest
Structure representing an HTTP request.
url variable (HttpRequest::url)¶
std::string url
The URL for the HTTP request.
method variable (HttpRequest::method)¶
HttpMethod method = HttpMethod::Auto
The HTTP method for the request.
referer variable (HttpRequest::referer)¶
std::string referer =
Optional Referer header.
headers variable (HttpRequest::headers)¶
std::vector<std::string> headers
Additional headers for the request.
followLocation variable (HttpRequest::followLocation)¶
bool followLocation = true
Whether to follow redirects.
authentication variable (HttpRequest::authentication)¶
std::variant<std::monostate, HttpBasicAuth,
HttpBearerAuth> authentication
Authentication options.
timeout variable (HttpRequest::timeout)¶
std::chrono::milliseconds timeout
Request timeout duration.
FetchErrorCode enum¶
enum class FetchErrorCode
Enum representing different fetch error codes for HTTP requests.
ok enumerator (FetchErrorCode::ok)¶
No error, successful operation.
unsupportedProtocol enumerator (FetchErrorCode::unsupportedProtocol)¶
Unsupported protocol.
failedInit enumerator (FetchErrorCode::failedInit)¶
internal/Initialization failure.
urlMalformat enumerator (FetchErrorCode::urlMalformat)¶
Malformed URL.
notBuiltIn enumerator (FetchErrorCode::notBuiltIn)¶
Functionality not built-in.
couldntResolveProxy enumerator (FetchErrorCode::couldntResolveProxy)¶
Could not resolve proxy.
couldntResolveHost enumerator (FetchErrorCode::couldntResolveHost)¶
Could not resolve host.
couldntConnect enumerator (FetchErrorCode::couldntConnect)¶
Could not connect to the server.
weirdServerReply enumerator (FetchErrorCode::weirdServerReply)¶
Unexpected server reply.
remoteAccessDenied enumerator (FetchErrorCode::remoteAccessDenied)¶
Access denied by the server.
ftpAcceptFailed enumerator (FetchErrorCode::ftpAcceptFailed)¶
FTP accept failed.
ftpWeirdPassReply enumerator (FetchErrorCode::ftpWeirdPassReply)¶
Weird FTP password reply.
ftpAcceptTimeout enumerator (FetchErrorCode::ftpAcceptTimeout)¶
FTP accept timeout.
ftpWeirdPasvReply enumerator (FetchErrorCode::ftpWeirdPasvReply)¶
Weird FTP PASV reply.
ftpWeird227Format enumerator (FetchErrorCode::ftpWeird227Format)¶
Weird FTP 227 response format.
ftpCantGetHost enumerator (FetchErrorCode::ftpCantGetHost)¶
Could not retrieve host from FTP.
http2 enumerator (FetchErrorCode::http2)¶
HTTP/2 framing layer problem.
ftpCouldntSetType enumerator (FetchErrorCode::ftpCouldntSetType)¶
Could not set FTP transfer type.
partialFile enumerator (FetchErrorCode::partialFile)¶
Partial file transfer.
ftpCouldntRetrFile enumerator (FetchErrorCode::ftpCouldntRetrFile)¶
Could not retrieve FTP file.
obsolete20 enumerator (FetchErrorCode::obsolete20)¶
Obsolete error code (not used).
quoteError enumerator (FetchErrorCode::quoteError)¶
Failure in executing quote command.
httpReturnedError enumerator (FetchErrorCode::httpReturnedError)¶
HTTP server returned an error.
writeError enumerator (FetchErrorCode::writeError)¶
Error writing data.
obsolete24 enumerator (FetchErrorCode::obsolete24)¶
Obsolete error code (not used).
uploadFailed enumerator (FetchErrorCode::uploadFailed)¶
Upload failed.
readError enumerator (FetchErrorCode::readError)¶
Error reading file.
outOfMemory enumerator (FetchErrorCode::outOfMemory)¶
Out of memory error.
operationTimedout enumerator (FetchErrorCode::operationTimedout)¶
Operation timed out.
obsolete29 enumerator (FetchErrorCode::obsolete29)¶
Obsolete error code (not used).
ftpPortFailed enumerator (FetchErrorCode::ftpPortFailed)¶
FTP PORT command failed.
ftpCouldntUseRest enumerator (FetchErrorCode::ftpCouldntUseRest)¶
FTP REST command failed.
obsolete32 enumerator (FetchErrorCode::obsolete32)¶
Obsolete error code (not used).
rangeError enumerator (FetchErrorCode::rangeError)¶
RANGE command failed.
httpPostError enumerator (FetchErrorCode::httpPostError)¶
HTTP POST request failed.
sslConnectError enumerator (FetchErrorCode::sslConnectError)¶
SSL connection error.
badDownloadResume enumerator (FetchErrorCode::badDownloadResume)¶
Failed to resume download.
fileCouldntReadFile enumerator (FetchErrorCode::fileCouldntReadFile)¶
Could not read file.
ldapCannotBind enumerator (FetchErrorCode::ldapCannotBind)¶
LDAP bind operation failed.
ldapSearchFailed enumerator (FetchErrorCode::ldapSearchFailed)¶
LDAP search operation failed.
obsolete40 enumerator (FetchErrorCode::obsolete40)¶
Obsolete error code (not used).
functionNotFound enumerator (FetchErrorCode::functionNotFound)¶
Function not found.
abortedByCallback enumerator (FetchErrorCode::abortedByCallback)¶
Operation aborted by callback.
badFunctionArgument enumerator (FetchErrorCode::badFunctionArgument)¶
Bad function argument.
obsolete44 enumerator (FetchErrorCode::obsolete44)¶
Obsolete error code (not used).
interfaceFailed enumerator (FetchErrorCode::interfaceFailed)¶
Interface operation failed.
obsolete46 enumerator (FetchErrorCode::obsolete46)¶
Obsolete error code (not used).
tooManyRedirects enumerator (FetchErrorCode::tooManyRedirects)¶
Too many redirects.
unknownOption enumerator (FetchErrorCode::unknownOption)¶
Unknown option specified.
setoptOptionSyntax enumerator (FetchErrorCode::setoptOptionSyntax)¶
Syntax error in setopt option.
obsolete50 enumerator (FetchErrorCode::obsolete50)¶
Obsolete error code (not used).
obsolete51 enumerator (FetchErrorCode::obsolete51)¶
Obsolete error code (not used).
gotNothing enumerator (FetchErrorCode::gotNothing)¶
No data received.
sslEngineNotfound enumerator (FetchErrorCode::sslEngineNotfound)¶
SSL engine not found.
sslEngineSetfailed enumerator (FetchErrorCode::sslEngineSetfailed)¶
Failed to set SSL engine.
sendError enumerator (FetchErrorCode::sendError)¶
Error sending data.
recvError enumerator (FetchErrorCode::recvError)¶
Error receiving data.
obsolete57 enumerator (FetchErrorCode::obsolete57)¶
Obsolete error code (not used).
sslCertproblem enumerator (FetchErrorCode::sslCertproblem)¶
Problem with local certificate.
sslCipher enumerator (FetchErrorCode::sslCipher)¶
Could not use specified SSL cipher.
peerFailedVerification enumerator (FetchErrorCode::peerFailedVerification)¶
Peer certificate verification failed.
badContentEncoding enumerator (FetchErrorCode::badContentEncoding)¶
Unrecognized content encoding.
obsolete62 enumerator (FetchErrorCode::obsolete62)¶
Obsolete error code (not used).
filesizeExceeded enumerator (FetchErrorCode::filesizeExceeded)¶
File size exceeded the maximum allowed.
useSslFailed enumerator (FetchErrorCode::useSslFailed)¶
Failed to use SSL.
sendFailRewind enumerator (FetchErrorCode::sendFailRewind)¶
Failed to rewind and send data.
sslEngineInitfailed enumerator (FetchErrorCode::sslEngineInitfailed)¶
SSL engine initialization failed.
loginDenied enumerator (FetchErrorCode::loginDenied)¶
Login denied (user/password incorrect).
tftpNotfound enumerator (FetchErrorCode::tftpNotfound)¶
TFTP file not found.
tftpPerm enumerator (FetchErrorCode::tftpPerm)¶
TFTP permission denied.
remoteDiskFull enumerator (FetchErrorCode::remoteDiskFull)¶
Remote disk full.
tftpIllegal enumerator (FetchErrorCode::tftpIllegal)¶
Illegal TFTP operation.
tftpUnknownid enumerator (FetchErrorCode::tftpUnknownid)¶
Unknown TFTP transfer ID.
remoteFileExists enumerator (FetchErrorCode::remoteFileExists)¶
Remote file already exists.
tftpNosuchuser enumerator (FetchErrorCode::tftpNosuchuser)¶
No such TFTP user.
obsolete75 enumerator (FetchErrorCode::obsolete75)¶
Obsolete error code (not used).
obsolete76 enumerator (FetchErrorCode::obsolete76)¶
Obsolete error code (not used).
sslCacertBadfile enumerator (FetchErrorCode::sslCacertBadfile)¶
Could not load CA certificate file.
remoteFileNotFound enumerator (FetchErrorCode::remoteFileNotFound)¶
Remote file not found.
ssh enumerator (FetchErrorCode::ssh)¶
SSH layer error.
sslShutdownFailed enumerator (FetchErrorCode::sslShutdownFailed)¶
Failed to shut down SSL connection.
again enumerator (FetchErrorCode::again)¶
Socket is not ready, try again later.
sslCrlBadfile enumerator (FetchErrorCode::sslCrlBadfile)¶
Could not load SSL CRL file.
sslIssuerError enumerator (FetchErrorCode::sslIssuerError)¶
SSL issuer verification failed.
ftpPretFailed enumerator (FetchErrorCode::ftpPretFailed)¶
FTP PRET command failed.
rtspCseqError enumerator (FetchErrorCode::rtspCseqError)¶
RTSP CSeq mismatch.
rtspSessionError enumerator (FetchErrorCode::rtspSessionError)¶
RTSP session ID mismatch.
ftpBadFileList enumerator (FetchErrorCode::ftpBadFileList)¶
FTP file list parsing failed.
chunkFailed enumerator (FetchErrorCode::chunkFailed)¶
Chunk callback error.
noConnectionAvailable enumerator (FetchErrorCode::noConnectionAvailable)¶
No connection available.
sslPinnedpubkeynotmatch enumerator (FetchErrorCode::sslPinnedpubkeynotmatch)¶
Pinned public key did not match.
sslInvalidcertstatus enumerator (FetchErrorCode::sslInvalidcertstatus)¶
Invalid SSL certificate status.
http2Stream enumerator (FetchErrorCode::http2Stream)¶
HTTP/2 stream error.
recursiveApiCall enumerator (FetchErrorCode::recursiveApiCall)¶
API function called recursively.
authError enumerator (FetchErrorCode::authError)¶
Authentication function returned error.
http3 enumerator (FetchErrorCode::http3)¶
HTTP/3 layer problem.
quicConnectError enumerator (FetchErrorCode::quicConnectError)¶
QUIC connection error.
proxy enumerator (FetchErrorCode::proxy)¶
Proxy handshake error.
sslClientcert enumerator (FetchErrorCode::sslClientcert)¶
Client-side certificate required.
unrecoverablePoll enumerator (FetchErrorCode::unrecoverablePoll)¶
Fatal poll/select error.
tooLarge enumerator (FetchErrorCode::tooLarge)¶
Data exceeded its maximum allowed size.
HttpResponse class¶
HttpResponse
Structure representing an HTTP response.
error variable (HttpResponse::error)¶
FetchErrorCode error
Error code indicating the result of the request.
httpCode variable (HttpResponse::httpCode)¶
std::optional<int> httpCode
Optional HTTP response code.
effectiveUrl variable (HttpResponse::effectiveUrl)¶
std::optional<std::string> effectiveUrl
Optional effective URL after redirects.
headers variable (HttpResponse::headers)¶
std::vector<std::string> headers
Response headers.
ok function (HttpResponse::ok)¶
bool ok() const noexcept
Checks if the HTTP response indicates a successful request.
Returns true if the response is successful (HTTP 2xx), false otherwise.
operator bool function (HttpResponse::operator bool)¶
explicit operator bool() const noexcept
Checks if the HTTP response indicates a successful request.
Returns true if the response is successful (HTTP 2xx), false otherwise.
httpFetch function¶
HttpResponse httpFetch(const HttpRequest &request,
Rc<Stream> requestBody,
Rc<Stream> responseBody)
Makes an HTTP request.
Param request The HttpRequest object containing the request details.
Param requestBody The body of the request (if applicable).
Param responseBody The stream to store the response body.
Returns HttpResponse object containing the result of the request.
httpFetchBytes function¶
std::pair<HttpResponse, Bytes>
httpFetchBytes(const HttpRequest &request)
Makes an HTTP request and returns the response body as bytes.
Param request The HttpRequest object containing the request details.
Returns A pair containing the HttpResponse and the response body in bytes.
fetchErrorCodeString function (Internal::fetchErrorCodeString)¶
std::string fetchErrorCodeString(FetchErrorCode code)
Converts a FetchErrorCode to a string representation.
Param code The FetchErrorCode to convert.
Returns A string representing the error code.
Auto-generated from sources, Revision , https://github.com/brisklib/brisk/blob//include/brisk/