comparison OrthancServer/ParsedDicomFile.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 a66224eec125
children 80671157d051
comparison
equal deleted inserted replaced
1112:a119f9ae3640 1113:ba5c0908600c
262 std::string buffer; 262 std::string buffer;
263 buffer.resize(65536); 263 buffer.resize(65536);
264 Uint32 length = element.getLength(transferSyntax); 264 Uint32 length = element.getLength(transferSyntax);
265 Uint32 offset = 0; 265 Uint32 offset = 0;
266 266
267 output.GetLowLevelOutput().SendOkHeader(CONTENT_TYPE_OCTET_STREAM, true, length, NULL); 267 output.GetLowLevelOutput().SetContentType(CONTENT_TYPE_OCTET_STREAM);
268 output.GetLowLevelOutput().SetContentLength(length);
268 269
269 while (offset < length) 270 while (offset < length)
270 { 271 {
271 Uint32 nbytes; 272 Uint32 nbytes;
272 if (length - offset < buffer.size()) 273 if (length - offset < buffer.size())
280 281
281 OFCondition cond = element.getPartialValue(&buffer[0], offset, nbytes); 282 OFCondition cond = element.getPartialValue(&buffer[0], offset, nbytes);
282 283
283 if (cond.good()) 284 if (cond.good())
284 { 285 {
285 output.GetLowLevelOutput().SendBodyData(&buffer[0], nbytes); 286 output.GetLowLevelOutput().SendBody(&buffer[0], nbytes);
286 offset += nbytes; 287 offset += nbytes;
287 } 288 }
288 else 289 else
289 { 290 {
290 LOG(ERROR) << "Error while sending a DICOM field: " << cond.text(); 291 LOG(ERROR) << "Error while sending a DICOM field: " << cond.text();