diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-07-17 14:46:15 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-07-17 14:46:15 +0000 |
commit | 694cf532b5d92ef7be6229fa3e3a045f7f11220c (patch) | |
tree | 902daa8184d8a06891bb58cdc5d0451feb75c54e /src/gui | |
parent | 65e064d3de6b9220b7208fbcccc205999f763bbe (diff) | |
download | mana-694cf532b5d92ef7be6229fa3e3a045f7f11220c.tar.gz mana-694cf532b5d92ef7be6229fa3e3a045f7f11220c.tar.bz2 mana-694cf532b5d92ef7be6229fa3e3a045f7f11220c.tar.xz mana-694cf532b5d92ef7be6229fa3e3a045f7f11220c.zip |
Small fix to let libcurl manage http errors >= 400
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/updatewindow.cpp | 23 |
1 files changed, 2 insertions, 21 deletions
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; |