With nxweb_send_redirect() and nxweb_send_redirect2() I get his error:
unfinished stream found in nxb 0x7f4918005bd0
Here is the code I tried:
nxweb_send_redirect(resp, 301, "/", conn->secure);
nxweb_start_sending_response(conn, resp);
return NXWEB_OK;
I prefer the response header way, but this also doesn't work. Here is a curl -v response:
> GET /test HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.16.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: myhost
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nxweb/3.3.0-dev
< Date: Thu, 11 Dec 2014 18:57:17 GMT
< Connection: keep-alive
< Location: /
< Content-Type: text/html
< Content-Length: 18
As you can see, the Location header is added, but no redirect took place.