Skip to content

Instantly share code, notes, and snippets.

@ZhangYet
Last active December 1, 2016 14:22
Show Gist options
  • Save ZhangYet/a6bca4ff6dd56d95d29990ba966df66b to your computer and use it in GitHub Desktop.
Save ZhangYet/a6bca4ff6dd56d95d29990ba966df66b to your computer and use it in GitHub Desktop.
用 NULL 判断是否取到 ERU_INFO
if (clcf->server_tokens) {
u_char *other_info = (u_char *)getenv("ERU_INFO");
if (other_info == NULL) {
other_info = (u_char *) "null_eru";
}
u_char eru_tail[48];
// ngx_snprintf 会把 eru_tail 后面的空位也返回来,然后就乱码
ngx_sprintf(eru_tail, "<hr><center>%s</center>\r\n</body>\r\n</html>\r\n", other_info);
len = sizeof(eru_tail) - 1;
tail = eru_tail;
} else {
len = sizeof(ngx_http_error_tail) - 1;
tail = ngx_http_error_tail;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment