X-Git-Url: http://git.kaliko.me/?a=blobdiff_plain;f=sima%2Flib%2Fhttp.py;h=8c6dab1bde94a1d9cea5d7fd74eaa13a133deb9d;hb=bec6761572dc942c0772f955b6a84273e2754c6e;hp=0c1b3968d90ce31bfcb13fbadd4c948c22d2289a;hpb=7d24f8a6f0bb74de07c3e6d333a2948d9186be1b;p=mpd-sima.git diff --git a/sima/lib/http.py b/sima/lib/http.py index 0c1b396..8c6dab1 100644 --- a/sima/lib/http.py +++ b/sima/lib/http.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2014 Jack Kaliko +# Copyright (c) 2014-2015 Jack Kaliko # Copyright (c) 2012, 2013 Eric Larson # # This program is free software: you can redistribute it and/or modify @@ -190,12 +190,6 @@ class CacheController(object): # return the original handler return False - def add_headers(self, url): - resp = self.cache.get(url) - if resp and 'etag' in resp.headers: - return {'If-None-Match': resp.headers['etag']} - return {} - def cache_response(self, request, resp): """ Algorithm for caching requests. @@ -301,7 +295,8 @@ class HttpClient: def fetch_ws(self, prepreq): """fetch from web service""" sess = Session() - resp = sess.send(prepreq, timeout=SOCKET_TIMEOUT) + settings = sess.merge_environment_settings(prepreq.url, {}, None, False, None) + resp = sess.send(prepreq, timeout=SOCKET_TIMEOUT, **settings) if resp.status_code == 304: self.stats.update(etag=self.stats.get('etag')+1) resp = self.controller.update_cached_response(prepreq, resp)