httpd_resp_send: use HTTPD_RESP_USE_STRLEN when possible

This commit is contained in:
sU8U7SfkcwTJVH7PjaVmej7D
2020-05-11 10:34:24 +02:00
committed by bot
parent f29370b02c
commit 6673407f98
8 changed files with 23 additions and 23 deletions
@@ -1047,7 +1047,7 @@ esp_err_t httpd_resp_send_chunk(httpd_req_t *r, const char *buf, ssize_t buf_len
* - ESP_ERR_HTTPD_INVALID_REQ : Invalid request
*/
static inline esp_err_t httpd_resp_sendstr(httpd_req_t *r, const char *str) {
return httpd_resp_send(r, str, (str == NULL) ? 0 : strlen(str));
return httpd_resp_send(r, str, (str == NULL) ? 0 : HTTPD_RESP_USE_STRLEN);
}
/**
@@ -1068,7 +1068,7 @@ static inline esp_err_t httpd_resp_sendstr(httpd_req_t *r, const char *str) {
* - ESP_ERR_HTTPD_INVALID_REQ : Invalid request
*/
static inline esp_err_t httpd_resp_sendstr_chunk(httpd_req_t *r, const char *str) {
return httpd_resp_send_chunk(r, str, (str == NULL) ? 0 : strlen(str));
return httpd_resp_send_chunk(r, str, (str == NULL) ? 0 : HTTPD_RESP_USE_STRLEN);
}
/* Some commonly used status codes */
+1 -1
View File
@@ -451,7 +451,7 @@ esp_err_t httpd_resp_send_err(httpd_req_t *req, httpd_err_code_t error, const ch
#endif
/* Send HTTP error message */
ret = httpd_resp_send(req, msg, strlen(msg));
ret = httpd_resp_send(req, msg, HTTPD_RESP_USE_STRLEN);
#ifdef CONFIG_HTTPD_ERR_RESP_NO_DELAY
/* If TCP_NODELAY was set successfully above, time to disable it */