Permalink
Browse files

git-svn-id: svn://cherokee-project.com/cherokee/trunk@2469 5dc97367-9…

…7f1-0310-9951-d761b3857238
  • Loading branch information...
1 parent 8f8dd8a commit d4a389c4e6b4c6d7aa533940ba2ee5076b20f9c4 @alobbs alobbs committed Nov 25, 2008
View
@@ -1,5 +1,13 @@
2008-11-25 Alvaro Lopez Ortega <alvaro@octality.com>
+ * cherokee/http.c, cherokee/handler_cgi_base.c,
+ cherokee/handler_proxy.c, cherokee/connection.c: A few small (but
+ quite visible) bugs have been fixed.
+
+ * qa/154-DirRedirection., qa/155-DirRedirection2.py,
+ qa/123-ImplicitRedit.py, qa/173-Chunked-SCGI.py: These QA tests
+ have been slightly adapted so they can be run thru a proxy.
+
* cherokee/Makefile.MingW.in: Removed.
2008-11-25 Taher Shihadeh <taher@unixwars.com>
View
@@ -616,8 +616,9 @@ build_response_header (cherokee_connection_t *conn, cherokee_buffer_t *buffer)
ret_t
cherokee_connection_build_header (cherokee_connection_t *conn)
{
- ret_t ret;
-
+ ret_t ret;
+ cherokee_boolean_t try_chunked = false;
+
/* If the handler requires not to add headers, exit.
*/
if (HANDLER_SUPPORTS (conn->handler, hsupport_skip_headers))
@@ -644,11 +645,18 @@ cherokee_connection_build_header (cherokee_connection_t *conn)
*/
if ((conn->keepalive != 0) &&
(http_method_with_body (conn->error_code)))
- {
- if ((! HANDLER_SUPPORTS (conn->handler, hsupport_length)) ||
- ((HANDLER_SUPPORTS (conn->handler, hsupport_maybe_length)) &&
- (! strcasestr (conn->header_buffer.buf, "Content-Length: "))))
- {
+ {
+ if (HANDLER_SUPPORTS (conn->handler, hsupport_maybe_length)) {
+ if (! strcasestr (conn->header_buffer.buf, "Content-Length: ")) {
+ try_chunked = true;
+ }
+ } else if (! HANDLER_SUPPORTS (conn->handler, hsupport_length)) {
+ try_chunked = true;
+ }
+
+ if (try_chunked) {
+ /* Turn chunked encoding on, if possible
+ */
conn->chunked_encoding = ((CONN_SRV(conn)->chunked_encoding) &&
(conn->header.version == http_version_11));
@@ -315,7 +315,7 @@ cherokee_handler_cgi_base_build_basic_env (
}
}
- /* Content-Type and Content-Length (if available)
+ /* Content-Type
*/
cherokee_buffer_clean (tmp);
ret = cherokee_header_copy_unknown (&conn->header, "Content-Type", 12, tmp);
View
@@ -250,6 +250,7 @@ build_request (cherokee_handler_proxy_t *hdl,
const char *str;
char *begin;
char *end;
+ cuint_t header_len;
char *header_end;
cherokee_list_t *i;
char *ptr;
@@ -313,6 +314,13 @@ build_request (cherokee_handler_proxy_t *hdl,
{
cherokee_buffer_add_str (buf, "Connection: Keep-Alive" CRLF);
hdl->pconn->keepalive_in = true;
+
+ ret = cherokee_header_get_known (&conn->header, header_keepalive, &ptr, &ptr_len);
+ if (ret == ret_ok) {
+ cherokee_buffer_add_str (buf, "Keep-Alive: ");
+ cherokee_buffer_add (buf, ptr, ptr_len);
+ cherokee_buffer_add_str (buf, CRLF);
+ }
} else {
cherokee_buffer_add_str (buf, "Connection: Close" CRLF);
hdl->pconn->keepalive_in = false;
@@ -328,8 +336,10 @@ build_request (cherokee_handler_proxy_t *hdl,
str++;
/* Add the client headers */
+ cherokee_header_get_length (&conn->header, &header_len);
+
begin = (char *)str;
- header_end = conn->incoming_header.buf + conn->incoming_header.len;
+ header_end = conn->incoming_header.buf + (header_len - 2);
while ((begin < header_end)) {
char chr_end;
@@ -462,11 +472,14 @@ send_post (cherokee_handler_proxy_t *hdl)
return ret_ok;
case ret_eagain:
-/* if (eagain_fd != -1) { */
-/* cherokee_thread_deactive_to_polling (HANDLER_THREAD(hdl), */
-/* conn, eagain_fd, */
-/* mode, false); */
-/* } */
+ if (eagain_fd != -1) {
+ ret = cherokee_thread_deactive_to_polling (HANDLER_THREAD(hdl),
+ conn, eagain_fd,
+ mode, false);
+ if (ret != ret_ok) {
+ return ret_eof;
+ }
+ }
return ret_eagain;
default:
View
@@ -44,7 +44,7 @@ cherokee_http_method_to_string (cherokee_http_method_t method, const char **str,
entry (http_post, "POST");
entry (http_head, "HEAD");
entry (http_put, "PUT");
- entry (http_options, "PUT");
+ entry (http_options, "OPTIONS");
entry (http_delete, "DELETE");
entry (http_trace, "TRACE");
entry (http_connect, "CONNECT");
View
@@ -16,7 +16,7 @@ def __init__ (self):
self.request = "GET /implicit_redir1 HTTP/1.0\r\n"
self.expected_error = 301
- self.expected_content = "Location: /implicit_redir1/"
+ self.expected_content = ["Location: ", "/implicit_redir1/\r\n"]
def Prepare (self, www):
d = self.Mkdir (www, "implicit_redir1_DIR")
View
@@ -17,7 +17,7 @@ def __init__ (self):
self.name = "common-dirlist: redir to add final /"
self.request = "GET /%s HTTP/1.0\r\n" % (REQ)
self.expected_error = 301
- self.expected_content = "Location: /%s/" % (REQ)
+ self.expected_content = ["Location: ", "/%s/\r\n" % (REQ)]
def Prepare (self, www):
dr = self.Mkdir (www, DIR)
@@ -19,7 +19,7 @@ def __init__ (self):
self.name = "common-dirlist: redir to add final / 2"
self.request = "GET /%s HTTP/1.0\r\n" % (REQ)
self.expected_error = 301
- self.expected_content = "Location: /%s/" % (REQ)
+ self.expected_content = ["Location: ", "/%s/\r\n" % (REQ)]
def Prepare (self, www):
self.Mkdir (www, DIR2)
View
@@ -16,7 +16,7 @@
class TestHandler (SCGIHandler):
def handle_request (self):
self.handle_post()
- self.output.write('Content-Length: %d\\r\\n')
+ # self.output.write('Content-Length: %d\\r\\n')
self.output.write('Content-Type: text/plain\\r\\n\\r\\n')
self.output.write('%s')

0 comments on commit d4a389c

Please sign in to comment.