MCPcopy Create free account
hub / github.com/Kitware/CMake / SubmitUsingHTTP

Method SubmitUsingHTTP

Source/CTest/cmCTestSubmitHandler.cxx:131–454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131bool cmCTestSubmitHandler::SubmitUsingHTTP(
132 std::string const& localprefix, std::vector<std::string> const& files,
133 std::string const& remoteprefix, std::string const& url)
134{
135 CURL* curl;
136 FILE* ftpfile;
137 char error_buffer[1024];
138 // Set Content-Type to satisfy fussy modsecurity rules.
139 struct curl_slist* headers =
140 ::curl_slist_append(nullptr, "Content-Type: text/xml");
141
142 // Add any additional headers that the user specified.
143 for (std::string const& h : this->HttpHeaders) {
144 cmCTestOptionalLog(this->CTest, DEBUG,
145 " Add HTTP Header: \"" << h << "\"" << std::endl,
146 this->Quiet);
147 headers = ::curl_slist_append(headers, h.c_str());
148 }
149
150 /* In windows, this will init the winsock stuff */
151 cm_curl_global_init(CURL_GLOBAL_ALL);
152 cmCTestCurlOpts curlOpts(this->CTest);
153 for (std::string const& file : files) {
154 /* get a curl handle */
155 curl = cm_curl_easy_init();
156 if (curl) {
157 cmCurlSetCAInfo(curl);
158 if (curlOpts.TLSVersionOpt.has_value()) {
159 cm::optional<std::string> tlsVersionStr =
160 cmCurlPrintTLSVersion(*curlOpts.TLSVersionOpt);
161 cmCTestOptionalLog(
162 this->CTest, HANDLER_VERBOSE_OUTPUT,
163 " Set CURLOPT_SSLVERSION to "
164 << (tlsVersionStr ? *tlsVersionStr : "unknown value") << "\n",
165 this->Quiet);
166 curl_easy_setopt(curl, CURLOPT_SSLVERSION, *curlOpts.TLSVersionOpt);
167 }
168 if (curlOpts.TLSVerifyOpt.has_value()) {
169 cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
170 " Set CURLOPT_SSL_VERIFYPEER to "
171 << (*curlOpts.TLSVerifyOpt ? "on" : "off")
172 << "\n",
173 this->Quiet);
174 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER,
175 *curlOpts.TLSVerifyOpt ? 1 : 0);
176 }
177 if (curlOpts.VerifyHostOff) {
178 cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
179 " Set CURLOPT_SSL_VERIFYHOST to off\n",
180 this->Quiet);
181 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
182 }
183
184 // Using proxy
185 if (this->HTTPProxyType > 0) {
186 curl_easy_setopt(curl, CURLOPT_PROXY, this->HTTPProxy.c_str());
187 switch (this->HTTPProxyType) {
188 case 2:

Callers 1

ProcessHandlerMethod · 0.95

Calls 15

ParseResponseMethod · 0.95
curl_slist_appendFunction · 0.85
cm_curl_global_initFunction · 0.85
cm_curl_easy_initFunction · 0.85
cmCurlSetCAInfoFunction · 0.85
cmCurlPrintTLSVersionFunction · 0.85
curl_easy_setoptFunction · 0.85
erase_ifFunction · 0.85
curl_easy_cleanupFunction · 0.85
curl_slist_free_allFunction · 0.85
curl_global_cleanupFunction · 0.85

Tested by

no test coverage detected