diff --git a/chap-34/http_server01.c b/chap-34/http_server01.c index 535b867..0619daf 100644 --- a/chap-34/http_server01.c +++ b/chap-34/http_server01.c @@ -2,6 +2,8 @@ #include #include "lib/common.h" #include "lib/event_loop.h" +#include +#define _GNU_SOURCE //数据读到buffer之后的callback int onRequest(struct http_request *httpRequest, struct http_response *httpResponse) { diff --git a/chap-34/http_server_test.c b/chap-34/http_server_test.c index 45b37f3..d83e3b1 100644 --- a/chap-34/http_server_test.c +++ b/chap-34/http_server_test.c @@ -1,6 +1,8 @@ #include "lib/http_request.h" #include "lib/http_server.h" #include "lib/http_response.h" +#include +#define _GNU_SOURCE char *data = "GET / HTTP/1.1\r\nHost: localhost:43211\r\nUser-Agent: curl/7.54.0\r\nAccept: */*\r\n\r\n"; diff --git a/lib/buffer.c b/lib/buffer.c index 5acd32e..3f1a0cf 100644 --- a/lib/buffer.c +++ b/lib/buffer.c @@ -1,5 +1,7 @@ #include "buffer.h" #include "common.h" +#include +#define _GNU_SOURCE const char *CRLF = "\r\n"; diff --git a/lib/http_server.c b/lib/http_server.c index cba0507..c92d5f6 100644 --- a/lib/http_server.c +++ b/lib/http_server.c @@ -1,5 +1,7 @@ #include #include "http_server.h" +#include +#define _GNU_SOURCE //连接建立之后的callback