pquerna / cachecontrol

Golang HTTP Cache-Control Parser and Interpretation
Apache License 2.0
138 stars 17 forks source link

Comment about bad Expires header doesn't match semantics #10

Open glasser opened 6 years ago

glasser commented 6 years ago

The code reads:

    if respHeaders.Get("Expires") != "" {
        expiresHeader, err = http.ParseTime(respHeaders.Get("Expires"))
        if err != nil {
            // sometimes servers will return `Expires: 0` or `Expires: -1` to
            // indicate expired content
            expiresHeader = time.Time{}
        }
        expiresHeader = expiresHeader.UTC()
    }

The comment says that Expires:0 or Expires:-1 means expired content. But the code doesn't treat it any differently than no Expires header.