summaryrefslogtreecommitdiff
path: root/lib/HttpServ.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/HttpServ.cc')
-rw-r--r--lib/HttpServ.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/HttpServ.cc b/lib/HttpServ.cc
index e902ae4..275112e 100644
--- a/lib/HttpServ.cc
+++ b/lib/HttpServ.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: HttpServ.cc,v 1.60 2008-01-28 17:09:18 pixel Exp $ */
+/* $Id: HttpServ.cc,v 1.61 2008-01-28 17:30:46 pixel Exp $ */
#include <vector>
@@ -789,11 +789,12 @@ String HttpServ::GetName() {
class BuildHttpResponse : public Task {
public:
- BuildHttpResponse(HttpResponse * _hr, Handle * _out) : hr(_hr), out(_out) { SetBurst(); }
+ BuildHttpResponse(HttpResponse * _hr, Handle * _out) : hr(_hr), out(_out), file(0) { SetBurst(); }
virtual ~BuildHttpResponse() { }
virtual String GetName() { return "BuildHttpResponse"; }
virtual int Do() throw (GeneralException) {
Buffer * b;
+ Handle * h;
switch (current) {
case 0:
@@ -801,6 +802,12 @@ class BuildHttpResponse : public Task {
b = &hr->contents;
current = 2;
} else {
+ if (hr->file_name != "") {
+ file = new Input(hr->file_name);
+ if (hr->last_modified < 0) {
+ hr->last_modified = file->GetModif();
+ }
+ }
b = new Buffer();
hr->PrepareResponse(b);
current = 1;
@@ -812,13 +819,20 @@ class BuildHttpResponse : public Task {
case 1:
delete t;
- t = new CopyJob(&hr->contents, out);
+ if (file) {
+ h = file;
+ } else {
+ h = &hr->contents;
+ }
+ t = new CopyJob(h, out);
WaitFor(t);
current = 2;
Suspend(TASK_ON_HOLD);
case 2:
delete t;
+ if (file)
+ delete file;
}
return TASK_DONE;
@@ -826,6 +840,7 @@ class BuildHttpResponse : public Task {
private:
HttpResponse * hr;
Handle * out;
+ Input * file;
Task * t;
};