Project

General

Profile

mod_accesslog.patch

liming, 2009-12-31 03:46

View differences:

mod_accesslog.c.new 2009-12-31 11:39:58.000000000 +0800
65 65
			FORMAT_BYTES_IN,
66 66
			FORMAT_BYTES_OUT,
67 67

  
68
			FORMAT_RESPONSE_HEADER
68
			FORMAT_RESPONSE_HEADER,
69
			FORMAT_COMPRESS_RATIO
69 70
	} type;
70 71
} format_mapping;
71 72

  
......
97 98
	{ 'f', FORMAT_FILENAME },
98 99
	{ 'H', FORMAT_REQUEST_PROTOCOL },
99 100
	{ 'm', FORMAT_REQUEST_METHOD },
100
	{ 'n', FORMAT_UNSUPPORTED }, /* we have no notes */
101
	{ 'n', FORMAT_COMPRESS_RATIO }, 
101 102
	{ 'p', FORMAT_SERVER_PORT },
102 103
	{ 'P', FORMAT_UNSUPPORTED }, /* we are only one process */
103 104
	{ 'q', FORMAT_QUERY_STRING },
......
847 848
				default: buffer_append_string_len(b, CONST_STR_LEN("+")); break;
848 849
				}
849 850
				break;
851
			case FORMAT_COMPRESS_RATIO:
852
				if (!con->send || con->send->bytes_out == 0 || con->bytes_written < con->bytes_header) {
853
					buffer_append_string_len(b, CONST_STR_LEN("-"));
854
				}
855
				else {
856
					buffer_append_long(b, (con->bytes_written - con->bytes_header) * 100
857
						/ con->send->bytes_out);
858
				}
859
				break;
850 860
			default:
851 861
				/*
852 862
				 { 'a', FORMAT_REMOTE_ADDR },