Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Sming/Components/Network/src/Network/Http/HttpHeaderFields.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
"Precondition check using ETag to avoid accidental overwrites when servicing multiple user requests. Ensures " \
"resource entity tag matches before proceeding.") \
XX(IF_MODIFIED_SINCE, "If-Modified-Since", 0, "Precondition check using Date") \
XX(IF_NONE_MATCH, "If-None-Match", 0, \
"Precondition check using ETag for cache revalidation. Used by GET/HEAD requests to avoid re-fetching a " \
"resource which has not changed.") \
XX(LAST_MODIFIED, "Last-Modified", 0, "Server timestamp indicating date and time resource was last modified") \
XX(LOCATION, "Location", 0, "Used in redirect responses, amongst other places") \
XX(SEC_WEBSOCKET_ACCEPT, "Sec-WebSocket-Accept", 0, "Server response to opening Websocket handshake") \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ void HttpServerConnection::sendResponseHeaders(HttpResponse* response)
}
}

if(request.headers.contains(HTTP_HEADER_IF_MATCH) && response->headers.contains(HTTP_HEADER_ETAG) &&
request.headers[HTTP_HEADER_IF_MATCH] == response->headers[HTTP_HEADER_ETAG]) {
if(request.headers.contains(HTTP_HEADER_IF_NONE_MATCH) && response->headers.contains(HTTP_HEADER_ETAG) &&
request.headers[HTTP_HEADER_IF_NONE_MATCH] == response->headers[HTTP_HEADER_ETAG]) {
if(request.method == HTTP_GET || request.method == HTTP_HEAD) {
response->code = HTTP_STATUS_NOT_MODIFIED;
response->headers[HTTP_HEADER_CONTENT_LENGTH] = "0";
Expand Down
Loading