Problem
This issue is not limited to Google servers; my client has the same issue with the majority of HTTP servers.
I use a few frameworks to send HTTP requests to Google. There is only curl, but it applies to all frameworks.
curl -i --http1.1 https://www.google.com
I received two interesting headers that we should discuss. I changed unused values in the headers to "*" to better focus on the problem.
Date: Wed, 25 Jan 2023 13:45:10 GMT
Set-Cookie:**********; expires=Fri, 24-Feb-2023 13:45:10 GMT; ************************
As you can see, we got two different date and time formats from the set-cookie
header and the date
header.
There is also an HTTP status line, which informs us that the server response is HTTP/1.1.
HTTP/1.1 200 OK
I read rfc 7231 in order to better understand which format is correct. This is what I discovered in the section "7.1.1.1 Date/Time Formats."
Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content RFC 7231
7.1.1.1. Date/Time Formats
Content:
Prior to 1995, there were three different formats commonly used by servers to communicate timestamps. For compatibility with old implementations, all three are defined here. The preferred format is a fixed-length and single-zone subset of the date and time specification used by the Internet Message Format [RFC5322].
HTTP-date = IMF-fixdate / obs-date
An example of the preferred format is
Sun, 06 Nov 1994 08:49:37 GMT ; IMF-fixdate
Examples of the two obsolete formats are
Sunday, 06-Nov-94 08:49:37 GMT ; obsolete RFC 850 format Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
A recipient that parses a timestamp value in an HTTP header field MUST accept all three HTTP-date formats. When a sender generates a header field that contains one or more timestamps defined as HTTP-date, the sender MUST generate those timestamps in the IMF-fixdate format.
My HTTP client supports all three formats, but when I try to parse the Google response, I get an error because Google sends set-cookies with the attribute 'Expires' that do not match any of these formats.
Results
I received datetime text "Fri, 24-Feb-2023 13:45:10 GMT" from the google
However, rfc informed us that our client should only parse three formats.
Sunday, 06-Nov-94 08:49:37 GMT
Sun Nov 6 08:49:37 1994
Sun, 06 Nov 1994 08:49:37 GMT
Nothing from this list does match with google's format.
Is it possible that I misunderstood something or that the RFC is simply ignored?
I tried to find information about the format used by the majority of http servers, but nothing came up.