Re: [PATCH] HTTP Redirect Fix
Stipe Tolj <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Organization | The Kannel Group |
| Message-ID | <[email protected]> |
Jonathan Houser wrote:
>
> 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;
> }
+1, commited to cvs in slight variation. At least the long ret seems to me
absolutely unnecessary, as it has been obviously more for debugging purporses
Jonathan, right? ;)
Stipe
mailto:stolj_{at}_wapme.de
-------------------------------------------------------------------
Wapme Systems AG
Vogelsanger Weg 80
40470 Düsseldorf, NRW, Germany
phone: +49.211.74845.0
fax: +49.211.74845.299
mailto:info_{at}_wapme-systems.de
http://www.wapme-systems.de/
-------------------------------------------------------------------