Mercurial > hg > orthanc
comparison OrthancServer/OrthancRestApi/OrthancRestApi.cpp @ 1446:8dc80ba768aa
refactoring: IHttpHandler does not use std::string to hold the request body
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 01 Jul 2015 13:16:12 +0200 |
parents | 02f5a3f5c0a0 |
children | f967bdf8534e |
comparison
equal
deleted
inserted
replaced
1445:d26c8a93d05a | 1446:8dc80ba768aa |
---|---|
71 | 71 |
72 static void UploadDicomFile(RestApiPostCall& call) | 72 static void UploadDicomFile(RestApiPostCall& call) |
73 { | 73 { |
74 ServerContext& context = OrthancRestApi::GetContext(call); | 74 ServerContext& context = OrthancRestApi::GetContext(call); |
75 | 75 |
76 const std::string& postData = call.GetPostBody(); | 76 if (call.GetBodySize() == 0) |
77 if (postData.size() == 0) | |
78 { | 77 { |
79 return; | 78 return; |
80 } | 79 } |
81 | 80 |
82 LOG(INFO) << "Receiving a DICOM file of " << postData.size() << " bytes through HTTP"; | 81 LOG(INFO) << "Receiving a DICOM file of " << call.GetBodySize() << " bytes through HTTP"; |
82 | |
83 // TODO Remove unneccessary memcpy | |
84 std::string postData(call.GetBodyData(), call.GetBodySize()); | |
83 | 85 |
84 DicomInstanceToStore toStore; | 86 DicomInstanceToStore toStore; |
85 toStore.SetBuffer(postData); | 87 toStore.SetBuffer(postData); |
86 | 88 |
87 std::string publicId; | 89 std::string publicId; |