projects
/
metaproxy-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
001faaf
)
http_file: allow zero size files (bug fix)
author
Adam Dickmeiss
<adam@indexdata.dk>
Wed, 22 Aug 2012 08:28:51 +0000
(10:28 +0200)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Wed, 22 Aug 2012 08:29:17 +0000
(10:29 +0200)
src/filter_http_file.cpp
patch
|
blob
|
history
diff --git
a/src/filter_http_file.cpp
b/src/filter_http_file.cpp
index
d036433
..
25ad1b9
100644
(file)
--- a/
src/filter_http_file.cpp
+++ b/
src/filter_http_file.cpp
@@
-158,15
+158,17
@@
void yf::HttpFile::Rep::fetch_file(mp::Session &session,
Z_HTTP_Response *hres = gdu->u.HTTP_Response;
hres->content_len = sz;
Z_HTTP_Response *hres = gdu->u.HTTP_Response;
hres->content_len = sz;
- hres->content_buf = (char*) odr_malloc(o, hres->content_len);
- if (fread(hres->content_buf, hres->content_len, 1, f) != 1)
+ if (hres->content_len > 0)
{
{
- fclose(f);
- Z_GDU *gdu = o.create_HTTP_Response(session, req, 500);
- package.response() = gdu;
- return;
+ hres->content_buf = (char*) odr_malloc(o, hres->content_len);
+ 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);
std::string content_type = get_mime_type(fname);
fclose(f);
std::string content_type = get_mime_type(fname);