Check-in [c35e6a2d15]
Overview
Comment:Added additional debugging regarding range computation
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c35e6a2d15d7d55edf169d5322eeeaa5ae38446e
User & Date: rkeene on 2014-02-06 08:26:15
Other Links: manifest | tags
Context
2014-02-06
08:42
Updated to use off_t to represent disk sizes check-in: b040037186 user: rkeene tags: trunk
08:26
Added additional debugging regarding range computation check-in: c35e6a2d15 user: rkeene tags: trunk
08:03
Fixed segfault issue and updated to limit sendfile() size check-in: 47ef170824 user: rkeene tags: trunk
Changes

Modified filed.c from [107a3dbac4] to [c73ad10afc].

352
353
354
355
356
357
358






359
360
361
362
363
364
365
	/* Determine range */
	if (range_end != 0) {
		if (range_end <= range_start) {
			return(NULL);
		}

		range_length = range_end - range_start;






	}

	/* Fill up structure to return */
	buffer_st->path   = path;
	buffer_st->headers.range.present = range_request;
	buffer_st->headers.range.offset  = range_start;
	buffer_st->headers.range.length  = range_length;







>
>
>
>
>
>







352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
	/* Determine range */
	if (range_end != 0) {
		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;
	buffer_st->headers.range.offset  = range_start;
	buffer_st->headers.range.length  = range_length;
430
431
432
433
434
435
436





437
438
439
440
441
442
443
		if (request->headers.range.offset != 0 || request->headers.range.length >= 0) {
			if ((size_t) request->headers.range.offset >= fileinfo->len) {
				filed_log_msg("PROCESS_REPLY_COMPLETE FD=... ERROR=416");

				filed_error_page(fp, date_current, 416);
			} else {
				if (request->headers.range.length < 0) {





					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);

				http_code = 206;
			}







>
>
>
>
>







436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
		if (request->headers.range.offset != 0 || request->headers.range.length >= 0) {
			if ((size_t) request->headers.range.offset >= fileinfo->len) {
				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);

				http_code = 206;
			}