Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve HTTPError reporting #7

Open
manelclos opened this issue Oct 22, 2014 · 6 comments
Open

improve HTTPError reporting #7

manelclos opened this issue Oct 22, 2014 · 6 comments

Comments

@manelclos
Copy link
Contributor

from the mailing list:

It looks (403: Forbidden) Tilecache does not have permissions to access the url you wrote in the configuration. Can you access that url?


De: tilecache-bounces at lists.osgeo.org [mailto:tilecache-bounces at lists.osgeo.org] En nombre de Balazs Szabó
Enviado el: miércoles, 15 de junio de 2011 11:13
Para: tilecache at lists.osgeo.org
Asunto: [Tilecache] cgi problem

Hi List!

I installed tilecache on ubuntu with apache web server (sudo apt-get install tilecache) , but when I hit this link http://localhost/cgi-bin/tilecache.cgi/1.0.0/basic/0/0/0.png

I got the following error:

An error occurred: HTTP Error 403: Forbidden
File "/usr/lib/pymodules/python2.7/TileCache/Service.py", line 343, in cgiHandler
format, image = service.dispatchRequest( params, path_info, req_method, host )
File "/usr/lib/pymodules/python2.7/TileCache/Service.py", line 208, in dispatchRequest
return self.renderTile(tile, params.has_key('FORCE'))
File "/usr/lib/pymodules/python2.7/TileCache/Service.py", line 138, in renderTile
data = layer.render(tile, force=force)
File "/usr/lib/pymodules/python2.7/TileCache/Layer.py", line 444, in render
return self.renderTile(tile)
File "/usr/lib/pymodules/python2.7/TileCache/Layers/WMS.py", line 29, in renderTile
tile.data, response = wms.fetch()
File "/usr/lib/pymodules/python2.7/TileCache/Client.py", line 59, in fetch
response = self.client.open(urlrequest)
File "/usr/lib/python2.7/urllib2.py", line 397, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 510, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 435, in error
return self._call_chain(_args)
File "/usr/lib/python2.7/urllib2.py", line 369, in _call_chain
result = func(_args)
File "/usr/lib/python2.7/urllib2.py", line 518, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)

@Styp
Copy link

Styp commented Nov 11, 2014

This does not look like an TileCache error.
It is rather a problem in your server environment.

Do you have read and write access on the directory you are using for chaching the tiles?
Are you running it in cgi mode? Is your Apache configured correctly?

@manelclos
Copy link
Contributor Author

Hi Styp,

The issue is about improving the reported information when it happens. Right now it is only the error and the backtrace, which gives poor information:

An error occurred: HTTP Error 403: Forbidden

I suggest changing this to: An error occurred trying to contact/fetch the URL: http://... (complete url with params), the error was: HTTP Error 403: Forbidden

What do you think?

@winkey
Copy link
Contributor

winkey commented Nov 11, 2014

once conern i have here is since you installed with apt-get likely that is a old copy since there has not been a release in quite awhile

@manelclos
Copy link
Contributor Author

Ok, I'll test with current code and report. Thanks!

@manelclos
Copy link
Contributor Author

Hi, cloned current repository.

Run wms server with: uwsgi --http :9090 --wsgi-file wsgi.py
wsgi.py code:

def application(env, start_response):
    start_response('403 Forbidden', [('Content-Type','text/html')])
    return ["User/pass required"]

tilecache.cfg changed to:

[basic]
type=WMS
url=http://localhost:9090/wms/vmap0
extension=png

run from repository using: python tilecache_http_server.py

browser request: http://localhost:8080/1.0.0/basic/0/0/0.png

browser result:
An error occurred: HTTP Error 403: Forbidden
File "/vagrant/test-pil/tilecache/tilecache/TileCache/Service.py", line 516, in wsgiHandler
format, image = service.dispatchRequest( fields, path_info, req_method, host )
File "/vagrant/test-pil/tilecache/tilecache/TileCache/Service.py", line 356, in dispatchRequest
return self.renderTile(tile, params.has_key('FORCE'))
File "/vagrant/test-pil/tilecache/tilecache/TileCache/Service.py", line 261, in renderTile
data = layer.render(tile, force=force)
File "/vagrant/test-pil/tilecache/tilecache/TileCache/Layer.py", line 836, in render
return self.renderTile(tile)
File "/vagrant/test-pil/tilecache/tilecache/TileCache/Layers/WMS.py", line 29, in renderTile
tile.data, response = wms.fetch()
File "/vagrant/test-pil/tilecache/tilecache/TileCache/Client.py", line 59, in fetch
response = self.client.open(urlrequest)
File "/usr/lib/python2.7/urllib2.py", line 410, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 448, in error
return self._call_chain(_args)
File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(_args)
File "/usr/lib/python2.7/urllib2.py", line 531, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)

@winkey
Copy link
Contributor

winkey commented Nov 11, 2014

yes it would make sense to catch that error and return the info avaailable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants