added proper filename in web responses
Costa Tsaousis (ktsaou) committed
Apr 2, 2016 at 19:06 UTC
0791ed37d0e6af03a7721231ad1684184204df50
1 file changed
+4
-4
src/web_client.c
+4
-4
@@ -289,7 +289,7 @@ int mysendfile(struct web_client *w, char *filename)
289
struct stat stat;
290
if(lstat(webfilename, &stat) != 0) {
291
debug(D_WEB_CLIENT_ACCESS, "%llu: File '%s' is not found.", w->id, webfilename);
292
- buffer_sprintf(w->response.data, "File '%s' does not exist, or is not accessible.", filename);
292
+ buffer_sprintf(w->response.data, "File '%s' does not exist, or is not accessible.", webfilename);
293
return 404;
294
}
295
@@ -307,7 +307,7 @@ int mysendfile(struct web_client *w, char *filename)
307
308
if((stat.st_mode & S_IFMT) != S_IFREG) {
309
error("%llu: File '%s' is not a regular file. Access Denied.", w->id, webfilename);
310
- buffer_sprintf(w->response.data, "Access to file '%s' is not permitted.", filename);
310
+ buffer_sprintf(w->response.data, "Access to file '%s' is not permitted.", webfilename);
311
return 403;
312
}
313
@@ -319,12 +319,12 @@ int mysendfile(struct web_client *w, char *filename)
319
if(errno == EBUSY || errno == EAGAIN) {
320
error("%llu: File '%s' is busy, sending 307 Moved Temporarily to force retry.", w->id, webfilename);
321
buffer_sprintf(w->response.header, "Location: /" WEB_PATH_FILE "/%s\r\n", filename);
322
- buffer_sprintf(w->response.data, "The file '%s' is currently busy. Please try again later.", filename);
322
+ buffer_sprintf(w->response.data, "The file '%s' is currently busy. Please try again later.", webfilename);
323
return 307;
324
}
325
else {
326
error("%llu: Cannot open file '%s'.", w->id, webfilename);
327
- buffer_sprintf(w->response.data, "Cannot open file '%s'.", filename);
327
+ buffer_sprintf(w->response.data, "Cannot open file '%s'.", webfilename);
328
return 404;
329
}
330
}