Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Cherokee: commits

r240 - in cherokee: . cherokee

 

 

Cherokee commits RSS feed   Index | Next | Previous | View Threaded


alo at alobbs

Apr 1, 2006, 2:19 AM

Post #1 of 1 (72 views)
Permalink
r240 - in cherokee: . cherokee

Author: alo
Date: 2006-04-01 11:19:55 +0200 (Sat, 01 Apr 2006)
New Revision: 240

Modified:
cherokee/ChangeLog
cherokee/cherokee/connection.c
cherokee/cherokee/header-protected.h
cherokee/cherokee/header.c
Log:


Modified: cherokee/ChangeLog
===================================================================
--- cherokee/ChangeLog 2006-04-01 00:25:40 UTC (rev 239)
+++ cherokee/ChangeLog 2006-04-01 09:19:55 UTC (rev 240)
@@ -1,5 +1,7 @@
2006-04-01 Alvaro Lopez Ortega <alvaro at alobbs.com>

+ * cherokee/connection.c (get_host): Little clean up.
+
* cherokee/handler_error.c (build_hardcoded_response_page): It was
missing a break. Patch by Philip Pemberton <philpem at dsl.pipex.com>


Modified: cherokee/cherokee/connection.c
===================================================================
--- cherokee/cherokee/connection.c 2006-04-01 00:25:40 UTC (rev 239)
+++ cherokee/cherokee/connection.c 2006-04-01 09:19:55 UTC (rev 240)
@@ -905,25 +905,30 @@
char *ptr,
int size)
{
- char *end;
- char *end2;
- ret_t ret;
+ ret_t ret;
+ char *i;
+ char *end = ptr + size;
+ cuint_t skip = 0;

- /* Drop the port if present
- * Eg: www.alobbs.com:8080 -> www.alobbs.com
- */
- end = end2 = ptr + size;
- while ((*end2 != ':') && (end2 > ptr)) end2--;
- if (*end2 == ':') end = end2;
+ /* Sanity check
+ */
+ if (size <= 0) return ret_error;

- /* Sanity check: Is the host name empty?
+ /* Skip "colon + port"
*/
- if (unlikely(end - ptr == 0)) return ret_error;
+ for (i=end; i>=ptr; i--) {
+ if (*i == ':') {
+ skip = end - i;
+ break;
+ }
+ }

/* Copy the string
*/
- size = (end - ptr);
- ret = cherokee_buffer_add (&cnt->host, ptr, size);
+ if (unlikely (size - skip) <= 0)
+ return ret_error;
+
+ ret = cherokee_buffer_add (&cnt->host, ptr, size - skip);
if (unlikely(ret < ret_ok)) return ret;

/* Security check: Hostname shouldn't start with a dot
@@ -940,6 +945,7 @@
return ret_ok;
}

+
static inline ret_t
get_encoding (cherokee_connection_t *cnt,
char *ptr,

Modified: cherokee/cherokee/header-protected.h
===================================================================
--- cherokee/cherokee/header-protected.h 2006-04-01 00:25:40 UTC (rev 239)
+++ cherokee/cherokee/header-protected.h 2006-04-01 09:19:55 UTC (rev 240)
@@ -52,7 +52,7 @@
/* Unknown headers
*/
cherokee_header_unknown_entry_t *unknowns;
- int unknowns_len;
+ cint_t unknowns_len;

/* Properties
*/
@@ -62,20 +62,20 @@

/* Request
*/
- off_t request_off;
- int request_len;
- int request_args_len;
+ off_t request_off;
+ cint_t request_len;
+ cint_t request_args_len;

/* Query string
*/
- off_t query_string_off;
- int query_string_len;
+ off_t query_string_off;
+ cint_t query_string_len;

/* Debug & sanity checks
*/
- cherokee_buffer_t *input_buffer;
- crc_t input_buffer_crc;
- uint32_t input_header_len;
+ cherokee_buffer_t *input_buffer;
+ crc_t input_buffer_crc;
+ uint32_t input_header_len;

};


Modified: cherokee/cherokee/header.c
===================================================================
--- cherokee/cherokee/header.c 2006-04-01 00:25:40 UTC (rev 239)
+++ cherokee/cherokee/header.c 2006-04-01 09:19:55 UTC (rev 240)
@@ -115,7 +115,7 @@
*/
hdr->query_string_off = 0;
hdr->query_string_len = 0;
-
+
/* Sanity
*/
hdr->input_buffer = NULL;
@@ -441,8 +441,8 @@
*/
begin = buf->buf + hdr->request_off;
if (cmp_str (begin, "http://")) {
- char *dir;
- char *host = begin + 7;
+ char *dir;
+ char *host = begin + 7;

dir = strchr (host, '/');
if (dir == NULL) goto error;

Cherokee commits RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.