parent
97ab9877a2
commit
e9666e82e2
|
@ -202,6 +202,7 @@ static const char *conn_get_query(struct uh_connection *conn)
|
|||
static const char *conn_get_header(struct uh_connection *conn, const char *name)
|
||||
{
|
||||
struct uh_request *req = &conn->req;
|
||||
int name_len = strlen(name);
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < UHTTPD_MAX_HEADER_NUM; i++) {
|
||||
|
@ -217,7 +218,7 @@ static const char *conn_get_header(struct uh_connection *conn, const char *name)
|
|||
for (j = 0; j < UHTTPD_MAX_HEADER_NUM; j++) {
|
||||
if (req->headers_info[j].name_offset > 0) {
|
||||
const char *p = O2D(conn, req->headers_info[j].name_offset);
|
||||
if (!strncmp(p, name, req->headers_info[j].name_len)) {
|
||||
if (name_len == req->headers_info[j].name_len && !strncmp(p, name, req->headers_info[j].name_len)) {
|
||||
req->headers[i].name = strndup(p, req->headers_info[j].name_len);
|
||||
req->headers[i].value = strndup(O2D(conn, req->headers_info[j].value_offset), req->headers_info[j].value_len);
|
||||
req->headers_info[j].name_len = 0;
|
||||
|
|
Loading…
Reference in New Issue