Some IIS webdav servers require "translate: f" header

Werner Baumann werner.baumann at onlinehome.de
Sun Apr 15 09:44:20 EDT 2012


Am Sun, 15 Apr 2012 13:53:31 +0200
schrieb Éric Piel <e.a.b.piel at tudelft.nl>:

> clients (the programs using libneon). If so I'd be glad if you could
> hint me on the best way to add a header to a request when using the
> basic ne_get().
> 
> Cheers,
> Éric
>  

What you need is in ne_request.h

* Define a variable with your header like

static char *translate_header = "Translate: f\r\n";

* Define a callback function of type ne_pre_send_fn

static void
add_header(ne_request *req, void *userdata, ne_buffer *header)
{
    ne_buffer_zappend(header, (char *) userdata);
}

* When you initialize the neon session you have to add

ne_hook_pre_send(session, add_header, translate_header);

With this the translate header will be send with any request, not only
GET. In my experience the servers don't care.


To be more selective and send more clean HTTP you should not use basic
ne_get() but build your GET requests from the functions in
ne_request.h. It will need a bit more boilerplate but adding a header
will be as easy as

ne_add_request_header(request, "Translate", "f");

Werner



More information about the neon mailing list