+ sb = os.fstat(self.fp.fileno())
+ if self.cachable and sb and sb.st_mtime != 0:
+ if "If-Modified-Since" in req.ihead:
+ rtime = proto.phttpdate(req.ihead["If-Modified-Since"])
+ if rtime is not None and rtime >= math.floor(sb.st_mtime):
+ raise unmodified()
+ req.ohead["Last-Modified"] = proto.httpdate(sb.st_mtime)
+ ctype = self.ctype
+ if self.charset is not None:
+ ctype += "; charset=%s" % (self.charset)
+ req.ohead["Content-Type"] = ctype
+ if sb and sb.st_size > 0:
+ req.ohead["Content-Length"] = str(sb.st_size)