Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

git-svn-id: svn://cherokee-project.com/cherokee/trunk@646 5dc97367-97…

…f1-0310-9951-d761b3857238
  • Loading branch information...
commit dab8c81078e30ea38200e70983a6d4034a54c42f 1 parent 691a8a9
@alobbs alobbs authored
View
14 ChangeLog
@@ -1,3 +1,17 @@
+2007-02-18 A.D.F <adefacc@tin.it>
+
+ * cherokee/post.h, cherokee/post.c cherokee/connection.c,
+ cherokee/handler_admin.c:
+ - use off_t instead of offset_t in order
+ to compile cherokee when off_t has a size of 4 bytes
+ instead of 8 (i.e. on embedded systems or when
+ --disable-largefile is given on configure command line).
+
+ * cherokee/connection-protected.h:
+ - don't use "enum" for bit flags because more than
+ one option can be set, so its better to explicitely use
+ an unsigned int as data type.
+
2007-02-16 Alvaro Lopez Ortega <alvaro@alobbs.com>
* configure.in: GNUTLS detection is now based on PKG_CHECK_MODULES
View
4 cherokee/buffer.c
@@ -1605,8 +1605,8 @@ cherokee_buffer_replace_string (cherokee_buffer_t *buf,
/* Substitute (substring)s found in (bufsrc) with (replacement)
* and writes the resulting content to (bufdst).
- * NOTE: (bufdst) is written only if at least on (substring) instance
- * is found in (bufsrc), in this case return value is ret_ok;
+ * NOTE: (bufdst) is written only if at least one (substring) instance
+ * is found in (bufsrc); in that case return value is ret_ok;
* if (substring) is NOT found in (bufsrc) then nothing is done
* in order to avoid an unnecessary copy of data.
* Returns:
View
13 cherokee/connection-protected.h
@@ -81,12 +81,13 @@ typedef enum {
phase_lingering
} cherokee_connection_phase_t;
-typedef enum {
- conn_op_nothing = 0,
- conn_op_log_at_end = (1 << 0),
- conn_op_root_index = (1 << 1),
- conn_op_tcp_cork = (1 << 2)
-} cherokee_connection_options_t;
+
+#define conn_op_nothing 0
+#define conn_op_log_at_end (1 << 0)
+#define conn_op_root_index (1 << 1)
+#define conn_op_tcp_cork (1 << 2)
+
+typedef cuint_t cherokee_connection_options_t;
struct cherokee_connection {
View
7 cherokee/connection.c
@@ -1285,7 +1285,7 @@ static ret_t
post_init (cherokee_connection_t *conn)
{
ret_t ret;
- long post_len;
+ off_t post_len;
char *info = NULL;
cuint_t info_len = 0;
CHEROKEE_TEMP(buf, 64);
@@ -1308,7 +1308,7 @@ post_init (cherokee_connection_t *conn)
memcpy (buf, info, info_len);
buf[info_len] = '\0';
- post_len = atol(buf);
+ post_len = (off_t) atol(buf);
if (post_len < 0) {
conn->error_code = http_bad_request;
return ret_error;
@@ -1442,7 +1442,8 @@ cherokee_connection_get_request (cherokee_connection_t *conn)
/* Set the virtual server reference
*/
- cherokee_server_get_vserver (CONN_SRV(conn), &conn->host, &conn->vserver);
+ cherokee_server_get_vserver (CONN_SRV(conn), &conn->host,
+ (cherokee_virtual_server_t **) &conn->vserver);
break;
default:
View
10 cherokee/handler_admin.c
@@ -123,7 +123,7 @@ ret_t
cherokee_handler_admin_init (cherokee_handler_admin_t *ahdl)
{
char *tmp;
- offset_t postl;
+ off_t postl;
ret_t ret = ret_ok;
cherokee_buffer_t post = CHEROKEE_BUF_INIT;
cherokee_buffer_t line = CHEROKEE_BUF_INIT;
@@ -132,14 +132,14 @@ cherokee_handler_admin_init (cherokee_handler_admin_t *ahdl)
/* Check for the post info
*/
cherokee_post_get_len (&conn->post, &postl);
- if (postl <= 0) {
+ if (postl <= 0 || postl >= (INT_MAX-1)) {
conn->error_code = http_bad_request;
return ret_error;
}
/* Process line per line
*/
- cherokee_post_walk_read (&conn->post, &post, postl);
+ cherokee_post_walk_read (&conn->post, &post, (cuint_t) postl);
for (tmp = post.buf;;) {
char *end1 = strchr (tmp, CHR_LF);
@@ -163,12 +163,12 @@ cherokee_handler_admin_init (cherokee_handler_admin_t *ahdl)
ret = ret_error;
goto go_out;
}
-
+
/* Clean up for the next iteration
*/
cherokee_buffer_clean (&line);
}
-
+
go_out:
cherokee_buffer_mrproper (&post);
cherokee_buffer_mrproper (&line);
View
12 cherokee/post.c
@@ -74,7 +74,7 @@ cherokee_post_mrproper (cherokee_post_t *post)
ret_t
-cherokee_post_set_len (cherokee_post_t *post, offset_t len)
+cherokee_post_set_len (cherokee_post_t *post, off_t len)
{
post->type = (len > POST_SIZE_TO_DISK) ? post_in_tmp_file : post_in_memory;
post->size = len;
@@ -82,15 +82,15 @@ cherokee_post_set_len (cherokee_post_t *post, offset_t len)
if (post->type == post_in_tmp_file) {
char *ptr;
char template[64];
-
+
strncpy (template, "/tmp/cherokee_post_XXXXXX", sizeof(template));
-
+
/* Generate a unique name
*/
ptr = mktemp (template);
if (unlikely (ptr == NULL))
return ret_error;
-
+
cherokee_buffer_add (&post->tmp_file, ptr, strlen(ptr));
/* Open the file for writting
@@ -99,7 +99,7 @@ cherokee_post_set_len (cherokee_post_t *post, offset_t len)
if (unlikely (post->tmp_file_p == NULL))
return ret_error;
}
-
+
return ret_ok;
}
@@ -118,7 +118,7 @@ cherokee_post_got_all (cherokee_post_t *post)
}
ret_t
-cherokee_post_get_len (cherokee_post_t *post, offset_t *len)
+cherokee_post_get_len (cherokee_post_t *post, off_t *len)
{
*len = post->size;
return ret_ok;
View
4 cherokee/post.h
@@ -60,8 +60,8 @@ ret_t cherokee_post_mrproper (cherokee_post_t *post);
int cherokee_post_is_empty (cherokee_post_t *post);
int cherokee_post_got_all (cherokee_post_t *post);
-ret_t cherokee_post_set_len (cherokee_post_t *post, offset_t len);
-ret_t cherokee_post_get_len (cherokee_post_t *post, offset_t *len);
+ret_t cherokee_post_set_len (cherokee_post_t *post, off_t len);
+ret_t cherokee_post_get_len (cherokee_post_t *post, off_t *len);
ret_t cherokee_post_append (cherokee_post_t *post, char *str, size_t len);
ret_t cherokee_post_commit_buf (cherokee_post_t *post, size_t len);
Please sign in to comment.
Something went wrong with that request. Please try again.