|
|
@ -21,10 +21,11 @@ ReqHeader readReqHeader(int client) {
|
|
|
|
ReqHeader header;
|
|
|
|
ReqHeader header;
|
|
|
|
header.method = malloc(1024);
|
|
|
|
header.method = malloc(1024);
|
|
|
|
header.path = malloc(1024);
|
|
|
|
header.path = malloc(1024);
|
|
|
|
|
|
|
|
char* tBuf = malloc(1024);
|
|
|
|
/*strcpy(header.method, strtok(buf, " "));
|
|
|
|
/*strcpy(header.method, strtok(buf, " "));
|
|
|
|
strcpy(header.path, strtok(NULL, " "));*/
|
|
|
|
strcpy(header.path, strtok(NULL, " "));*/
|
|
|
|
sprintf(header.method, "%s", strtok(buf, " "));
|
|
|
|
sprintf(header.method, "%s", strtok_r(buf, " ", &tBuf));
|
|
|
|
sprintf(header.path, "%s", strtok(NULL, " "));
|
|
|
|
sprintf(header.path, "%s", strtok_r(NULL, " ", &tBuf));
|
|
|
|
if (header.path[1] == '\0') {
|
|
|
|
if (header.path[1] == '\0') {
|
|
|
|
//strcpy(header.path, "/index.html");
|
|
|
|
//strcpy(header.path, "/index.html");
|
|
|
|
sprintf(header.path, "/index.html");
|
|
|
|
sprintf(header.path, "/index.html");
|
|
|
|