comparison Core/HttpServer/HttpFileSender.cpp @ 324:64925c94825c

api improvement
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 08 Jan 2013 09:29:56 +0100
parents 1ac3aacd10a5
children 78a8eaa5f30b
comparison
equal deleted inserted replaced
323:052dede32761 324:64925c94825c
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 std::string header; 41 HttpHandler::Arguments header;
42 header += "Content-Length: " + boost::lexical_cast<std::string>(GetFileSize()) + "\r\n"; 42 header["Content-Length"] = boost::lexical_cast<std::string>(GetFileSize());
43 43
44 if (contentType_.size() > 0) 44 if (contentType_.size() > 0)
45 { 45 {
46 header += "Content-Type: " + contentType_ + "\r\n"; 46 header["Content-Type"] = contentType_;
47 } 47 }
48 48
49 if (downloadFilename_.size() > 0) 49 if (downloadFilename_.size() > 0)
50 { 50 {
51 header += "Content-Disposition: attachment; filename=\"" + downloadFilename_ + "\"\r\n"; 51 header["Content-Disposition"] = "attachment; filename=\"" + downloadFilename_ + "\"";
52 } 52 }
53 53
54 output.SendCustomOkHeader(header); 54 output.SendOkHeader(header);
55 } 55 }
56 56
57 void HttpFileSender::Send(HttpOutput& output) 57 void HttpFileSender::Send(HttpOutput& output)
58 { 58 {
59 SendHeader(output); 59 SendHeader(output);