http_server疑问

tommy.guo
Posts: 24
Joined: Mon Feb 14, 2022 8:09 am

http_server疑问

Postby tommy.guo » Fri Jun 17, 2022 3:07 pm

file_server示例中有一段代码

Code: Select all

* Handler to respond with an icon file embedded in flash.
 * Browsers expect to GET website icon at URI /favicon.ico.
 * This can be overridden by uploading file with same name */
static esp_err_t favicon_get_handler(httpd_req_t *req)
{
	extern const unsigned char favicon_ico_start[] asm("_binary_favicon_ico_start");
	extern const unsigned char favicon_ico_end[] asm("_binary_favicon_ico_end");
	const size_t favicon_ico_size = (favicon_ico_end - favicon_ico_start);
	httpd_resp_set_type(req, "image/x-icon");
	httpd_resp_send(req, (const char *)favicon_ico_start, favicon_ico_size);
	return ESP_OK;
}
将favicon_get_handler有关的代码全部删除,且没有注册/favicon_ico这个uri,但是访问服务器时还是会报

Code: Select all

W (327372) httpd_uri: httpd_uri: uri handler execution failed
W (327382) httpd_uri: httpd_uri: URI '/favicon.ico' not found
这是为什么呢?

tommy.guo
Posts: 24
Joined: Mon Feb 14, 2022 8:09 am

Re: http_server疑问

Postby tommy.guo » Fri Jun 17, 2022 3:10 pm

将项目fullclean之后,还是会有这个warning,但是将static esp_err_t favicon_get_handler(httpd_req_t *req)屏蔽之后,再编译下载就没有了,没想明白

Who is online

Users browsing this forum: No registered users and 57 guests