El Martes 23 Jun 2009 11:11:45 Kevin Reed escribió:
> However, the boinc client has this code in http_curl.cpp:
>
>         if ((response/100)*100 == HTTP_STATUS_OK) {
>             http_op_retval = 0;
>         } else if ((response/100)*100 == HTTP_STATUS_CONTINUE) {
>             return;
>         } else {
>
> This is essentially converting all of the 2XX response codes to be the same
> as HTTP_STATUS_OK.  The 200 vs 206 response code is therefore being treated
> the same by the BOINC code.  I think that the BOINC client should handle
> the 200 and 206 return codes differently and if 200 is returned then the
> file downloaded should replace any existing file.  If 206 is returned, then
> the client should append to any existing file.

But it also has this code in file_xfer.cpp (error checking removed to make 
email shorter)

// for downloads: if we requested a partial transfer,
// and the HTTP response is 200,
// and the file is larger than it should be,
// the server or proxy must have sent us the entire file
// (i.e. it doesn't understand Range: requests).
// In this case, trim off the initial part of the file

if ((!fxp->is_upload) && (fxp->starting_size) && (fxp->response == 
HTTP_STATUS_OK)) {
        get_pathname(fxp->fip, pathname, sizeof(pathname));
        if (file_size(pathname, size)) {
                continue;
        }
        if (size > fxp->fip->nbytes) {
                FILE* f1 = boinc_fopen(pathname, "rb");
                FILE* f2 = boinc_fopen(TEMP_FILE_NAME, "wb");
                fseek(f1, (long)fxp->starting_size, SEEK_SET);
                copy_stream(f1, f2);
                fclose(f1);
                fclose(f2);
                f1 = boinc_fopen(TEMP_FILE_NAME, "rb");
                f2 = boinc_fopen(pathname, "wb");
                copy_stream(f1, f2);
                fclose(f1);
                fclose(f2);
        }
}

(Which seems quite silly in my opinion. Why not seek to the beginning before 
saving any data, instead of appending and then "trimming beginning of file" 
after the transfer is done? And why is a temporary file needed to trim the 
beginning?)
_______________________________________________
boinc_dev mailing list
[email protected]
http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
To unsubscribe, visit the above URL and
(near bottom of page) enter your email address.

Reply via email to