Changeset 855
- Timestamp:
- 07/22/07 22:06:08 (1 year ago)
- Files:
-
- cherokee/trunk/ChangeLog (modified) (1 diff)
- cherokee/trunk/cherokee/Makefile.am (modified) (1 diff)
- cherokee/trunk/cherokee/buffer.c (modified) (3 diffs)
- cherokee/trunk/cherokee/buffer.h (modified) (1 diff)
- cherokee/trunk/cherokee/buffer_escape.c (deleted)
- cherokee/trunk/cherokee/buffer_escape.h (deleted)
- cherokee/trunk/cherokee/connection-protected.h (modified) (2 diffs)
- cherokee/trunk/cherokee/connection.c (modified) (4 diffs)
- cherokee/trunk/cherokee/handler_error.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/trunk/ChangeLog
r853 r855 1 2007-07-22 Alvaro Lopez Ortega <alvaro@alobbs.com> 2 3 * cherokee/handler_error.c (build_hardcoded_response_page), 4 cherokee/connection-protected.h, cherokee/connection.c: Adapted to 5 the new cherokee_buffer_escape_html() interface and the 6 buffer_escape removal. 7 8 * cherokee/buffer_escape.h, cherokee/buffer_escape.c, 9 cherokee/Makefile.am: Removed. This class was a mistake and 10 should no longer exist. 11 12 * cherokee/buffer.c (cherokee_buffer_escape_html), 13 cherokee/buffer.h: Reworked: instead the allocating a new buffer 14 it generates the escaped version inside the second buffer provided 15 as argument. 16 1 17 2007-07-21 Alvaro Lopez Ortega <alvaro@alobbs.com> 2 18 cherokee/trunk/cherokee/Makefile.am
r841 r855 727 727 buffer.h \ 728 728 buffer.c \ 729 buffer_escape.h \730 buffer_escape.c \731 729 socket.h \ 732 730 socket.c \ cherokee/trunk/cherokee/buffer.c
r854 r855 1071 1071 1072 1072 ret_t 1073 cherokee_buffer_escape_html (cherokee_buffer_t *buf, cherokee_buffer_t * *maybe_new)1073 cherokee_buffer_escape_html (cherokee_buffer_t *buf, cherokee_buffer_t *src) 1074 1074 { 1075 1075 ret_t ret; … … 1082 1082 * we assume there are no '\0' inside buffer. 1083 1083 */ 1084 if ( buf->buf[buf->len] != '\0')1085 buf->buf[buf->len] = '\0';1084 if (src->buf[src->len] != '\0') 1085 src->buf[src->len] = '\0'; 1086 1086 1087 1087 /* Verify if string has to be escaped. 1088 1088 */ 1089 if ((p0 = strpbrk (buf->buf, "<>&\"")) == NULL)1089 if ((p0 = strpbrk (src->buf, "<>&\"")) == NULL) 1090 1090 return ret_not_found; 1091 1091 … … 1111 1111 /* Verify there are no embedded '\0'. 1112 1112 */ 1113 if ( ((int) (p - buf->buf)) != buf->len)1113 if ( ((int) (p - src->buf)) != src->len) 1114 1114 return ret_error; 1115 1115 1116 /* Create a new buffer 1117 */ 1118 ret = cherokee_buffer_new (maybe_new); 1119 if (unlikely (ret != ret_ok)) 1120 return ret; 1121 1122 ret = cherokee_buffer_ensure_size (*maybe_new, buf->len + extra + 1); 1123 if (unlikely (ret != ret_ok)) 1124 return ret; 1125 1126 ret = cherokee_buffer_add_buffer (*maybe_new, buf); 1127 if (unlikely (ret != ret_ok)) 1128 return ret; 1129 1130 buf = *maybe_new; 1116 /* Copy the buffer 1117 */ 1118 cherokee_buffer_clean (buf); 1119 1120 ret = cherokee_buffer_ensure_size (buf, src->len + extra + 1); 1121 if (ret != ret_ok) return ret; 1122 1123 ret = cherokee_buffer_add_buffer (buf, src); 1124 if (ret != ret_ok) return ret; 1131 1125 1132 1126 /* Make the changes cherokee/trunk/cherokee/buffer.h
r854 r855 115 115 ret_t cherokee_buffer_decode_hex (cherokee_buffer_t *buf); 116 116 ret_t cherokee_buffer_unescape_uri (cherokee_buffer_t *buf); 117 ret_t cherokee_buffer_escape_html (cherokee_buffer_t *buf, cherokee_buffer_t * *maybe_new);117 ret_t cherokee_buffer_escape_html (cherokee_buffer_t *buf, cherokee_buffer_t *src); 118 118 ret_t cherokee_buffer_add_comma_marks (cherokee_buffer_t *buf); 119 119 cherokee/trunk/cherokee/connection-protected.h
r835 r855 53 53 #include "list.h" 54 54 #include "avl.h" 55 #include "buffer_escape.h"55 //#include "buffer_escape.h" 56 56 #include "socket.h" 57 57 #include "header.h" … … 148 148 cherokee_buffer_t effective_directory; 149 149 cherokee_buffer_t redirect; 150 151 /* Espace versions152 */153 150 cherokee_buffer_t request_original; 154 cherokee_buffer_escape_t *request_escape; /* Buffer escape for the request */155 151 156 152 /* Authentication cherokee/trunk/cherokee/connection.c
r854 r855 70 70 #include "handler_error.h" 71 71 #include "buffer.h" 72 #include "buffer_escape.h"73 72 #include "config_entry.h" 74 73 #include "encoder_table.h" … … 140 139 cherokee_buffer_init (&n->request_original); 141 140 142 cherokee_buffer_escape_new (&n->request_escape);143 cherokee_buffer_escape_set_ref (n->request_escape, &n->request);144 145 141 cherokee_socket_init (&n->socket); 146 142 cherokee_header_init (&n->header); … … 170 166 cherokee_post_mrproper (&conn->post); 171 167 172 cherokee_buffer_escape_free (conn->request_escape);173 168 cherokee_buffer_mrproper (&conn->request); 174 169 cherokee_buffer_mrproper (&conn->request_original); … … 262 257 263 258 cherokee_buffer_clean (&conn->request); 264 cherokee_buffer_escape_clean (conn->request_escape);265 cherokee_buffer_escape_set_ref (conn->request_escape, &conn->request);266 259 267 260 #ifdef CHEROKEE_EMBEDDED cherokee/trunk/cherokee/handler_error.c
r597 r855 84 84 build_hardcoded_response_page (cherokee_connection_t *cnt, cherokee_buffer_t *buffer) 85 85 { 86 cherokee_buffer_t *escaped = NULL;86 cherokee_buffer_t tmp = CHEROKEE_BUF_INIT; 87 87 88 88 /* Avoid too many reallocations. … … 113 113 case http_not_found: 114 114 if (! cherokee_buffer_is_empty (&cnt->request)) { 115 cherokee_buffer_t *req_html_ref = NULL; 116 117 if (!cherokee_buffer_is_empty (&cnt->request_original)) 118 cherokee_buffer_escape_set_ref (cnt->request_escape, &cnt->request_original); 119 120 cherokee_buffer_escape_get_html (cnt->request_escape, &req_html_ref); 121 122 cherokee_buffer_ensure_addlen (buffer, 19 + req_html_ref->len + 30); 115 cherokee_buffer_escape_html (&tmp, &cnt->request); 116 117 cherokee_buffer_ensure_addlen (buffer, 19 + tmp.len + 30); 123 118 cherokee_buffer_add_str (buffer, "The requested URL "); 124 cherokee_buffer_add_buffer (buffer, req_html_ref);119 cherokee_buffer_add_buffer (buffer, &tmp); 125 120 cherokee_buffer_add_str (buffer, " was not found on this server."); 126 121 } … … 131 126 "Your browser sent a request that this server could not understand."); 132 127 133 cherokee_buffer_escape_html (cnt->header.input_buffer, &escaped); 134 if (escaped == NULL) { 135 cherokee_buffer_add_str (buffer, "<p><pre>"); 136 cherokee_buffer_add_buffer(buffer, cnt->header.input_buffer); 137 cherokee_buffer_add_str (buffer, "</pre>"); 138 } else { 139 cherokee_buffer_add_str (buffer, "<p><pre>"); 140 cherokee_buffer_add_buffer(buffer, escaped); 141 cherokee_buffer_add_str (buffer, "</pre>"); 142 cherokee_buffer_free (escaped); 143 escaped = NULL; 144 } 128 cherokee_buffer_escape_html (&tmp, cnt->header.input_buffer); 129 cherokee_buffer_add_str (buffer, "<p><pre>"); 130 cherokee_buffer_add_buffer(buffer, &tmp); 131 cherokee_buffer_add_str (buffer, "</pre>"); 145 132 break; 146 133 … … 202 189 cherokee_buffer_add_str (buffer, CRLF "</body>" CRLF "</html>" CRLF); 203 190 191 cherokee_buffer_mrproper (&tmp); 204 192 return ret_ok; 205 193 }