In NaviServer usage of ns_startcontent is deprecated instead we use ns_headers to specify the content-type which is added to the connection outputheaders ( which are sent to the client when the first ns_write is called, so no need to use ns_write to write headers to the client before serving the content)