Diff

Differences From Artifact [a9d9efdd38]:

To Artifact [3095917664]:


   217    217   #  define filed_log_msg_debug(x, ...) /**/
   218    218   #endif
   219    219   
   220    220   /* Initialize logging thread */
   221    221   static void *filed_logging_thread(void *arg_p) {
   222    222   	struct filed_logging_thread_args *arg;
   223    223   	struct filed_log_entry *curr, *prev;
          224  +	time_t now;
   224    225   	FILE *fp;
   225    226   
   226    227   	arg = arg_p;
   227    228   
   228    229   	fp = arg->fp;
   229    230   
   230    231   	while (1) {
................................................................................
   232    233   		pthread_cond_wait(&filed_log_msg_list_ready, &filed_log_msg_list_mutex);
   233    234   
   234    235   		curr = filed_log_msg_list;
   235    236   		filed_log_msg_list = NULL;
   236    237   
   237    238   		pthread_mutex_unlock(&filed_log_msg_list_mutex);
   238    239   
          240  +		now = time(NULL);
          241  +
   239    242   		prev = NULL;
   240    243   		for (; curr; curr = curr->_next) {
   241    244   			curr->_prev = prev;
   242    245   
   243    246   			prev = curr;
   244    247   		}
   245    248   
   246    249   		curr = prev;
   247    250   		while (curr) {
   248         -			fprintf(fp, "%s THREAD=%llu\n", curr->buffer, (unsigned long long) curr->thread);
          251  +			fprintf(fp, "%s THREAD=%llu TIME=%llu\n",
          252  +				curr->buffer,
          253  +				(unsigned long long) curr->thread,
          254  +				(unsigned long long) now
          255  +			);
   249    256   			fflush(fp);
   250    257   
   251    258   			prev = curr;
   252    259   			curr = curr->_prev;
   253    260   
   254    261   			free(prev);
   255    262   		}
................................................................................
   635    642   
   636    643   		fclose(fp);
   637    644   
   638    645   		return;
   639    646   	}
   640    647   
   641    648   	if (request->headers.range.present) {
   642         -		filed_log_msg("PROCESS_REPLY_START FD=%i PATH=%s RANGE_START=%llu RANGE_LENGTH=%llu",
          649  +		filed_log_msg("PROCESS_REPLY_START FD=%i PATH=%s RANGE_START=%llu RANGE_LENGTH=%lli",
   643    650   			fd,
   644    651   			request->path,
   645    652   			(unsigned long long) request->headers.range.offset,
   646         -			(unsigned long long) request->headers.range.length
          653  +			(long long) request->headers.range.length
   647    654   		);
   648    655   	} else {
   649    656   		filed_log_msg("PROCESS_REPLY_START FD=%i PATH=%s", fd, request->path);
   650    657   	}
   651    658   
   652    659   	path = request->path;
   653    660   
................................................................................
   661    668   	} else {
   662    669   		if (request->headers.range.offset != 0 || request->headers.range.length >= 0) {
   663    670   			if (request->headers.range.offset >= fileinfo->len) {
   664    671   				filed_log_msg("PROCESS_REPLY_COMPLETE FD=%i ERROR=416", fd);
   665    672   
   666    673   				filed_error_page(fp, date_current, 416);
   667    674   			} else {
   668         -				if (request->headers.range.length < 0) {
          675  +				if (request->headers.range.length == ((off_t) -1)) {
   669    676   					filed_log_msg_debug("Computing length to fit in bounds: fileinfo->len = %llu, request->headers.range.offset = %llu",
   670    677   						(unsigned long long) fileinfo->len,
   671    678   						(unsigned long long) request->headers.range.offset
   672    679   					);
   673    680   
   674    681   					request->headers.range.length = fileinfo->len - request->headers.range.offset;
   675    682   				}
   676    683   
   677         -				filed_log_msg_debug("Partial request, starting at: %llu and running for %llu bytes",
          684  +				filed_log_msg_debug("Partial request, starting at: %llu and running for %lli bytes",
   678    685   					(unsigned long long) request->headers.range.offset,
   679         -					(unsigned long long) request->headers.range.length
          686  +					(long long) request->headers.range.length
   680    687   				);
   681    688   
   682    689   				http_code = 206;
   683    690   			}
   684    691   		} else {
   685    692   			if (request->headers.range.present) {
   686    693   				http_code = 206;