ne_read_response_block and authentication.

Joe Orton joe at manyfish.co.uk
Fri Sep 18 08:52:22 EDT 2009


Hi Pierre,

On Fri, Sep 18, 2009 at 01:08:53PM +0200, Pierre ANCELOT wrote:
> Ok... nevermind, I figured it out...
> the whole code had to be run again upon a failure...
> if ne_end_request returned different than NE_OK...

Note that must also call ne_read_response_block() in a loop, per the 
docs in ne_request.h.  You only retry the request if ne_end_request() 
returns NE_TRY.

> Though... I'm wondering, wouldn't there is a way to figure this out before
> ne_end_request?, actually, before data reading?

Before you start calling ne_read_response_block(), you should check the 
response status code using ne_get_status().  For example:

  if (ne_get_status(req)->klass == 2) {
     ... call ne_read_response_block() loop...
  }
  else {
     ret = ne_discard_response(req);
  }

would mean you only read the response body to your buffer for a 
successful request.

Regards, Joe



More information about the neon mailing list