HI !
For what it's worth, Specto actually already uses this, I *think*. In the 0.2.2 
series, if you look at the code in watch_web_static.py, you can see in lines 
109-121:

        if (self.cached == 1) or (os.path.exists(self.cacheFullPath_)):
            self.cached = 1
            f = file(self.cacheFullPath_, "r")# Load up the cached version
            self.infoB_ = HTTPMessage(f)
            if self.infoB_.has_key('last-modified'):
                request.add_header("If-Modified-Since", 
self.infoB_['last-modified'])
            if self.infoB_.has_key('ETag'):
                request.add_header("If-None-Match", self.infoB_['ETag'])
        try:
            response = urllib2.urlopen(request)
        except (urllib2.URLError, BadStatusLine), e:
            self.error = True
            self.specto.logger.log(_("Watch: \"%s\" has error: ") % self.name + 
str(e), "error", self.__class__)


However,
- the code might not be elegant
- the code/logic might be wrong (after all, I took a long time doing it and I'm 
not sure I did it properly)

I don't know if that is conforming to your suggestions, or if you meant that
- some piece is missing?
- something is not working properly?

Also, I think the etag headers may not work properly with websites that
use advertising/dynamic content, so, if I remember correctly my own
code, the "error margin" (difference percentage based on file sizes)
would override it.

-- 
Web monitor should use modified headers
https://bugs.launchpad.net/bugs/202243
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to