}
/* Keep URI with terminating null character. Note URI string pointed
- * by 'at' is not NULL terminated, therfore use length provided by
+ * by 'at' is not NULL terminated, therefore use length provided by
* parser while copying the URI to buffer */
strlcpy((char *)r->uri, at, (length + 1));
ESP_LOGD(TAG, LOG_FMT("received URI = %s"), r->uri);
return ESP_FAIL;
}
- /* In absence of body/chunked enoding, http_parser sets content_len to -1 */
+ /* In absence of body/chunked encoding, http_parser sets content_len to -1 */
r->content_len = ((int)parser->content_length != -1 ?
parser->content_length : 0);
}
/* Receive data into buffer. If data is pending (from unrecv) then return
- * immediatly after receiving pending data, as pending data may just complete
+ * immediately after receiving pending data, as pending data may just complete
* this request packet. */
int nbytes = httpd_recv_with_opt(req, raux->scratch + offset, buf_len, true);
if (nbytes < 0) {
ESP_LOGD(TAG, LOG_FMT("error in httpd_recv"));
- /* Connection error. Notify Timeout in all cases.
- * Need some way to check errno for ETIMEDOUT. */
- httpd_resp_send_err(req, HTTPD_408_REQ_TIMEOUT);
+ if (nbytes == HTTPD_SOCK_ERR_TIMEOUT) {
+ httpd_resp_send_err(req, HTTPD_408_REQ_TIMEOUT);
+ }
return -1;
} else if (nbytes == 0) {
ESP_LOGD(TAG, LOG_FMT("connection closed"));
http_parser parser;
parser_data_t parser_data;
- /* Initilaize parser */
+ /* Initialize parser */
parse_init(r, &parser, &parser_data);
/* Set offset to start of scratch buffer */