diff options
Diffstat (limited to 'src/kvilib/net/kvi_http.cpp')
-rw-r--r-- | src/kvilib/net/kvi_http.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/kvilib/net/kvi_http.cpp b/src/kvilib/net/kvi_http.cpp index 9e87d78c..9986530a 100644 --- a/src/kvilib/net/kvi_http.cpp +++ b/src/kvilib/net/kvi_http.cpp @@ -55,24 +55,24 @@ KviHttpRequest::KviHttpRequest() m_bHeaderProcessed = false; m_pBuffer = new KviDataBuffer(); - resetStatus(); + resettqStatus(); resetData(); } KviHttpRequest::~KviHttpRequest() { - resetInternalStatus(); + resetInternaltqStatus(); delete m_pBuffer; } void KviHttpRequest::abort() { - resetInternalStatus(); + resetInternaltqStatus(); m_szLastError = __tr2qs("Aborted"); emit terminated(false); } -void KviHttpRequest::resetInternalStatus() +void KviHttpRequest::resetInternaltqStatus() { if(m_pThread)delete m_pThread; if(m_pDns)delete m_pDns; @@ -91,7 +91,7 @@ void KviHttpRequest::resetInternalStatus() KviThreadManager::killPendingEvents(this); } -void KviHttpRequest::resetStatus() +void KviHttpRequest::resettqStatus() { m_szLastError = __tr2qs("No request"); m_uTotalSize = 0; @@ -114,9 +114,9 @@ void KviHttpRequest::resetData() void KviHttpRequest::reset() { - resetStatus(); + resettqStatus(); resetData(); - resetInternalStatus(); + resetInternaltqStatus(); } bool KviHttpRequest::get(const KviUrl &u,ProcessingType p,const TQString &szFileName) @@ -131,8 +131,8 @@ bool KviHttpRequest::get(const KviUrl &u,ProcessingType p,const TQString &szFile bool KviHttpRequest::start() { // ensure that the file is closed - resetInternalStatus(); - resetStatus(); + resetInternaltqStatus(); + resettqStatus(); if(m_eProcessingType == StoreToFile) { @@ -156,15 +156,15 @@ bool KviHttpRequest::start() if(m_url.host().isEmpty()) { - resetInternalStatus(); + resetInternaltqStatus(); m_szLastError = __tr2qs("Invalid URL: Missing hostname"); return false; } if((!kvi_strEqualCI(m_url.protocol().ptr(),"http")) && (!kvi_strEqualCI(m_url.protocol().ptr(),"https"))) { - resetInternalStatus(); - m_szLastError=__tr2qs("Unsupported protocol %1").arg(m_url.protocol().ptr()); + resetInternaltqStatus(); + m_szLastError=__tr2qs("Unsupported protocol %1").tqarg(m_url.protocol().ptr()); return false; } @@ -185,7 +185,7 @@ bool KviHttpRequest::startDnsLookup() if(!m_pDns->lookup(m_url.host().ptr(),KviDns::IpV4)) { - resetInternalStatus(); + resetInternaltqStatus(); m_szLastError = __tr2qs("Unable to start the DNS lookup"); return false; } @@ -212,7 +212,7 @@ void KviHttpRequest::dnsLookupDone(KviDns *d) haveServerIp(); } else { int iErr = d->error(); - resetInternalStatus(); + resetInternaltqStatus(); m_szLastError = KviError::getDescription(iErr); emit terminated(false); } @@ -242,7 +242,7 @@ void KviHttpRequest::haveServerIp() if(!m_pThread->start()) { - resetInternalStatus(); + resetInternaltqStatus(); m_szLastError = __tr2qs("Unable to start the request slave thread"); emit terminated(false); return; @@ -318,7 +318,7 @@ bool KviHttpRequest::event(TQEvent *e) // nothing... just make gcc happy break; } - resetInternalStatus(); + resetInternaltqStatus(); m_szLastError = __tr2qs("Success"); emit terminated(true); return true; @@ -328,7 +328,7 @@ bool KviHttpRequest::event(TQEvent *e) KviStr * err = ((KviThreadDataEvent<KviStr> *)e)->getData(); m_szLastError = __tr2qs_no_xgettext(err->ptr()); delete err; - resetInternalStatus(); + resetInternaltqStatus(); emit terminated(false); return true; } @@ -409,7 +409,7 @@ bool KviHttpRequest::openFile() TQString tmp = m_szFileName; do { i++; - m_szFileName = tmp + TQString(".kvirnm-%1").arg(i); + m_szFileName = tmp + TQString(".kvirnm-%1").tqarg(i); } while(KviFile::exists(m_szFileName)); } break; @@ -419,13 +419,13 @@ bool KviHttpRequest::openFile() TQString tmp; do { i++; - tmp = m_szFileName + TQString(".kvirnm-%1").arg(i); + tmp = m_szFileName + TQString(".kvirnm-%1").tqarg(i); } while(KviFile::exists(tmp)); TQDir d; if(!d.rename(m_szFileName,tmp)) { // fail :( - resetInternalStatus(); + resetInternaltqStatus(); m_szLastError = __tr2qs("Failed to rename the existing file, please rename manually and retry"); emit terminated(false); return false; @@ -443,7 +443,7 @@ bool KviHttpRequest::openFile() if(!m_pFile->openForWriting(bAppend)) { - resetInternalStatus(); + resetInternaltqStatus(); KviTQString::sprintf(m_szLastError,__tr2qs("Can't open file \"%Q\" for writing"),&m_szFileName); emit terminated(false); return false; @@ -473,7 +473,7 @@ bool KviHttpRequest::processHeader(KviStr &szHeader) bool bValid = false; - unsigned int uStatus = 0; + unsigned int utqStatus = 0; // check the response value if(kvi_strEqualCSN(szResponse.ptr(),"HTTP",4)) @@ -486,15 +486,15 @@ bool KviHttpRequest::processHeader(KviStr &szHeader) if(idx != -1)szNumber = szR.left(idx); else szNumber = szR; bool bOk; - uStatus = szNumber.toUInt(&bOk); + utqStatus = szNumber.toUInt(&bOk); if(bOk)bValid = true; } if(!bValid) { // the response is invalid ? - resetInternalStatus(); - m_szLastError=__tr2qs("Invalid HTTP response: %s").arg(szResponse.ptr()); + resetInternaltqStatus(); + m_szLastError=__tr2qs("Invalid HTTP response: %s").tqarg(szResponse.ptr()); emit terminated(false); return false; } @@ -608,14 +608,14 @@ bool KviHttpRequest::processHeader(KviStr &szHeader) // case 504: // Gateway timeout // case 505: // HTTP Version not supported - if((uStatus != 200) && (uStatus != 206)) + if((utqStatus != 200) && (utqStatus != 206)) { // this is not "OK" and not "Partial content" // Error , redirect or something confusing if(m_eProcessingType != HeadersOnly) { // this is an error then - resetInternalStatus(); + resetInternaltqStatus(); m_szLastError = szResponse.ptr(); emit terminated(false); return false; @@ -624,7 +624,7 @@ bool KviHttpRequest::processHeader(KviStr &szHeader) if((m_uMaxContentLength > 0) && (m_uTotalSize > ((unsigned int)m_uMaxContentLength))) { - resetInternalStatus(); + resetInternaltqStatus(); m_szLastError=__tr2qs("Stream exceeding maximum length"); emit terminated(false); return false; @@ -657,7 +657,7 @@ void KviHttpRequest::processData(KviDataBuffer * data) // header not complete if(m_pBuffer->size() > 4096) { - resetInternalStatus(); + resetInternaltqStatus(); m_szLastError = __tr2qs("Header too long: exceeded 4096 bytes"); emit terminated(false); } @@ -706,7 +706,7 @@ void KviHttpRequest::processData(KviDataBuffer * data) if(((m_uTotalSize > 0) && (m_uReceivedSize > m_uTotalSize)) || ((m_uMaxContentLength > 0) && (m_uReceivedSize > m_uMaxContentLength))) { - resetInternalStatus(); + resetInternaltqStatus(); m_szLastError=__tr2qs("Stream exceeded expected length"); emit terminated(false); } @@ -794,7 +794,7 @@ void KviHttpRequest::processData(KviDataBuffer * data) m_uRemainingChunkSize = szHexHeader.toLong(&bOk,16); if(!bOk) { - resetInternalStatus(); + resetInternaltqStatus(); m_szLastError = __tr2qs("Protocol error: invalid chunk size"); emit terminated(false); return; @@ -814,7 +814,7 @@ void KviHttpRequest::processData(KviDataBuffer * data) // chunk header not complete if(m_pBuffer->size() > 4096) { - resetInternalStatus(); + resetInternaltqStatus(); m_szLastError = __tr2qs("Chunk header too long: exceeded 4096 bytes"); emit terminated(false); return; @@ -848,7 +848,7 @@ check_stream_length: if(((m_uTotalSize > 0) && (m_uReceivedSize > m_uTotalSize)) || ((m_uMaxContentLength > 0) && (m_uReceivedSize > m_uMaxContentLength))) { - resetInternalStatus(); + resetInternaltqStatus(); m_szLastError=__tr2qs("Stream exceeded expected length"); emit terminated(false); } |