The HTTP redirects were failing because indeed Kannel was trying to read a body that wasn't there. The patch adds a check for a length of 0 as specified by Content-Length, and if found it sets the state to entity_done. This all happens in deduce_body_state() within http.c. Attached is the diff of my code vs. CVS. This fixed both my local WAP homepage redirect and the Hotmail redirect.
Jon
Index: gwlib/http.c
===================================================================
RCS file: /home/cvs/gateway/gwlib/http.c,v
retrieving revision 1.231
diff -u -p -d -r1.231 http.c
--- gwlib/http.c 29 Mar 2005 12:57:16 -0000 1.231
+++ gwlib/http.c 6 Apr 2005 17:42:17 -0000
@@ -359,6 +359,7 @@ typedef struct {
static void deduce_body_state(HTTPEntity *ent)
{
Octstr *h = NULL;
+ long ret;
if (ent->expect_state == expect_no_body) {
ent->state = entity_done;
@@ -383,11 +384,13 @@ static void deduce_body_state(HTTPEntity
h = http_header_find_first(ent->headers, "Content-Length");
if (h != NULL) {
- if (octstr_parse_long(&ent->expected_body_len, h, 0, 10) == -1 ||
- ent->expected_body_len < 0) {
+ ret = octstr_parse_long(&ent->expected_body_len, h, 0, 10);
+ if (ret == -1 || ent->expected_body_len < 0) {
error(0, "HTTP: Content-Length header wrong: <%s>",
octstr_get_cstr(h));
ent->state = body_error;
+ } else if ( ent->expected_body_len == 0 ) {
+ ent->state = entity_done;
} else {
ent->state = reading_body_with_length;
}
