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