mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-09-17 20:24:24 +00:00
httpd: get_http_headers: refactor decision for add_content_len
This commit is contained in:
parent
1a75112b47
commit
ea2e628ac3
@ -918,7 +918,6 @@ get_http_headers(struct http_state *hs, const char *uri)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* LWIP_HTTPD_OMIT_HEADER_FOR_EXTENSIONLESS_URI */
|
#endif /* LWIP_HTTPD_OMIT_HEADER_FOR_EXTENSIONLESS_URI */
|
||||||
add_content_len = 1;
|
|
||||||
/* Did we find a matching extension? */
|
/* Did we find a matching extension? */
|
||||||
if (content_type < NUM_HTTP_HEADERS) {
|
if (content_type < NUM_HTTP_HEADERS) {
|
||||||
/* yes, store it */
|
/* yes, store it */
|
||||||
@ -931,15 +930,15 @@ get_http_headers(struct http_state *hs, const char *uri)
|
|||||||
hs->hdrs[HDR_STRINGS_IDX_CONTENT_TYPE] = HTTP_HDR_DEFAULT_TYPE;
|
hs->hdrs[HDR_STRINGS_IDX_CONTENT_TYPE] = HTTP_HDR_DEFAULT_TYPE;
|
||||||
}
|
}
|
||||||
/* Add content-length header? */
|
/* Add content-length header? */
|
||||||
|
add_content_len = 0;
|
||||||
#if LWIP_HTTPD_SSI
|
#if LWIP_HTTPD_SSI
|
||||||
if (hs->ssi != NULL) {
|
if (hs->ssi == NULL) /* @todo: get maximum file length from SSI */
|
||||||
add_content_len = 0; /* @todo: get maximum file length from SSI */
|
|
||||||
} else
|
|
||||||
#endif /* LWIP_HTTPD_SSI */
|
#endif /* LWIP_HTTPD_SSI */
|
||||||
if ((hs->handle == NULL) ||
|
{
|
||||||
((hs->handle->flags & FS_FILE_FLAGS_HEADER_PERSISTENT) == 0)) {
|
if ((hs->handle != NULL) && (hs->handle->flags & FS_FILE_FLAGS_HEADER_PERSISTENT)) {
|
||||||
add_content_len = 0;
|
add_content_len = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (add_content_len) {
|
if (add_content_len) {
|
||||||
size_t len;
|
size_t len;
|
||||||
lwip_itoa(hs->hdr_content_len, (size_t)LWIP_HTTPD_MAX_CONTENT_LEN_SIZE,
|
lwip_itoa(hs->hdr_content_len, (size_t)LWIP_HTTPD_MAX_CONTENT_LEN_SIZE,
|
||||||
|
Loading…
Reference in New Issue
Block a user