Mercurial > hg > orthanc
comparison OrthancFramework/Sources/HttpServer/MultipartStreamReader.cpp @ 4297:785a2713323e
abi continued
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 05 Nov 2020 17:20:49 +0100 |
parents | 732ad6c618ba |
children | db3932f9660d |
comparison
equal
deleted
inserted
replaced
4296:3b70a2e6a06c | 4297:785a2713323e |
---|---|
290 std::string& subType, | 290 std::string& subType, |
291 std::string& boundary, | 291 std::string& boundary, |
292 const std::string& contentTypeHeader) | 292 const std::string& contentTypeHeader) |
293 { | 293 { |
294 std::vector<std::string> tokens; | 294 std::vector<std::string> tokens; |
295 Orthanc::Toolbox::TokenizeString(tokens, contentTypeHeader, ';'); | 295 Toolbox::TokenizeString(tokens, contentTypeHeader, ';'); |
296 | 296 |
297 if (tokens.empty()) | 297 if (tokens.empty()) |
298 { | 298 { |
299 return false; | 299 return false; |
300 } | 300 } |
301 | 301 |
302 contentType = Orthanc::Toolbox::StripSpaces(tokens[0]); | 302 contentType = Toolbox::StripSpaces(tokens[0]); |
303 Orthanc::Toolbox::ToLowerCase(contentType); | 303 Toolbox::ToLowerCase(contentType); |
304 | 304 |
305 if (contentType.empty()) | 305 if (contentType.empty()) |
306 { | 306 { |
307 return false; | 307 return false; |
308 } | 308 } |
311 subType.clear(); | 311 subType.clear(); |
312 | 312 |
313 for (size_t i = 0; i < tokens.size(); i++) | 313 for (size_t i = 0; i < tokens.size(); i++) |
314 { | 314 { |
315 std::vector<std::string> items; | 315 std::vector<std::string> items; |
316 Orthanc::Toolbox::TokenizeString(items, tokens[i], '='); | 316 Toolbox::TokenizeString(items, tokens[i], '='); |
317 | 317 |
318 if (items.size() == 2) | 318 if (items.size() == 2) |
319 { | 319 { |
320 if (boost::iequals("boundary", Orthanc::Toolbox::StripSpaces(items[0]))) | 320 if (boost::iequals("boundary", Toolbox::StripSpaces(items[0]))) |
321 { | 321 { |
322 boundary = Orthanc::Toolbox::StripSpaces(items[1]); | 322 boundary = Toolbox::StripSpaces(items[1]); |
323 valid = !boundary.empty(); | 323 valid = !boundary.empty(); |
324 } | 324 } |
325 else if (boost::iequals("type", Orthanc::Toolbox::StripSpaces(items[0]))) | 325 else if (boost::iequals("type", Toolbox::StripSpaces(items[0]))) |
326 { | 326 { |
327 subType = Orthanc::Toolbox::StripSpaces(items[1]); | 327 subType = Toolbox::StripSpaces(items[1]); |
328 Orthanc::Toolbox::ToLowerCase(subType); | 328 Toolbox::ToLowerCase(subType); |
329 | 329 |
330 // https://bitbucket.org/sjodogne/orthanc/issues/54/decide-what-to-do-wrt-quoting-of-multipart | 330 // https://bitbucket.org/sjodogne/orthanc/issues/54/decide-what-to-do-wrt-quoting-of-multipart |
331 // https://tools.ietf.org/html/rfc7231#section-3.1.1.1 | 331 // https://tools.ietf.org/html/rfc7231#section-3.1.1.1 |
332 if (subType.size() >= 2 && | 332 if (subType.size() >= 2 && |
333 subType[0] == '"' && | 333 subType[0] == '"' && |