Index: filed.c ================================================================== --- filed.c +++ filed.c @@ -354,10 +354,16 @@ if (range_end <= range_start) { return(NULL); } range_length = range_end - range_start; + + filed_log_msg_debug("Computing length parameter: %llu = %llu - %llu", + (unsigned long long) range_length, + (unsigned long long) range_end, + (unsigned long long) range_start + ); } /* Fill up structure to return */ buffer_st->path = path; buffer_st->headers.range.present = range_request; @@ -432,10 +438,15 @@ filed_log_msg("PROCESS_REPLY_COMPLETE FD=... ERROR=416"); filed_error_page(fp, date_current, 416); } else { if (request->headers.range.length < 0) { + filed_log_msg_debug("Computing length to fit in bounds: fileinfo->len = %llu, request->headers.range.offset = %llu", + (unsigned long long) fileinfo->len, + (unsigned long long) request->headers.range.offset + ); + request->headers.range.length = fileinfo->len - request->headers.range.offset; } filed_log_msg_debug("Partial request, starting at: %llu and running for %llu bytes", (unsigned long long) request->headers.range.offset, (unsigned long long) request->headers.range.length);