[Prev][Next][Index][Thread]

Re: Trouble with message/rfc822 parser



Some weeks ago, I asked:
> Also, can someone advise me on an appropriate code fragment to launch
> the converter?  I'm running in a CGI environment; that is, filedescriptor
> zero is a socket to the client, from which I'm supposed to read the form
> data, and the environment variable CONTENT_LENGTH contains the number of
> bytes of data.  I thought of using HTLoadSocket, but it
> doesn't seem to have any way to constrain the
> amount of data to read.

Henrik Frystyk Nielsen <frystyk@w3.org> said:
> The way to do this is to return HT_LOADED from _your_ stream when you 
> have  read the number of bytes that you expect. Then this will be 
> passed back to the  socket read loop which will then terminate. You 
> can see an example of this in  the HTMIME.c module where we in order 
> to support persistent connections - we  return HT_LOADED when we have 
> read content-length bytes. 

I finally got back to trying this.

It doesn't work!  HTSocketRead tries to read INPUT_BUFFER_SIZE bytes.
There needs to be a way to make sure that it never even tries to get
more than CONTENT_LENGTH, or else it'll read excess data from the socket.

--
73 de ke9tv/2, Kevin KENNY   GE Corporate Research & Development
kennykb@crd.ge.com           P. O. Box 8, Room KWC273
                             Schenectady, New York 12301-0008 USA


References: