Why would ns_write send an http header? I just sends what you tell it to send. If you want an http header, you should use ns_return instead. Maybe the script using ns_write needs rewriting?