I'm starting to get my feet wet with nginx module development. I've looked over Evan Miller's guide, as well as a few articles on nginxguts.com, and have plugged in one of the Hello World examples (from yet another site) and it works fine.
So for my question: in the handler, the Hello World examples set the Content Type using:
r->headers_out.content_type_len = sizeof("text/html") - 1;
r->headers_out.content_type.len = sizeof("text/html") - 1;
r->headers_out.content_type.data = (u_char *) "text/html";
I'm wondering, if I were to use a dynamically allocated C string (using calloc) instead of the static "text/html", would it be safe to release this string after calling
rc = ngx_http_send_header(r);
near the end of my handler? Or is this field possibly used at some later point, even after you call ngx_http_send_header?
Edited 1 time(s). Last edit at 03/28/2014 08:14PM by VernJensen.