Skip to content

Commit

Permalink
git-svn-id: svn://cherokee-project.com/cherokee/trunk@769 5dc97367-97…
Browse files Browse the repository at this point in the history
…f1-0310-9951-d761b3857238
  • Loading branch information
alobbs committed Jun 1, 2007
1 parent 7ad1414 commit 605e713
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 22 deletions.
15 changes: 15 additions & 0 deletions ChangeLog
@@ -1,3 +1,18 @@
2007-06-01 A.D.F <adefacc@tin.it>

* cherokee/connection.c:
- sparse cleanups;
- cherokee_connection_linger_read(),
retry read only if tmp_buf has been completely filled
so that we spare one read during linger phase
(cherokee_connection_linger_read() is called
in thread.c -> purge_connection() too, so it should
try to read EOF if EOF has not been read yet);

* cherokee/fcgi_manager.c:
- cherokee_fcgi_manager_send_remove(),
removed redundant break (replaced by a return).

2007-05-31 Alvaro Lopez Ortega <alvaro@alobbs.com>

* cherokee/thread.c (process_active_connections): It was not
Expand Down
37 changes: 17 additions & 20 deletions cherokee/connection.c
Expand Up @@ -869,7 +869,7 @@ cherokee_connection_linger_read (cherokee_connection_t *conn)
cherokee_buffer_t *tmp1 = THREAD_TMP_BUF1(thread);

while (true) {
size_t cnt_read = 0;
size_t cnt_read = 0;

/* Read from the socket to nowhere
*/
Expand All @@ -886,14 +886,14 @@ cherokee_connection_linger_read (cherokee_connection_t *conn)
return ret;
case ret_ok:
TRACE(ENTRIES, "read %u, ok\n", cnt_read);
if (cnt_read > 0 && --retries > 0)
if (cnt_read == tmp1->size && --retries > 0)
continue;
return ret;
default:
RET_UNKNOWN(ret);
break;
return ret_error;
}
return ret_error;
/* NOTREACHED */
}
}

Expand Down Expand Up @@ -1031,9 +1031,9 @@ get_encoding (cherokee_connection_t *conn,
}

*end = '\0'; /* (1) */

i1 = ptr;

do {
i2 = strchr (i1, ',');
if (!i2) i2 = strchr (i1, ';');
Expand Down Expand Up @@ -1114,7 +1114,7 @@ get_authorization (cherokee_connection_t *conn,
end = cherokee_min_str (end, end2);
if (end == NULL)
return ret_error;

ptr_len -= (ptr + ptr_len) - end;

/* Skip "Basic " or "Digest "
Expand Down Expand Up @@ -1151,7 +1151,7 @@ get_authorization (cherokee_connection_t *conn,
PRINT_ERROR_S ("Unknown authentication method\n");
return ret_error;
}

return ret_ok;
}

Expand Down Expand Up @@ -1233,7 +1233,7 @@ cherokee_connection_build_local_directory_userdir (cherokee_connection_t *conn,
conn->error_code = http_not_found;
return ret_error;
}

/* Build the local_directory:
*/
cherokee_buffer_add (&conn->local_directory, pwd.pw_dir, strlen(pwd.pw_dir));
Expand Down Expand Up @@ -1265,7 +1265,7 @@ get_range (cherokee_connection_t *conn, char *ptr, int ptr_len)
return ret_error;
}
}

/* Advance the pointer
*/
ptr += num_len;
Expand Down Expand Up @@ -1331,7 +1331,7 @@ post_init (cherokee_connection_t *conn)

memcpy (buf, info, info_len);
buf[info_len] = '\0';

post_len = (off_t) atol(buf);
if (post_len < 0) {
conn->error_code = http_bad_request;
Expand Down Expand Up @@ -1423,7 +1423,7 @@ cherokee_connection_get_request (cherokee_connection_t *conn)
cherokee_post_append (&conn->post, conn->incoming_header.buf + header_len, post_len);
cherokee_buffer_drop_endding (&conn->incoming_header, post_len);
}

/* Copy the request and query string
*/
ret = cherokee_header_copy_request (&conn->header, &conn->request);
Expand Down Expand Up @@ -1478,8 +1478,7 @@ cherokee_connection_get_request (cherokee_connection_t *conn)
/* Userdir requests
*/
if ((!cherokee_buffer_is_empty (&CONN_VSRV(conn)->userdir)) &&
cherokee_connection_is_userdir (conn))
{
cherokee_connection_is_userdir (conn)) {
ret = parse_userdir (conn);
if (ret != ret_ok) return ret;
}
Expand Down Expand Up @@ -1577,8 +1576,7 @@ cherokee_connection_get_dir_entry (cherokee_connection_t *conn, cherokee_dirs_ta
*/
if ((conn->request.len > 1) &&
(cherokee_buffer_end_char (&conn->request) != '/') &&
(cherokee_buffer_cmp_buf (&conn->request, &conn->web_directory) == ret_ok))
{
(cherokee_buffer_cmp_buf (&conn->request, &conn->web_directory) == ret_ok)) {
cherokee_buffer_ensure_size (&conn->redirect, conn->request.len + 4);
cherokee_buffer_add_buffer (&conn->redirect, &conn->request);
cherokee_buffer_add (&conn->redirect, "/", 1);
Expand Down Expand Up @@ -1680,7 +1678,7 @@ cherokee_connection_check_authentication (cherokee_connection_t *conn, cherokee_
if (ret != ret_ok) {
goto unauthorized;
}

/* Create the validator object
*/
ret = config_entry->validator_new_func ((void **) &conn->validator,
Expand All @@ -1698,8 +1696,7 @@ cherokee_connection_check_authentication (cherokee_connection_t *conn, cherokee_

/* Check if the user is in the list
*/
if (config_entry->users != NULL)
{
if (config_entry->users != NULL) {
void *foo;

if (cherokee_buffer_is_empty (&conn->validator->user)) {
Expand Down Expand Up @@ -1921,7 +1918,7 @@ cherokee_connection_log_or_delay (cherokee_connection_t *conn)
at_end = true;
else
at_end = ! HANDLER_SUPPORT_LENGTH(conn->handler);

/* Set the option bit mask
*/
if (at_end)
Expand Down
3 changes: 1 addition & 2 deletions cherokee/fcgi_manager.c
Expand Up @@ -485,9 +485,8 @@ cherokee_fcgi_manager_send_remove (cherokee_fcgi_manager_t *mgr, cherokee_buffer
return ret;
default:
RET_UNKNOWN(ret);
return ret;
}

return ret_ok;
}


Expand Down

0 comments on commit 605e713

Please sign in to comment.