comparison Core/HttpServer/HttpFileSender.cpp @ 330:78a8eaa5f30b

cookies
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 09 Jan 2013 11:41:13 +0100
parents 64925c94825c
children bdd72233b105
comparison
equal deleted inserted replaced
329:f579d50fdf8f 330:78a8eaa5f30b
36 36
37 namespace Orthanc 37 namespace Orthanc
38 { 38 {
39 void HttpFileSender::SendHeader(HttpOutput& output) 39 void HttpFileSender::SendHeader(HttpOutput& output)
40 { 40 {
41 HttpHandler::Arguments header; 41 output.SendOkHeader(contentType_.c_str(), true, GetFileSize(), downloadFilename_.c_str());
42 header["Content-Length"] = boost::lexical_cast<std::string>(GetFileSize());
43
44 if (contentType_.size() > 0)
45 {
46 header["Content-Type"] = contentType_;
47 }
48
49 if (downloadFilename_.size() > 0)
50 {
51 header["Content-Disposition"] = "attachment; filename=\"" + downloadFilename_ + "\"";
52 }
53
54 output.SendOkHeader(header);
55 } 42 }
56 43
57 void HttpFileSender::Send(HttpOutput& output) 44 void HttpFileSender::Send(HttpOutput& output)
58 { 45 {
59 SendHeader(output); 46 SendHeader(output);