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 9986530a..9e87d78c 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(); - resettqStatus(); + resetStatus(); resetData(); } KviHttpRequest::~KviHttpRequest() { - resetInternaltqStatus(); + resetInternalStatus(); delete m_pBuffer; } void KviHttpRequest::abort() { - resetInternaltqStatus(); + resetInternalStatus(); m_szLastError = __tr2qs("Aborted"); emit terminated(false); } -void KviHttpRequest::resetInternaltqStatus() +void KviHttpRequest::resetInternalStatus() { if(m_pThread)delete m_pThread; if(m_pDns)delete m_pDns; @@ -91,7 +91,7 @@ void KviHttpRequest::resetInternaltqStatus() KviThreadManager::killPendingEvents(this); } -void KviHttpRequest::resettqStatus() +void KviHttpRequest::resetStatus() { m_szLastError = __tr2qs("No request"); m_uTotalSize = 0; @@ -114,9 +114,9 @@ void KviHttpRequest::resetData() void KviHttpRequest::reset() { - resettqStatus(); + resetStatus(); resetData(); - resetInternaltqStatus(); + resetInternalStatus(); } 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 - resetInternaltqStatus(); - resettqStatus(); + resetInternalStatus(); + resetStatus(); if(m_eProcessingType == StoreToFile) { @@ -156,15 +156,15 @@ bool KviHttpRequest::start() if(m_url.host().isEmpty()) { - resetInternaltqStatus(); + resetInternalStatus(); m_szLastError = __tr2qs("Invalid URL: Missing hostname"); return false; } if((!kvi_strEqualCI(m_url.protocol().ptr(),"http")) && (!kvi_strEqualCI(m_url.protocol().ptr(),"https"))) { - resetInternaltqStatus(); - m_szLastError=__tr2qs("Unsupported protocol %1").tqarg(m_url.protocol().ptr()); + resetInternalStatus(); + m_szLastError=__tr2qs("Unsupported protocol %1").arg(m_url.protocol().ptr()); return false; } @@ -185,7 +185,7 @@ bool KviHttpRequest::startDnsLookup() if(!m_pDns->lookup(m_url.host().ptr(),KviDns::IpV4)) { - resetInternaltqStatus(); + resetInternalStatus(); 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(); - resetInternaltqStatus(); + resetInternalStatus(); m_szLastError = KviError::getDescription(iErr); emit terminated(false); } @@ -242,7 +242,7 @@ void KviHttpRequest::haveServerIp() if(!m_pThread->start()) { - resetInternaltqStatus(); + resetInternalStatus(); 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; } - resetInternaltqStatus(); + resetInternalStatus(); 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; - resetInternaltqStatus(); + resetInternalStatus(); emit terminated(false); return true; } @@ -409,7 +409,7 @@ bool KviHttpRequest::openFile() TQString tmp = m_szFileName; do { i++; - m_szFileName = tmp + TQString(".kvirnm-%1").tqarg(i); + m_szFileName = tmp + TQString(".kvirnm-%1").arg(i); } while(KviFile::exists(m_szFileName)); } break; @@ -419,13 +419,13 @@ bool KviHttpRequest::openFile() TQString tmp; do { i++; - tmp = m_szFileName + TQString(".kvirnm-%1").tqarg(i); + tmp = m_szFileName + TQString(".kvirnm-%1").arg(i); } while(KviFile::exists(tmp)); TQDir d; if(!d.rename(m_szFileName,tmp)) { // fail :( - resetInternaltqStatus(); + resetInternalStatus(); 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)) { - resetInternaltqStatus(); + resetInternalStatus(); 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 utqStatus = 0; + unsigned int uStatus = 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; - utqStatus = szNumber.toUInt(&bOk); + uStatus = szNumber.toUInt(&bOk); if(bOk)bValid = true; } if(!bValid) { // the response is invalid ? - resetInternaltqStatus(); - m_szLastError=__tr2qs("Invalid HTTP response: %s").tqarg(szResponse.ptr()); + resetInternalStatus(); + m_szLastError=__tr2qs("Invalid HTTP response: %s").arg(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((utqStatus != 200) && (utqStatus != 206)) + if((uStatus != 200) && (uStatus != 206)) { // this is not "OK" and not "Partial content" // Error , redirect or something confusing if(m_eProcessingType != HeadersOnly) { // this is an error then - resetInternaltqStatus(); + resetInternalStatus(); 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))) { - resetInternaltqStatus(); + resetInternalStatus(); 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) { - resetInternaltqStatus(); + resetInternalStatus(); 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))) { - resetInternaltqStatus(); + resetInternalStatus(); 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) { - resetInternaltqStatus(); + resetInternalStatus(); 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) { - resetInternaltqStatus(); + resetInternalStatus(); 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))) { - resetInternaltqStatus(); + resetInternalStatus(); m_szLastError=__tr2qs("Stream exceeded expected length"); emit terminated(false); } |