Home | History | Annotate | Download | only in http

Lines Matching full:modtime

105 // If modtime is not the zero time or Unix epoch, ServeContent
108 // modtime to decide whether the content needs to be sent at all.
117 func ServeContent(w ResponseWriter, req *Request, name string, modtime time.Time, content io.ReadSeeker) {
129 serveContent(w, req, name, modtime, sizeFunc, content)
139 // if modtime.IsZero(), modtime is unknown.
142 func serveContent(w ResponseWriter, r *Request, name string, modtime time.Time, sizeFunc func() (int64, error), content io.ReadSeeker) {
143 if checkLastModified(w, r, modtime) {
146 rangeReq, done := checkETag(w, r, modtime)
263 // modtime is the modification time of the resource to be served, or IsZero().
265 func checkLastModified(w ResponseWriter, r *Request, modtime time.Time) bool {
266 if modtime.IsZero() || modtime.Equal(unixEpochTime) {
267 // If the file doesn't have a modtime (IsZero), or the modtime
275 if t, err := time.Parse(TimeFormat, r.Header.Get("If-Modified-Since")); err == nil && modtime.Before(t.Add(1*time.Second)) {
282 w.Header().Set("Last-Modified", modtime.UTC().Format(TimeFormat))
288 // The ETag or modtime must have been previously set in the
289 // ResponseWriter's headers. The modtime is only compared at second
294 func checkETag(w ResponseWriter, r *Request, modtime time.Time) (rangeReq string, done bool) {
306 // the modtime date. See golang.org/issue/8367.
308 if !modtime.IsZero() {
309 if t, err := ParseTime(ir); err == nil && t.Unix() == modtime.Unix() {
408 if checkLastModified(w, r, d.ModTime()) {
417 serveContent(w, r, d.Name(), d.ModTime(), sizeFunc, f)