On Wed, Jun 06, 2007 at 04:42:05PM -0700, Frank Cusack wrote:
> This works fine if you are (say) writing to a file.  But I create a pipe
> and have ne_get() write to that.  After calling ne_get() I read() from the
> pipe and parse the web server response.  (I'm using a simplistic http
> API for RPC ... which is out of my control.)

Ah.  This is not the best way to use neon; using the ne_request_* API 
directly will avoid the problems with the pipe entirely.  e.g.:

ne_request *req;
char buffer[BUFSIZ];
ssize_t len;

req = ne_request_create(sess, "GET", "/blah");

if (ne_begin_request(req)) // handle errors

// check response status here via ne_get_status(req)

while ((len = ne_read_response_block(req, buffer, sizeof buffer)) > 0)
  // parse 'len' bytes of response in buffer

ne_end_request(req);

ne_request_destroy(req);

or alternatively using a callback and ne_add_response_body_reader(), and 
just call ne_request_dispatch() instead of the begin/read/end loop 
above - see ne_request.h.

Regards,

joe


_______________________________________________
neon mailing list
[email protected]
http://mailman.webdav.org/mailman/listinfo/neon

Reply via email to