This file contains some validator functions that can be used to validate URL parameters.
They covor common cases like checking for integer, non-empty, ..., so the user of this library does not need to write them on his own.
◆ HTTPSMiddlewareFunction typedef void() httpsserver::HTTPSMiddlewareFunction(HTTPRequest *req, HTTPResponse *res, std::function< void()> next)A middleware function that can be registered at the server.
It will be called before an incoming request is passed to any HTTPSCallbackFunction and may perform operations like redirects or authentication.
It receives the request and response object as well as a function pointer ("next") to pass on processing. This allows chaining those functions. If next() is not called, the HTTPSCallbackFunction that would match the request url will not be invoked. This might become handy if you want to intercept request handling in case of missing authentication. Don't forget to call next in case you want to access your resources, though.
◆ HTTPNodeType Enumerator HANDLER_CALLBACKNode with a handler callback function (class ResourceNode)
WEBSOCKETNode with a websocket handler (class WebsocketNode)
◆ SSLKeySizeDefines the key size for key generation.
Not available if the HTTPS_DISABLE_SELFSIGNING
compiler flag is set
RSA key with 1024 bit.
KEYSIZE_2048RSA key with 2048 bit.
KEYSIZE_4096RSA key with 4096 bit.
◆ createSelfSignedCert() int httpsserver::createSelfSignedCert ( SSLCert & certCtx, SSLKeySize keySize, std::string dn, std::string validFrom ="20190101000000"
, std::string validUntil = "20300101000000"
)
Creates a self-signed certificate on the ESP32.
This function creates a new self-signed certificate for the given hostname on the heap. Make sure to clear() it before you delete it.
The distinguished name (dn) parameter has to follow the x509 specifications. An example would be: CN=myesp.local,O=acme,C=US
The strings validFrom and validUntil have to be formatted like this: "20190101000000", "20300101000000"
This will take some time, so you should probably write the certificate data to non-volatile storage when you are done.
Setting the HTTPS_DISABLE_SELFSIGNING
compiler flag will remove this function from the library
Handler function for the websocket handshake. Will be used by HTTPConnection if a websocket is detected
◆ normalizeHeaderName() std::string httpsserver::normalizeHeaderName ( std::string const & name )Normalizes case in header names.
It converts the first letter and every letter after a non-alnum character to uppercase. For example, "content-length" becomes "Content-Length" and "HOST" becomes "Host".
◆ parseUInt() uint32_t httpsserver::parseUInt ( std::string const & s, uint32_t max =0xffffffff
)
Utility function: Parse an unsigned integer from a string
The second parameter can be used to define the maximum value that is acceptable
◆ validateUnsignedInteger() bool httpsserver::validateUnsignedInteger ( std::string s )Built-in validator function: Checks that a value is a positive int
Checks that the value is a positive integer (combine it with newValidateUnsignedIntegerMax if you have constraints regarding the size of that number)
◆ validationMiddleware()Middleware function that handles the validation of parameters
◆ websocketKeyResponseHash() std::string httpsserver::websocketKeyResponseHash ( std::string const & key )Function used to compute the value of the Sec-WebSocket-Accept during Websocket handshake
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4