填写http头:
r->headers_out.content_length_n = ctx->response_bufs->buf->last -ctx->response_bufs->buf->pos; r->headers_out.status = NGX_HTTP_OK; ngx_str_set(&r->headers_out.status_line,"200 OK"); r->headers_out.content_type.len = sizeof("text/html; charset=utf-8") - 1; r->headers_out.content_type.data = (u_char *) "text/html; charset=utf-8";
发送http头和http体:
ngx_tcp_con_fill_response_eader(r,ctx); rc = ngx_http_send_header(r); if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { return ; } rc = ngx_http_output_filter( r,ctx->response_bufs ); ngx_http_finalize_request(r, rc);