X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Ffilter_http_file.cpp;h=00fab9e07c4620f4f336e384d75a0aadfe78fa27;hb=07b0324389f2df1e3ed5060031aef5bb4c756444;hp=10204f421b3b5e39dd8b876d2b1af370acc6c275;hpb=665559cbc22546e8df69be33a7d492294cab9fb1;p=metaproxy-moved-to-github.git diff --git a/src/filter_http_file.cpp b/src/filter_http_file.cpp index 10204f4..00fab9e 100644 --- a/src/filter_http_file.cpp +++ b/src/filter_http_file.cpp @@ -1,5 +1,5 @@ /* This file is part of Metaproxy. - Copyright (C) 2005-2008 Index Data + Copyright (C) 2005-2009 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 @@ -158,7 +158,13 @@ void yf::HttpFile::Rep::fetch_file(mp::Session &session, 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, 1, hres->content_len, f) != 1) + { + fclose(f); + Z_GDU *gdu = o.create_HTTP_Response(session, req, 500); + package.response() = gdu; + return; + } fclose(f);