Mercurial > hg > orthanc
comparison Plugins/Engine/OrthancPlugins.cpp @ 3442:dd1e68f2d0c0
Fix issue #106 (Unable to export preview as jpeg from Lua script)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 24 Jun 2019 16:06:47 +0200 |
parents | 954d15f24366 |
children | 69e49fc044f8 |
comparison
equal
deleted
inserted
replaced
3441:6cc72ebfd6ef | 3442:dd1e68f2d0c0 |
---|---|
1946 { | 1946 { |
1947 PImpl::ServerContextLock lock(*pimpl_); | 1947 PImpl::ServerContextLock lock(*pimpl_); |
1948 handler = &lock.GetContext().GetHttpHandler().RestrictToOrthancRestApi(!afterPlugins); | 1948 handler = &lock.GetContext().GetHttpHandler().RestrictToOrthancRestApi(!afterPlugins); |
1949 } | 1949 } |
1950 | 1950 |
1951 std::map<std::string, std::string> httpHeaders; | |
1952 | |
1951 std::string result; | 1953 std::string result; |
1952 if (HttpToolbox::SimpleGet(result, *handler, RequestOrigin_Plugins, p.uri)) | 1954 if (HttpToolbox::SimpleGet(result, *handler, RequestOrigin_Plugins, p.uri, httpHeaders)) |
1953 { | 1955 { |
1954 CopyToMemoryBuffer(*p.target, result); | 1956 CopyToMemoryBuffer(*p.target, result); |
1955 } | 1957 } |
1956 else | 1958 else |
1957 { | 1959 { |
2011 { | 2013 { |
2012 PImpl::ServerContextLock lock(*pimpl_); | 2014 PImpl::ServerContextLock lock(*pimpl_); |
2013 handler = &lock.GetContext().GetHttpHandler().RestrictToOrthancRestApi(!afterPlugins); | 2015 handler = &lock.GetContext().GetHttpHandler().RestrictToOrthancRestApi(!afterPlugins); |
2014 } | 2016 } |
2015 | 2017 |
2018 std::map<std::string, std::string> httpHeaders; | |
2019 | |
2016 std::string result; | 2020 std::string result; |
2017 if (isPost ? | 2021 if (isPost ? |
2018 HttpToolbox::SimplePost(result, *handler, RequestOrigin_Plugins, p.uri, p.body, p.bodySize) : | 2022 HttpToolbox::SimplePost(result, *handler, RequestOrigin_Plugins, p.uri, p.body, p.bodySize, httpHeaders) : |
2019 HttpToolbox::SimplePut (result, *handler, RequestOrigin_Plugins, p.uri, p.body, p.bodySize)) | 2023 HttpToolbox::SimplePut (result, *handler, RequestOrigin_Plugins, p.uri, p.body, p.bodySize, httpHeaders)) |
2020 { | 2024 { |
2021 CopyToMemoryBuffer(*p.target, result); | 2025 CopyToMemoryBuffer(*p.target, result); |
2022 } | 2026 } |
2023 else | 2027 else |
2024 { | 2028 { |
2039 { | 2043 { |
2040 PImpl::ServerContextLock lock(*pimpl_); | 2044 PImpl::ServerContextLock lock(*pimpl_); |
2041 handler = &lock.GetContext().GetHttpHandler().RestrictToOrthancRestApi(!afterPlugins); | 2045 handler = &lock.GetContext().GetHttpHandler().RestrictToOrthancRestApi(!afterPlugins); |
2042 } | 2046 } |
2043 | 2047 |
2044 if (!HttpToolbox::SimpleDelete(*handler, RequestOrigin_Plugins, uri)) | 2048 std::map<std::string, std::string> httpHeaders; |
2049 | |
2050 if (!HttpToolbox::SimpleDelete(*handler, RequestOrigin_Plugins, uri, httpHeaders)) | |
2045 { | 2051 { |
2046 throw OrthancException(ErrorCode_UnknownResource); | 2052 throw OrthancException(ErrorCode_UnknownResource); |
2047 } | 2053 } |
2048 } | 2054 } |
2049 | 2055 |