Date in HTTP header Date incorrect?

1

After an HTTP request to a REST api I receive the following header

HTTP/1.1 200 OK
Server: RestDriver POST/1.0
Date: mer, 10 gen 2018 13:20:34  GMT

The time of my system, being "01:00 GMT", indicated to me 13:20:34

Is the Date header invalid?

    
asked by El_hazedor 10.01.2018 в 13:29
source

1 answer

1

The header NO is incorrect because it gives the incorrect time, it simply indicates that the server does not have the date / time set correctly. Date has to deliver server time , which is not necessarily going to be approximate to yours. The importance of Date is mainly to calculate other values delivered, for example in Expires , where the date and time in which the content and / or the cache should expire (and is related to the date / time of the server, not the client's) is indicated.

But YES is incorrect because:

  • It's in Italian ( ICU Locale "Italian" (it) , when it should be in English [1] .
  • You have 2 spaces between the time and GMT , when you should have 1 only.
  • The day of the week and the month should start with a capital letter (although it is already bad in Italian).

  • The Date header is defined by the RFC 2616 ,
    using the format defined in section 3.3 (Date / Time Formats) as acceptable:

    Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123
    Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
    Sun Nov  6 08:49:37 1994       ; ANSI C's asctime() format
    

    and states that MUST send only in the first format:

     rfc1123-date = wkday "," SP date1 SP time SP "GMT"
     date1        = 2DIGIT SP month SP 4DIGIT
                    ; day month year (e.g., 02 Jun 1982)
     time         = 2DIGIT ":" 2DIGIT ":" 2DIGIT
                    ; 00:00:00 - 23:59:59
     wkday        = "Mon" | "Tue" | "Wed"
                  | "Thu" | "Fri" | "Sat" | "Sun"
     month        = "Jan" | "Feb" | "Mar" | "Apr"
                  | "May" | "Jun" | "Jul" | "Aug"
                  | "Sep" | "Oct" | "Nov" | "Dec"
    
    • Must be sent in English.


    Correct example:

    Date: Tue, 30 Jan 2017 15:10:20 GMT
    


    [1]: Headers - Date (MDN )
    [2]: RFC 2616, sec 14.18 - Date (w3.org)
    [3]: RFC 2616, sec 3.3 - Date / Time Formats (w3.org)

        
    answered by 30.01.2018 / 16:10
    source