Subversion Repositories tpanel

Rev

Rev 446 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 446 Rev 482
Line 108... Line 108...
108
    {
108
    {
109
        delete[] buffer;
109
        delete[] buffer;
110
        return nullptr;
110
        return nullptr;
111
    }
111
    }
112
 
112
 
113
    int ret = 0;
113
    size_t ret = 0;
114
    bool repeat = false;
114
    bool repeat = false;
115
 
115
 
116
    try
116
    try
117
    {
117
    {
118
        do
118
        do
Line 123... Line 123...
123
                {
123
                {
124
                    MSG_ERROR("[" << mURL.host << "] Write error: " << strerror(errno));
124
                    MSG_ERROR("[" << mURL.host << "] Write error: " << strerror(errno));
125
                }
125
                }
126
                else if (encrypt)
126
                else if (encrypt)
127
                {
127
                {
128
                    int err = retrieveSSLerror(ret);
128
                    int err = retrieveSSLerror(static_cast<int>(ret));
129
                    repeat = false;
129
                    repeat = false;
130
 
130
 
131
                    switch (err)
131
                    switch (err)
132
                    {
132
                    {
133
                        case SSL_ERROR_ZERO_RETURN:     MSG_ERROR("The TLS/SSL peer has closed the connection for writing by sending the close_notify alert."); break;
133
                        case SSL_ERROR_ZERO_RETURN:     MSG_ERROR("The TLS/SSL peer has closed the connection for writing by sending the close_notify alert."); break;
Line 583... Line 583...
583
    if (blen == 0)
583
    if (blen == 0)
584
    {
584
    {
585
        size_t head_len = strcspn(buffer, "\r\n\r\n");
585
        size_t head_len = strcspn(buffer, "\r\n\r\n");
586
 
586
 
587
        if (head_len < len)
587
        if (head_len < len)
588
            blen = len - head_len + 4;
588
            blen = static_cast<int>(len - head_len + 4);
589
    }
589
    }
590
 
590
 
591
    MSG_DEBUG("[" << mURL.host << "] Content length: " << blen);
591
    MSG_DEBUG("[" << mURL.host << "] Content length: " << blen);
592
 
592
 
593
    if (blen > 0)
593
    if (blen > 0)
Line 674... Line 674...
674
    request += "\r\n";
674
    request += "\r\n";
675
 
675
 
676
    if (!mUser.empty())
676
    if (!mUser.empty())
677
    {
677
    {
678
        string clearname = mUser + ":" + mPassword;
678
        string clearname = mUser + ":" + mPassword;
679
        string enc = Base64::encode((BYTE *)clearname.c_str(), clearname.size());
679
        string enc = Base64::encode((BYTE *)clearname.c_str(), static_cast<uint>(clearname.size()));
680
        request += "Authorization: Basic " + enc + "\r\n";
680
        request += "Authorization: Basic " + enc + "\r\n";
681
    }
681
    }
682
 
682
 
683
    request += "User-Agent: tpanel/" + std::to_string(V_MAJOR) + "." + std::to_string(V_MINOR) + "." + std::to_string(V_PATCH) + "\r\n";
683
    request += "User-Agent: tpanel/" + std::to_string(V_MAJOR) + "." + std::to_string(V_MINOR) + "." + std::to_string(V_PATCH) + "\r\n";
684
    request += "Accept: image/*\r\n";
684
    request += "Accept: image/*\r\n";