changeset 81:ec61c931bdb1

adding 'Content-Type' HTTP headers
author Alain Mazy <am@orthanc.team>
date Tue, 15 Apr 2025 11:52:28 +0200 (5 weeks ago)
parents 72c75a0eff24
children 2fd46562dc57
files Framework/PullMode/PullJob.cpp Framework/PushMode/PushJob.cpp NEWS
diffstat 3 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/PullMode/PullJob.cpp	Fri Jan 17 13:07:30 2025 +0100
+++ b/Framework/PullMode/PullJob.cpp	Tue Apr 15 11:52:28 2025 +0200
@@ -181,6 +181,8 @@
       std::map<std::string, std::string> headers;
       job_.query_.GetHttpHeaders(headers);
 
+      headers["Content-Type"] = "application/json";
+
       if (!DoPostPeer(answer, job_.peers_, job_.peerIndex_, URI_LOOKUP, lookup, job_.maxHttpRetries_, headers))
       {
         LOG(ERROR) << "Cannot retrieve the list of instances to pull from peer \"" 
--- a/Framework/PushMode/PushJob.cpp	Fri Jan 17 13:07:30 2025 +0100
+++ b/Framework/PushMode/PushJob.cpp	Tue Apr 15 11:52:28 2025 +0200
@@ -136,6 +136,8 @@
       std::map<std::string, std::string> headers;
       job_.query_.GetHttpHeaders(headers);
 
+      headers["Content-Type"] = "application/octet-stream";
+
       queue_.SetMaxRetries(job.maxHttpRetries_);
       queue_.Reserve(buckets.size());
         
@@ -222,6 +224,8 @@
       std::map<std::string, std::string> headers;
       job_.query_.GetHttpHeaders(headers);
 
+      headers["Content-Type"] = "application/json";
+
       if (!DoPostPeer(answer, job_.peers_, job_.peerIndex_, URI_PUSH, createTransaction_, job_.maxHttpRetries_, headers))
       {
         LOG(ERROR) << "Cannot create a push transaction to peer \"" 
--- a/NEWS	Fri Jan 17 13:07:30 2025 +0100
+++ b/NEWS	Tue Apr 15 11:52:28 2025 +0200
@@ -1,3 +1,10 @@
+Pending changes in the mainline
+===============================
+
+* now setting "Content-Type" HTTP headers in outgoing POST requests.
+  (https://discourse.orthanc-server.org/t/transfer-accelerator-plugin-http-header-compatibility/5725)
+
+
 Version 1.5 (2024-03-26)
 ========================