From 694cf532b5d92ef7be6229fa3e3a045f7f11220c Mon Sep 17 00:00:00 2001 From: Eugenio Favalli Date: Sun, 17 Jul 2005 14:46:15 +0000 Subject: Small fix to let libcurl manage http errors >= 400 --- src/gui/updatewindow.cpp | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) (limited to 'src/gui/updatewindow.cpp') diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 64f99dd0..7c925077 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -211,6 +211,7 @@ int downloadThread(void *ptr) if (memoryTransfer) { downloadedBytes = 0; + curl_easy_setopt(curl, CURLOPT_FAILONERROR, TRUE); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, memoryWrite); curl_easy_setopt(curl, CURLOPT_WRITEDATA, NULL); } @@ -254,25 +255,6 @@ void download() } } -void checkFile(std::ifstream &in) -{ - // Check for XML tag (if it is XML tag it is error) - // WARNING: this way we can't use an XML file for resources listing - if (!in.eof()) - { - std::string line(""); - getline(in, line); - if (line[0] == '<') { - logger->log("Error: resources.txt download error (404)"); - downloadStatus = UPDATE_ERROR; - } - else { - // Move the pointer to the beginning of the file - in.seekg (0, std::ios::beg); - } - } -} - void updateData() { std::ifstream in; @@ -335,14 +317,13 @@ void updateData() break; case UPDATE_LIST: if (downloadComplete) { - if (memoryBuffer != NULL && memoryBuffer[0] != '<') + if (memoryBuffer != NULL) { // Tokenize and add each line separately char *line = strtok(memoryBuffer, "\n"); while (line != NULL) { files.push_back(line); - std::cout << line << std::endl; line = strtok(NULL, "\n"); } memoryTransfer = false; -- cgit v1.2.3-70-g09d2