I understand that ns_write doesn't and maybe shouldn't send out http headers. It also appears that ad_return_top_of_page is broken.
I of course could be wrong, but the proxy returns with an error about malformed/missing headers.
Since this is a production site I couldn't spend much time troubleshooting. APM for example doesn't output the correct headers (even though it looks like it should).