Mercurial > hg > orthanc
diff 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 |
line wrap: on
line diff
--- a/Core/HttpServer/HttpServer.cpp Tue Jun 11 14:02:57 2019 +0200 +++ b/Core/HttpServer/HttpServer.cpp Tue Jun 11 19:44:10 2019 +0200 @@ -384,7 +384,7 @@ } - static PostDataStatus ReadBodyToStream(IHttpHandler::IStream& stream, + static PostDataStatus ReadBodyToStream(IHttpHandler::IChunkedRequestReader& stream, struct mg_connection *connection, const IHttpHandler::Arguments& headers) { @@ -847,16 +847,21 @@ if (!isMultipartForm) { - std::auto_ptr<IHttpHandler::IStream> stream; + std::auto_ptr<IHttpHandler::IChunkedRequestReader> stream; if (server.HasHandler()) { - stream.reset(server.GetHandler().CreateStreamHandler - (RequestOrigin_RestApi, remoteIp, username.c_str(), method, uri, headers)); + found = server.GetHandler().CreateChunkedRequestReader + (stream, RequestOrigin_RestApi, remoteIp, username.c_str(), method, uri, headers); } + + if (found) + { + if (stream.get() == NULL) + { + throw OrthancException(ErrorCode_InternalError); + } - if (stream.get() != NULL) - { status = ReadBodyToStream(*stream, connection, headers); if (status == PostDataStatus_Success)