yaocaigen / httplib2

Automatically exported from code.google.com/p/httplib2
0 stars 0 forks source link

Crash depending on cache name and url #244

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
http = httplib2.Http("foobar")
http.request("https://api.facebook.com/method/fql.query?format=json&query=SELECT
+total_count+FROM+link_stat+WHERE+url%3D%22http%3A%2F%2Ffin.foobar.com%2Fuutiset
%2Fartikkeli.cfm%2F2011%2F08%2F20%2Ffacebookin_tykkaa-painike_saksan_lakia%22")

What is the expected output? What do you see instead?
Response, but instead:
File "__init__.py", line 1272, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "__init__.py", line 1084, in _request
    _updateCache(headers, response, content, self.cache, cachekey)
  File "__init__.py", line 397, in _updateCache
    cache.set(cachekey, text)
  File "__init__.py", line 687, in set
    f = open(cacheFullPath, "wb")
FileNotFoundError: [Errno 2] No such file or directory: 
'foobar\\api.facebook.com,method,fql.query,format=json&query=SELECT+total_count+
FROM+link_stat+WHERE+url%3D%22http%3A%2F%2Ffin.foobar.com%2Fuutiset%2Fartikkeli.
cfm%2F2011%2F08%2F2
0%2Ffacebookin_tykkaa-painike_,6a66abb64877560a53008cb0f7ffd354'

What version of the product are you using? On what operating system?
Windows XP with Python 3.3 and httplib2 0.7.7.

Please provide any additional information below.
No problems if no cache is used or the name of cache is shorter like "foo".

Original issue reported on code.google.com by fbe...@gmail.com on 24 Jan 2013 at 11:37

Attachments:

GoogleCodeExporter commented 9 years ago
You should probably provide a different implementation of 'safe':

http://httplib2.googlecode.com/hg/doc/html/libhttplib2.html#httplib2.FileCache

Original comment by joe.gregorio@gmail.com on 7 Mar 2013 at 2:50