66#include < cstring>
77#include < thread>
88
9- CurlRequester::CurlRequester (const std::string & addr, const SslConfig& sslConfig)
9+ CurlRequester::CurlRequester (const Url & addr, const SslConfig& sslConfig)
1010 : _curl(curl_easy_init())
1111{
1212 bool debugEnabled = LogController::instance ().isEnabled (LogController::Debug);
13- curl_easy_setopt (_curl, CURLOPT_URL, addr.c_str ());
13+ curl_easy_setopt (_curl, CURLOPT_URL, addr.toStr (). c_str ());
1414 curl_easy_setopt (_curl, CURLOPT_VERBOSE, debugEnabled);
1515 curl_easy_setopt (_curl, CURLOPT_CONNECTTIMEOUT_MS, 2000 );
1616 curl_easy_setopt (_curl, CURLOPT_FAILONERROR, 1 );
@@ -162,9 +162,8 @@ void CurlIppPosterBase::setCompression(Compression compression)
162162 deflateInit2 (&_zstrm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, level, 7 , Z_DEFAULT_STRATEGY);
163163}
164164
165- std::string http_url (const std::string& str )
165+ std::string http_url (Url& url )
166166{
167- Url url (str);
168167 if (url.getScheme () == " ipp" )
169168 {
170169 url.setScheme (" http" );
@@ -184,7 +183,7 @@ std::string http_url(const std::string& str)
184183 return url.toStr ();
185184}
186185
187- CurlIppPosterBase::CurlIppPosterBase (const std::string& addr, const SslConfig& sslConfig)
186+ CurlIppPosterBase::CurlIppPosterBase (Url addr, const SslConfig& sslConfig)
188187 : CurlRequester(http_url(addr), sslConfig)
189188{
190189 _canWrite.unlock ();
@@ -213,22 +212,22 @@ CURLcode CurlIppPosterBase::await(Bytestream* data)
213212 return CurlRequester::await (data);
214213}
215214
216- CurlIppPoster::CurlIppPoster (const std::string & addr, Bytestream&& data, const SslConfig& sslConfig)
215+ CurlIppPoster::CurlIppPoster (const Url & addr, Bytestream&& data, const SslConfig& sslConfig)
217216 : CurlIppPosterBase(addr, sslConfig)
218217{
219218 curl_easy_setopt (_curl, CURLOPT_POSTFIELDSIZE, data.size ());
220219 write (std::move (data));
221220 doRun ();
222221}
223222
224- CurlIppStreamer::CurlIppStreamer (const std::string & addr, const SslConfig& sslConfig)
223+ CurlIppStreamer::CurlIppStreamer (const Url & addr, const SslConfig& sslConfig)
225224 : CurlIppPosterBase(addr, sslConfig)
226225{
227226 _opts = curl_slist_append (_opts, " Transfer-Encoding: chunked" );
228227 doRun ();
229228}
230229
231- CurlHttpGetter::CurlHttpGetter (const std::string & addr, const SslConfig& sslConfig)
230+ CurlHttpGetter::CurlHttpGetter (const Url & addr, const SslConfig& sslConfig)
232231 : CurlRequester(addr, sslConfig)
233232{
234233 doRun ();
0 commit comments