Auth question

Joe Orton joe at manyfish.co.uk
Mon Feb 28 16:55:35 EST 2011


On Mon, Feb 28, 2011 at 05:17:45PM +0000, Patrick Ohly wrote:
> Joe Orton <joe at ...> writes:
> > On Wed, Feb 16, 2011 at 07:40:51PM -0800, Lou Montulli wrote:
> > > Does anyone know if it is possible to trigger the neon library to send HTTP
> > > auth credentials on the first time it connects to the HTTP server?    I have
> > > an application that always requires authorization and I want to save the 401
> > > retry roundtrip by sending the credentials every time to a known server.
> 
> There is another use case. I am working on a CalDAV/CardDAV backend for
> SyncEvolution, a PIM data synchronization tool. Right now I am trying to get
> service discovery via DNS SRV and /.well-know/[carddav|caldav] working.

http://tools.ietf.org/html/rfc4918#appendix-E

has guidance on the "how to trigger authentication" problem.

On pre_send - it is passed the HTTP header block as an ne_buffer, so 
append a new header.

static void my_pre_send(ne_request *r, void *cookie, ne_buffer *request)
{
  char *blob = ... base64 of "username:password" ... ;
  ne_buffer_concat(request, "Authorization: Basic ", blob, "\r\n", NULL);
}

Regards, Joe



More information about the neon mailing list