comparison Framework/TransferToolbox.cpp @ 44:f4e828607f02

Added 'SenderTransferID' option that is added as an HTTP header in outgoing requests in PushMode
author Alain Mazy <am@osimis.io>
date Wed, 19 Oct 2022 21:12:57 +0200
parents 44a0430d7899
children 1e396fb509ca
comparison
equal deleted inserted replaced
43:c3fefbb11321 44:f4e828607f02
81 bool DoPostPeer(Json::Value& answer, 81 bool DoPostPeer(Json::Value& answer,
82 const OrthancPeers& peers, 82 const OrthancPeers& peers,
83 size_t peerIndex, 83 size_t peerIndex,
84 const std::string& uri, 84 const std::string& uri,
85 const std::string& body, 85 const std::string& body,
86 unsigned int maxRetries) 86 unsigned int maxRetries,
87 const std::map<std::string, std::string>& headers
88 )
87 { 89 {
88 unsigned int retry = 0; 90 unsigned int retry = 0;
89 91
90 for (;;) 92 for (;;)
91 { 93 {
92 try 94 try
93 { 95 {
94 if (peers.DoPost(answer, peerIndex, uri, body)) 96 if (peers.DoPost(answer, peerIndex, uri, body, headers))
95 { 97 {
96 return true; 98 return true;
97 } 99 }
98 } 100 }
99 catch (Orthanc::OrthancException&) 101 catch (Orthanc::OrthancException&)
117 bool DoPostPeer(Json::Value& answer, 119 bool DoPostPeer(Json::Value& answer,
118 const OrthancPeers& peers, 120 const OrthancPeers& peers,
119 const std::string& peerName, 121 const std::string& peerName,
120 const std::string& uri, 122 const std::string& uri,
121 const std::string& body, 123 const std::string& body,
122 unsigned int maxRetries) 124 unsigned int maxRetries,
125 const std::map<std::string, std::string>& headers)
123 { 126 {
124 size_t index; 127 size_t index;
125 128
126 return (peers.LookupName(index, peerName) && 129 return (peers.LookupName(index, peerName) &&
127 DoPostPeer(answer, peers, index, uri, body, maxRetries)); 130 DoPostPeer(answer, peers, index, uri, body, maxRetries, headers));
128 } 131 }
129 132
130 133
131 bool DoDeletePeer(const OrthancPeers& peers, 134 bool DoDeletePeer(const OrthancPeers& peers,
132 size_t peerIndex, 135 size_t peerIndex,
133 const std::string& uri, 136 const std::string& uri,
134 unsigned int maxRetries) 137 unsigned int maxRetries,
138 const std::map<std::string, std::string>& headers)
135 { 139 {
136 unsigned int retry = 0; 140 unsigned int retry = 0;
137 141
138 for (;;) 142 for (;;)
139 { 143 {
140 try 144 try
141 { 145 {
142 if (peers.DoDelete(peerIndex, uri)) 146 if (peers.DoDelete(peerIndex, uri, headers))
143 { 147 {
144 return true; 148 return true;
145 } 149 }
146 } 150 }
147 catch (Orthanc::OrthancException&) 151 catch (Orthanc::OrthancException&)