Changeset 639
- Timestamp:
- 02/04/07 22:21:29 (2 years ago)
- Files:
-
- cherokee/trunk/ChangeLog (modified) (1 diff)
- cherokee/trunk/cherokee/buffer.h (modified) (1 diff)
- cherokee/trunk/cherokee/connection-protected.h (modified) (2 diffs)
- cherokee/trunk/cherokee/connection.c (modified) (8 diffs)
- cherokee/trunk/cherokee/connection.h (modified) (1 diff)
- cherokee/trunk/cherokee/handler_cgi_base.c (modified) (1 diff)
- cherokee/trunk/cherokee/handler_common.c (modified) (2 diffs)
- cherokee/trunk/cherokee/handler_file.c (modified) (1 diff)
- cherokee/trunk/cherokee/macros.h (modified) (1 diff)
- cherokee/trunk/cherokee/thread.c (modified) (1 diff)
- cherokee/trunk/qa/run-tests.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/trunk/ChangeLog
r638 r639 1 2007-02-02 Alvaro Lopez Ortega <alvaro@alobbs.com> 2 3 * qa/run-tests.py: Fixed to work just with "-v" (without 4 specifying with valgrind tool it should use). 5 6 * cherokee/handler_file.c (cherokee_handler_file_step): Updated to 7 the latest conn->option and tcp_cork changes. 8 9 * cherokee/connection.h, 10 cherokee/connection.c (cherokee_connection_set_cork): Now the 11 "enable" parameter is cherokee_boolean_t rather than int. 12 13 * cherokee/connection-protected.h: Added new enum type 14 cherokee_connection_options_t and a new property "options" to the 15 connection class. 16 17 18 * cherokee/handler_common.c (cherokee_handler_common_new): If the 19 connection needs to be redirected/reprocessed, it copys the 20 request to the request_original and sets a flag if it's a 21 redirection to a index file starting by / (fullpath index file). 22 23 * cherokee/handler_cgi_base.c (cherokee_handler_cgi_base_build_basic_env): 24 Checks the connection options. If it has been redirected from a 25 "common" handler and targets a fullpath index, it seems to need to 26 use the original request as the REQUEST_URI. 27 28 * cherokee/macros.h (BIT_SET, BIT_UNSET): Added new macros to ease 29 bit masks manupulation. 30 31 * cherokee/connection-protected.h: log_at_end and tcp_cork 32 properties have been removed. Now they're bits in the options 33 entry. 34 35 * cherokee/connection.c (cherokee_connection_log_or_delay, 36 cherokee_connection_log_delayed): Rewritten using the option 37 property. 38 1 39 2007-01-30 A.D.F <adefacc@tin.it> 2 40 cherokee/trunk/cherokee/buffer.h
r624 r639 102 102 ret_t cherokee_buffer_ensure_size (cherokee_buffer_t *buf, size_t size); 103 103 104 int cherokee_buffer_is_endding(cherokee_buffer_t *buf, char c);105 char cherokee_buffer_end_char(cherokee_buffer_t *buf);104 int cherokee_buffer_is_endding (cherokee_buffer_t *buf, char c); 105 char cherokee_buffer_end_char (cherokee_buffer_t *buf); 106 106 size_t cherokee_buffer_cnt_spn (cherokee_buffer_t *buf, int offset, char *str); 107 107 size_t cherokee_buffer_cnt_cspn (cherokee_buffer_t *buf, int offset, char *str); cherokee/trunk/cherokee/connection-protected.h
r637 r639 82 82 } cherokee_connection_phase_t; 83 83 84 typedef enum { 85 conn_op_nothing = 0, 86 conn_op_log_at_end = 1, 87 conn_op_root_index = 1 << 1, 88 conn_op_tcp_cork = 1 << 2 89 } cherokee_connection_options_t; 90 84 91 85 92 struct cherokee_connection { … … 99 106 */ 100 107 cherokee_socket_t socket; 101 int tcp_cork;108 cherokee_http_upgrade_t upgrade; 102 109 103 110 cherokee_logger_t *logger_ref; 104 int log_at_end;105 106 111 cherokee_handler_t *handler; 107 cherokee_ http_upgrade_t upgrade;112 cherokee_connection_options_t options; 108 113 109 114 /* Buffers cherokee/trunk/cherokee/connection.c
r637 r639 92 92 INIT_LIST_HEAD(&n->list_entry); 93 93 94 n->tcp_cork = 0;95 94 n->error_code = http_ok; 96 95 n->phase = phase_reading_header; … … 99 98 n->req_auth_type = http_auth_nothing; 100 99 n->upgrade = http_upgrade_nothing; 100 n->options = conn_op_nothing; 101 101 n->handler = NULL; 102 102 n->encoder = NULL; … … 106 106 n->range_end = 0; 107 107 n->vserver = NULL; 108 n->log_at_end = 1;109 108 n->arguments = NULL; 110 109 n->realm_ref = NULL; … … 228 227 conn->req_auth_type = http_auth_nothing; 229 228 conn->upgrade = http_upgrade_nothing; 229 conn->options = conn_op_nothing; 230 230 conn->error_code = http_ok; 231 231 conn->range_start = 0; 232 232 conn->range_end = 0; 233 233 conn->logger_ref = NULL; 234 conn->tcp_cork = 0;235 conn->log_at_end = 1;236 234 conn->realm_ref = NULL; 237 235 conn->mmaped = NULL; … … 735 733 736 734 ret_t 737 cherokee_connection_set_cork (cherokee_connection_t *conn, int enable)735 cherokee_connection_set_cork (cherokee_connection_t *conn, cherokee_boolean_t enable) 738 736 { 739 737 int on = 0; … … 754 752 } 755 753 756 conn->tcp_cork = enable;754 BIT_SET (conn->options, conn_op_tcp_cork); 757 755 #endif 758 756 … … 1888 1886 cherokee_connection_log_or_delay (cherokee_connection_t *conn) 1889 1887 { 1890 ret_t ret = ret_ok; 1891 1892 if (conn->handler == NULL) { 1893 conn->log_at_end = 0; 1888 ret_t ret; 1889 cherokee_boolean_t at_end; 1890 1891 /* Check whether it should log at end or not.. 1892 */ 1893 if (conn->handler == NULL) 1894 at_end = true; 1895 else 1896 at_end = ! HANDLER_SUPPORT_LENGTH(conn->handler); 1897 1898 /* Set the option bit mask 1899 */ 1900 if (at_end) 1901 BIT_SET (conn->options, conn_op_log_at_end); 1902 else 1903 BIT_UNSET (conn->options, conn_op_log_at_end); 1904 1905 /* Return if there is no logger or has to log_at_end 1906 */ 1907 if (conn->logger_ref == NULL) 1908 return ret_ok; 1909 if (conn->options & conn_op_log_at_end) 1910 return ret_ok; 1911 1912 /* Log it 1913 */ 1914 if (http_type_400(conn->error_code) || 1915 http_type_500(conn->error_code)) { 1916 ret = cherokee_logger_write_error (conn->logger_ref, conn); 1894 1917 } else { 1895 conn->log_at_end = ! HANDLER_SUPPORT_LENGTH(conn->handler); 1896 } 1897 1898 if (conn->log_at_end == 0) { 1899 if (conn->logger_ref != NULL) { 1900 if (http_type_400(conn->error_code) || 1901 http_type_500(conn->error_code)) { 1902 ret = cherokee_logger_write_error (conn->logger_ref, conn); 1903 } else { 1904 ret = cherokee_logger_write_access (conn->logger_ref, conn); 1905 } 1906 conn->log_at_end = 0; 1907 } 1918 ret = cherokee_logger_write_access (conn->logger_ref, conn); 1908 1919 } 1909 1920 … … 1915 1926 cherokee_connection_log_delayed (cherokee_connection_t *conn) 1916 1927 { 1917 ret_t ret = ret_ok; 1918 1919 if ((conn->log_at_end) && (conn->logger_ref)) { 1920 ret = cherokee_logger_write_access (conn->logger_ref, conn); 1921 conn->log_at_end = false; 1922 } 1923 1924 return ret; 1928 ret_t ret; 1929 1930 /* Check whether if needs to log now of not 1931 */ 1932 if (conn->logger_ref == NULL) 1933 return ret_ok; 1934 if (! (conn->options & conn_op_log_at_end)) 1935 return ret_ok; 1936 1937 /* Log it 1938 */ 1939 BIT_UNSET (conn->options, conn_op_log_at_end); 1940 1941 ret = cherokee_logger_write_access (conn->logger_ref, conn); 1942 if (unlikely (ret != ret_ok)) return ret; 1943 1944 return ret_ok; 1925 1945 } 1926 1946 cherokee/trunk/cherokee/connection.h
r597 r639 42 42 /* Public methods 43 43 */ 44 ret_t cherokee_connection_set_cork (cherokee_connection_t *cnt, int enable);44 ret_t cherokee_connection_set_cork (cherokee_connection_t *cnt, cherokee_boolean_t enable); 45 45 ret_t cherokee_connection_parse_args (cherokee_connection_t *cnt); 46 46 cherokee/trunk/cherokee/handler_cgi_base.c
r638 r639 345 345 set_env (cgi, "PATH_INFO", "", 0); 346 346 347 /* Set REQUEST_URI 348 */ 349 { 350 cherokee_handler_cgi_base_props_t *cgi_props = HANDLER_CGI_BASE_PROPS(cgi); 351 printf ("script_name %s\n", cgi_props->script_alias.buf); 352 } 353 347 /* Set REQUEST_URI: 348 * 349 * Use request + query_string unless the connections has been 350 * redirected from common and targets a full path index file. 351 */ 354 352 cherokee_buffer_clean (tmp); 355 // cherokee_header_copy_request_w_args (&conn->header, tmp); 356 cherokee_buffer_add_buffer (tmp, &conn->request); 357 if (! cherokee_buffer_is_empty (&conn->query_string)) { 358 cherokee_buffer_add_char (tmp, '?'); 359 cherokee_buffer_add_buffer (tmp, &conn->query_string); 353 354 if (conn->options & conn_op_root_index) { 355 cherokee_header_copy_request_w_args (&conn->header, tmp); 356 } 357 else { 358 cherokee_buffer_add_buffer (tmp, &conn->request); 359 if (! cherokee_buffer_is_empty (&conn->query_string)) { 360 cherokee_buffer_add_char (tmp, '?'); 361 cherokee_buffer_add_buffer (tmp, &conn->query_string); 362 } 360 363 } 361 364 set_env (cgi, "REQUEST_URI", tmp->buf, tmp->len); cherokee/trunk/cherokee/handler_common.c
r606 r639 283 283 */ 284 284 cherokee_buffer_clean (&conn->local_directory); 285 cherokee_buffer_clean (&conn->request_original); 286 cherokee_buffer_add_buffer (&conn->request_original, &conn->request); 287 285 288 cherokee_buffer_clean (&conn->request); 286 289 cherokee_buffer_add (&conn->request, index, index_len); … … 288 291 TRACE (ENTRIES, "top level index matched %s\n", index); 289 292 293 BIT_SET (conn->options, conn_op_root_index); 290 294 return ret_eagain; 291 295 } 292 296 293 /* Stat() the possible new path297 /* stat() the possible new path 294 298 */ 295 299 cherokee_buffer_add (&conn->local_directory, index, index_len); cherokee/trunk/cherokee/handler_file.c
r597 r639 672 672 * off again the TCP_CORK flag 673 673 */ 674 if (conn-> tcp_cork) {675 cherokee_connection_set_cork (conn, 0);674 if (conn->options & conn_op_tcp_cork) { 675 cherokee_connection_set_cork (conn, false); 676 676 } 677 677 cherokee/trunk/cherokee/macros.h
r638 r639 235 235 #define INT_TO_POINTER(integer) ((void*)((long)(integer))) 236 236 237 /* Bit masks 238 */ 239 #define BIT_SET(var,bit) var |= bit 240 #define BIT_UNSET(var,bit) var &= (~bit) 237 241 238 242 /* Format string for off_t and size_t cherokee/trunk/cherokee/thread.c
r637 r639 500 500 /* TCP cork 501 501 */ 502 if (conn-> tcp_cork) {503 cherokee_connection_set_cork (conn, 0);502 if (conn->options & conn_op_tcp_cork) { 503 cherokee_connection_set_cork (conn, false); 504 504 } 505 505 cherokee/trunk/qa/run-tests.py
r610 r639 200 200 pid = os.fork() 201 201 if pid == 0: 202 if valgrind :202 if valgrind != None: 203 203 if valgrind[:3] == 'hel': 204 204 os.execl (VALGRIND_PATH, "valgrind", "--tool=helgrind", server, "-C", cfg_file)