util/StringFormat: new utility library
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include "IOThread.hxx"
|
||||
#include "util/ASCII.hxx"
|
||||
#include "util/StringUtil.hxx"
|
||||
#include "util/StringFormat.hxx"
|
||||
#include "util/NumberParser.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
@@ -373,13 +374,10 @@ CurlInputStream::InitEasy()
|
||||
if (proxy_port > 0)
|
||||
request->SetOption(CURLOPT_PROXYPORT, (long)proxy_port);
|
||||
|
||||
if (proxy_user != nullptr && proxy_password != nullptr) {
|
||||
char proxy_auth_str[1024];
|
||||
snprintf(proxy_auth_str, sizeof(proxy_auth_str),
|
||||
"%s:%s",
|
||||
proxy_user, proxy_password);
|
||||
request->SetOption(CURLOPT_PROXYUSERPWD, proxy_auth_str);
|
||||
}
|
||||
if (proxy_user != nullptr && proxy_password != nullptr)
|
||||
request->SetOption(CURLOPT_PROXYUSERPWD,
|
||||
StringFormat<1024>("%s:%s", proxy_user,
|
||||
proxy_password).c_str());
|
||||
|
||||
request->SetOption(CURLOPT_SSL_VERIFYPEER, verify_peer ? 1l : 0l);
|
||||
request->SetOption(CURLOPT_SSL_VERIFYHOST, verify_host ? 2l : 0l);
|
||||
@@ -416,11 +414,10 @@ CurlInputStream::SeekInternal(offset_type new_offset)
|
||||
|
||||
/* send the "Range" header */
|
||||
|
||||
if (offset > 0) {
|
||||
char range[32];
|
||||
sprintf(range, "%" PRIoffset "-", offset);
|
||||
request->SetOption(CURLOPT_RANGE, range);
|
||||
}
|
||||
if (offset > 0)
|
||||
request->SetOption(CURLOPT_RANGE,
|
||||
StringFormat<40>("%" PRIoffset "-",
|
||||
offset).c_str());
|
||||
|
||||
StartRequest();
|
||||
}
|
||||
|
Reference in New Issue
Block a user