pydap server returning Content-length header of type numpy.int64

3 views
Skip to first unread message

Stephen Pascoe

unread,
Nov 13, 2009, 11:32:35 AM11/13/09
to pydap, philip....@stfc.ac.uk
Hi Roberto,

We have found a problem when running Pydap-3.0.rc.7 inside mod_wsgi.
Any dods response gives an error:

Exception occurred processing WSGI script '/srv/www/
wsgi_scripts_public/dap.wsgi'.
TypeError: expected string object for header value

Investigation shows this is caused by the wsgi start_response function
being sent a 'Content-length' header value of type <numpy.int74>.
Setting up simple response logging showed this:

('RESPONSE',
'200 OK',
[('XDODS-Server', 'dods/2.0', <type 'str'>),
('Content-description', 'dods_data', <type 'str'>),
('Content-type', 'application/octet-stream', <type 'str'>),
('Content-length', 5463272, <type 'numpy.int64'>)])

This problem only affects DODS responses so it took us a while to spot
it.

Cheers,
Stephen Pascoe.

Stephen Pascoe

unread,
Nov 13, 2009, 11:38:00 AM11/13/09
to pydap
We have implemented a temporary fix with a middleware filter:

class HeaderFixMiddleware:
def __init__(self, application):
self.__application = application

def __call__(self, environ, start_response):
def _start_response(status, headers, exc_info=None):
fixed_headers = [(name, str(value)) for name, value in
headers]
return start_response(status, fixed_headers, exc_info)

return self.__application(environ, _start_response)


Stephen Pascoe.

Roberto De Almeida

unread,
Nov 19, 2009, 6:22:11 AM11/19/09
to py...@googlegroups.com
Hi, Stephen!

This has been fixed in the latest version (rc8).

Thanks,
--Rob


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "pydap" group.
To post to this group, send email to py...@googlegroups.com
To unsubscribe from this group, send email to pydap+un...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/pydap?hl=en
-~----------~----~----~----~------~----~------~--~---




--
Dr. Roberto De Almeida
http://dealmeida.net/
http://lattes.cnpq.br/1858859813771449
:wq

Reply all
Reply to author
Forward
0 new messages