diff --git a/checkin_notes b/checkin_notes index 5970ee8a89..64bbc5b555 100755 --- a/checkin_notes +++ b/checkin_notes @@ -2440,3 +2440,25 @@ Charlie 28 Feb 2006 boinc_api.h mac_icon.C x_openGL.C + +David 28 Feb 2006 + - Continuing saga of Curl encodings. + It seems like if you call set CURLOPT_ENCODING + with any value, even "identity", + it will accept any encoding. + This breaks projects that do application-level gzip. + Solution: if the filename ends with ".gz", + don't set CURLOPT_ENCODING. + Otherwise set it to "" (accept all). + NOTE: I think this supports current requirements + (for "deflate" to work, and for app-level gzip to work). + At some point I'll implement BOINC-level gzip. + - Fix the format of elements within . + Need a CR between the last line and the tag. + - In the course of testing I found that a + with no s will crash the core client. + Fixed this. + client/ + client_types.C + file_xfer.C + http_curl.C diff --git a/client/client_types.C b/client/client_types.C index 6c3927fe90..2a2beea9e7 100644 --- a/client/client_types.C +++ b/client/client_types.C @@ -714,7 +714,8 @@ int FILE_INFO::write(MIOFILE& out, bool to_server) { } } if (!error_msg.empty()) { - out.printf(" \n%s\n", error_msg.c_str()); + strip_whitespace(error_msg); + out.printf(" \n%s\n\n", error_msg.c_str()); } out.printf("\n"); #if 0 @@ -773,6 +774,9 @@ int FILE_INFO::delete_file() { // NULL return means there is no URL of the requested type // const char* FILE_INFO::get_init_url(bool is_upload) { + if (!urls.size()) { + return NULL; + } // if a project supplies multiple URLs, try them in order // (e.g. in Einstein@home they're ordered by proximity to client). @@ -809,6 +813,7 @@ const char* FILE_INFO::get_init_url(bool is_upload) { // NULL return means you've tried them all. // const char* FILE_INFO::get_next_url(bool is_upload) { + if (!urls.size()) return NULL; while(1) { current_url = (current_url + 1)%urls.size(); if (current_url == start_url) { diff --git a/client/file_xfer.C b/client/file_xfer.C index 7156e69b3f..64464f960c 100644 --- a/client/file_xfer.C +++ b/client/file_xfer.C @@ -60,8 +60,10 @@ int FILE_XFER::init_download(FILE_INFO& file_info) { } bytes_xferred = starting_size; + const char* url = fip->get_current_url(is_upload); + if (!url) return ERR_INVALID_URL; return HTTP_OP::init_get( - fip->get_current_url(is_upload), pathname, false, (int)starting_size + url, pathname, false, (int)starting_size ); } @@ -92,7 +94,9 @@ int FILE_XFER::init_upload(FILE_INFO& file_info) { file_info.name ); file_size_query = true; - return HTTP_OP::init_post2(fip->get_current_url(is_upload), header, NULL, 0); + const char* url = fip->get_current_url(is_upload); + if (!url) return ERR_INVALID_URL; + return HTTP_OP::init_post2(url, header, NULL, 0); } else { bytes_xferred = file_info.upload_offset; sprintf(header, @@ -116,8 +120,10 @@ int FILE_XFER::init_upload(FILE_INFO& file_info) { file_info.upload_offset ); file_size_query = false; + const char* url = fip->get_current_url(is_upload); + if (!url) return ERR_INVALID_URL; return HTTP_OP::init_post2( - fip->get_current_url(is_upload), header, pathname, fip->upload_offset + url , header, pathname, fip->upload_offset ); } } diff --git a/client/http_curl.C b/client/http_curl.C index 85b014d0f7..bda801a58c 100644 --- a/client/http_curl.C +++ b/client/http_curl.C @@ -304,7 +304,15 @@ The checking this option controls is of the identity that the server claims. The curlErr = curl_easy_setopt(curlEasy, CURLOPT_MAXREDIRS, 5L); curlErr = curl_easy_setopt(curlEasy, CURLOPT_AUTOREFERER, 1L); curlErr = curl_easy_setopt(curlEasy, CURLOPT_FOLLOWLOCATION, 1L); - //curlErr = curl_easy_setopt(curlEasy, CURLOPT_ENCODING, "deflate"); + + // if we tell Curl to accept any encoding (e.g. deflate) + // it seems to accept them all, which screws up projects that + // use gzip at the application level. + // So, detect this and don't accept any encoding in that case + // + if (!out || !ends_with(std::string(out), std::string(".gz"))) { + curlErr = curl_easy_setopt(curlEasy, CURLOPT_ENCODING, ""); + } // setup any proxy they may need setupProxyCurl();