comparison Core/HttpServer/EmbeddedResourceHttpHandler.cpp @ 1113:ba5c0908600c

Refactoring of HttpOutput ("Content-Length" header is now always sent)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 02 Sep 2014 15:51:20 +0200
parents 8d1845feb277
children 6e7e5ed91c2d
comparison
equal deleted inserted replaced
1112:a119f9ae3640 1113:ba5c0908600c
76 76
77 try 77 try
78 { 78 {
79 const void* buffer = EmbeddedResources::GetDirectoryResourceBuffer(resourceId_, resourcePath.c_str()); 79 const void* buffer = EmbeddedResources::GetDirectoryResourceBuffer(resourceId_, resourcePath.c_str());
80 size_t size = EmbeddedResources::GetDirectoryResourceSize(resourceId_, resourcePath.c_str()); 80 size_t size = EmbeddedResources::GetDirectoryResourceSize(resourceId_, resourcePath.c_str());
81 output.AnswerBufferWithContentType(buffer, size, contentType); 81
82 output.SetContentType(contentType.c_str());
83 output.SendBody(buffer, size);
82 } 84 }
83 catch (OrthancException&) 85 catch (OrthancException&)
84 { 86 {
85 LOG(WARNING) << "Unable to find HTTP resource: " << resourcePath; 87 LOG(WARNING) << "Unable to find HTTP resource: " << resourcePath;
86 output.SendHeader(HttpStatus_404_NotFound); 88 output.SendStatus(HttpStatus_404_NotFound);
87 } 89 }
88 90
89 return true; 91 return true;
90 } 92 }
91 } 93 }