main/httpd.c
static esp_err_t read_request_payload(httpd_req_t * req, char * buf, size_t buf_len)
{
    size_t remaining = (req->content_len < buf_len ? req->content_len : buf_len - 1 );
    while ( remaining > 0 ) {
        int recv_cnt = httpd_req_recv(req, buf, remaining);
        if ( recv_cnt <= 0 ) {
            if ( recv_cnt == HTTPD_SOCK_ERR_TIMEOUT ) {
                continue;
            }
            return ESP_FAIL;
        }
        remaining -= recv_cnt;
        buf += recv_cnt;
    }
    *buf = '\0';
    return ESP_OK;
}
/**
 * Reads request payload into the provided buffer.
 *
 * @param req HTTP request
 * @param buf pointer to the data buffer
 * @param buf_lem size of the buffer
 */
Reads request payload into the provided buffer.
@param req HTTP request
@param buf pointer to the data buffer
@param buf_lem size of the buffer
Reads request payload into the provided buffer . @param req HTTP request @param buf pointer to the data buffer @param buf_lem size of the buffer
static esp_err_t read_request_payload(httpd_req_t * req, char * buf, size_t buf_len)
{
    size_t remaining = (req->content_len < buf_len ? req->content_len : buf_len - 1 );
    while ( remaining > 0 ) {
        int recv_cnt = httpd_req_recv(req, buf, remaining);
        if ( recv_cnt <= 0 ) {
            if ( recv_cnt == HTTPD_SOCK_ERR_TIMEOUT ) {
                continue;
            }
            return ESP_FAIL;
        }
        remaining -= recv_cnt;
        buf += recv_cnt;
    }
    *buf = '\0';
    return ESP_OK;
}
static esp_err_t read_request_payload ( httpd_req_t * req , char * buf , size_t buf_len ) { size_t remaining = ( req -> content_len < buf_len ? req -> content_len : buf_len - 1 ) ; while ( remaining > 0 ) { int recv_cnt = httpd_req_recv ( req , buf , remaining ) ; if ( recv_cnt <= 0 ) { if ( recv_cnt == HTTPD_SOCK_ERR_TIMEOUT ) { continue ; } return ESP_FAIL ; } remaining -= recv_cnt ; buf += recv_cnt ; } * buf = ' \0 ' ; return ESP_OK ; }
Reads request payload into the provided buffer.
Reads request payload into the provided buffer .