Mercurial > hg > orthanc
comparison Core/HttpServer/HttpServer.cpp @ 3414:b9cba6a91780
simplification
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 11 Jun 2019 19:44:10 +0200 |
parents | e280ced38a4c |
children | 4944b03bb9c6 |
comparison
equal
deleted
inserted
replaced
3413:f09bfdea3fc3 | 3414:b9cba6a91780 |
---|---|
382 return PostDataStatus_Success; | 382 return PostDataStatus_Success; |
383 } | 383 } |
384 } | 384 } |
385 | 385 |
386 | 386 |
387 static PostDataStatus ReadBodyToStream(IHttpHandler::IStream& stream, | 387 static PostDataStatus ReadBodyToStream(IHttpHandler::IChunkedRequestReader& stream, |
388 struct mg_connection *connection, | 388 struct mg_connection *connection, |
389 const IHttpHandler::Arguments& headers) | 389 const IHttpHandler::Arguments& headers) |
390 { | 390 { |
391 IHttpHandler::Arguments::const_iterator contentLength = headers.find("content-length"); | 391 IHttpHandler::Arguments::const_iterator contentLength = headers.find("content-length"); |
392 | 392 |
845 isMultipartForm = true; | 845 isMultipartForm = true; |
846 } | 846 } |
847 | 847 |
848 if (!isMultipartForm) | 848 if (!isMultipartForm) |
849 { | 849 { |
850 std::auto_ptr<IHttpHandler::IStream> stream; | 850 std::auto_ptr<IHttpHandler::IChunkedRequestReader> stream; |
851 | 851 |
852 if (server.HasHandler()) | 852 if (server.HasHandler()) |
853 { | 853 { |
854 stream.reset(server.GetHandler().CreateStreamHandler | 854 found = server.GetHandler().CreateChunkedRequestReader |
855 (RequestOrigin_RestApi, remoteIp, username.c_str(), method, uri, headers)); | 855 (stream, RequestOrigin_RestApi, remoteIp, username.c_str(), method, uri, headers); |
856 } | 856 } |
857 | 857 |
858 if (stream.get() != NULL) | 858 if (found) |
859 { | 859 { |
860 if (stream.get() == NULL) | |
861 { | |
862 throw OrthancException(ErrorCode_InternalError); | |
863 } | |
864 | |
860 status = ReadBodyToStream(*stream, connection, headers); | 865 status = ReadBodyToStream(*stream, connection, headers); |
861 | 866 |
862 if (status == PostDataStatus_Success) | 867 if (status == PostDataStatus_Success) |
863 { | 868 { |
864 stream->Execute(output); | 869 stream->Execute(output); |