[redland-dev] Bug report

Dave Beckett dave.beckett at bristol.ac.uk
Mon Nov 3 10:52:30 GMT 2003


On Tue, 28 Oct 2003 14:47:20 -0000, Paul Keogh <paul.keogh at anam.com> wrote:

> 
> Module: raptor_www.c
> Function: static int raptor_www_file_fetch(raptor_www *www) 
> Description: The code snippet;
> 
>     if(len > 0 && www->write_bytes)
>       www->write_bytes(www, www->write_bytes_userdata, buffer, len, 1);
> 
>     if(feof(fh) || www->failed)
>       break;
>   }
>   fclose(fh);
> 
>   RAPTOR_FREE(cstring, filename);
>   
>   if(!status)
>     www->status_code=200;
>   
>   return status;
> 
> If www->failed is set, this function still returns a status_code of 200
> (and status of 0) because status is not set to 1. 
> 
> The calling function thinks it has succeeded when in fact it has failed.

Yes, that seems to be a bug.  Looking further it's only called when
you use libxml to do the simple URI retrieval and it generates
an error via the callback.  That doesn't necessarily give an HTTP
error code since it could be a DNS failure for example.

So I guess the solution is to replace status with !www-> failed throughout.

Looking further at raptor_www_libxml_http_error, it's a mess.  It
always outputs to stderr and always does exit(1) - both wrong.  I've
fixed that too but it meant changing a few other files too, so it would
be a multi-file patch.

Thanks for the feedback

Dave



More information about the redland-dev mailing list