mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 20:54:32 +02:00
Merge branch 'feature/http_error_code' into 'master'
Feature/support 401, 403 response error code for HTTP server Closes IDFGH-3511 See merge request espressif/esp-idf!11473
This commit is contained in:
@@ -540,6 +540,17 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
HTTPD_400_BAD_REQUEST,
|
HTTPD_400_BAD_REQUEST,
|
||||||
|
|
||||||
|
/* This response means the client must authenticate itself
|
||||||
|
* to get the requested response.
|
||||||
|
*/
|
||||||
|
HTTPD_401_UNAUTHORIZED,
|
||||||
|
|
||||||
|
/* The client does not have access rights to the content,
|
||||||
|
* so the server is refusing to give the requested resource.
|
||||||
|
* Unlike 401, the client's identity is known to the server.
|
||||||
|
*/
|
||||||
|
HTTPD_403_FORBIDDEN,
|
||||||
|
|
||||||
/* When requested URI is not found */
|
/* When requested URI is not found */
|
||||||
HTTPD_404_NOT_FOUND,
|
HTTPD_404_NOT_FOUND,
|
||||||
|
|
||||||
|
@@ -399,6 +399,14 @@ esp_err_t httpd_resp_send_err(httpd_req_t *req, httpd_err_code_t error, const ch
|
|||||||
status = "400 Bad Request";
|
status = "400 Bad Request";
|
||||||
msg = "Server unable to understand request due to invalid syntax";
|
msg = "Server unable to understand request due to invalid syntax";
|
||||||
break;
|
break;
|
||||||
|
case HTTPD_401_UNAUTHORIZED:
|
||||||
|
status = "401 Unauthorized";
|
||||||
|
msg = "Server known the client's identify and it must authenticate itself to get he requested response";
|
||||||
|
break;
|
||||||
|
case HTTPD_403_FORBIDDEN:
|
||||||
|
status = "403 Forbidden";
|
||||||
|
msg = "Server is refusing to give the requested resource to the client";
|
||||||
|
break;
|
||||||
case HTTPD_404_NOT_FOUND:
|
case HTTPD_404_NOT_FOUND:
|
||||||
status = "404 Not Found";
|
status = "404 Not Found";
|
||||||
msg = "This URI does not exist";
|
msg = "This URI does not exist";
|
||||||
|
Reference in New Issue
Block a user