Function esp_idf_svc::sys::httpd_query_key_value

source ·
pub unsafe extern "C" fn httpd_query_key_value(
    qry: *const i8,
    key: *const i8,
    val: *mut i8,
    val_size: usize,
) -> i32
Expand description

@brief Helper function to get a URL query tag from a query string of the type param1=val1&param2=val2

@note

  • The components of URL query string (keys and values) are not URLdecoded. The user must check for ‘Content-Type’ field in the request headers and then depending upon the specified encoding (URLencoded or otherwise) apply the appropriate decoding algorithm.
  • If actual value size is greater than val_size, then the value is truncated, accompanied by truncation error as return value.

@param[in] qry Pointer to query string @param[in] key The key to be searched in the query string @param[out] val Pointer to the buffer into which the value will be copied if the key is found @param[in] val_size Size of the user buffer “val”

@return

  • ESP_OK : Key is found in the URL query string and copied to buffer
  • ESP_ERR_NOT_FOUND : Key not found
  • ESP_ERR_INVALID_ARG : Null arguments
  • ESP_ERR_HTTPD_RESULT_TRUNC : Value string truncated