/* This file is part of Metaproxy.
- Copyright (C) 2005-2008 Index Data
+ Copyright (C) 2005-2010 Index Data
Metaproxy is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
*/
#include "config.hpp"
-#include "filter.hpp"
-#include "package.hpp"
-#include "util.hpp"
+#include <metaproxy/filter.hpp>
+#include <metaproxy/package.hpp>
+#include <metaproxy/util.hpp>
#include "filter_http_file.hpp"
#include <yaz/zgdu.h>
Z_HTTP_Response *hres = gdu->u.HTTP_Response;
hres->content_len = sz;
hres->content_buf = (char*) odr_malloc(o, hres->content_len);
- fread(hres->content_buf, 1, hres->content_len, f);
+ if (fread(hres->content_buf, hres->content_len, 1, f) != 1)
+ {
+ fclose(f);
+ Z_GDU *gdu = o.create_HTTP_Response(session, req, 500);
+ package.response() = gdu;
+ return;
+ }
fclose(f);