Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

excluded terminating null character and fixed content-length #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ngx_http_hello_world_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ static ngx_int_t ngx_http_hello_world_handler(ngx_http_request_t *r)
out.next = NULL; /* just one buffer */

b->pos = ngx_hello_world; /* first position in memory of the data */
b->last = ngx_hello_world + sizeof(ngx_hello_world); /* last position in memory of the data */
b->last = ngx_hello_world + sizeof(ngx_hello_world)-1; /* last position in memory of the data */
b->memory = 1; /* content is in read-only memory */
b->last_buf = 1; /* there will be no more buffers in the request */

/* Sending the headers for the reply. */
r->headers_out.status = NGX_HTTP_OK; /* 200 status code */
/* Get the content length of the body. */
r->headers_out.content_length_n = sizeof(ngx_hello_world);
r->headers_out.content_length_n = sizeof(ngx_hello_world)-1;
ngx_http_send_header(r); /* Send the headers */

/* Send the body, and return the status code of the output filter chain. */
Expand Down