bugfix:修复HTTP请求中没有HOST时,未判空导致coredump
This commit is contained in:
@@ -152,8 +152,13 @@ void __hf_public_req_fill_from_private(struct http_half_private * hf_private, st
|
||||
hf_private->method_or_status = (enum tfe_http_std_method) parser->method;
|
||||
|
||||
const static struct http_field_name __host_field_name = {TFE_HTTP_HOST, NULL};
|
||||
hf_private->host = strdup((char *) tfe_http_field_read(hf_public, &__host_field_name));
|
||||
hf_req_spec->host = hf_private->host;
|
||||
|
||||
char *host= (char *)tfe_http_field_read(hf_public, &__host_field_name);
|
||||
if(host)
|
||||
{
|
||||
hf_private->host = strdup(host);
|
||||
hf_req_spec->host = hf_private->host;
|
||||
}
|
||||
|
||||
/* uri is stored in underlay evbuffer, we need to append a terminal zero */
|
||||
static const char __zero = 0;
|
||||
|
||||
Reference in New Issue
Block a user