|
@@ -113,6 +113,8 @@ void send_header(int clnt_sock, struct buffer *send_buf, struct buffer *line_buf
|
|
|
"\r\n",
|
|
"\r\n",
|
|
|
protocol, status, content_type, content_length);
|
|
protocol, status, content_type, content_length);
|
|
|
sputline(clnt_sock, send_buf, line_buf);
|
|
sputline(clnt_sock, send_buf, line_buf);
|
|
|
|
|
+
|
|
|
|
|
+ printf("\tresponse: protocol = %s, status = %s, content type = %s, content length = %lu.\n", protocol, status, content_type, content_length);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// handle connection
|
|
// handle connection
|
|
@@ -161,10 +163,8 @@ void *conn(void *id)
|
|
|
*p = '\0';
|
|
*p = '\0';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- printf("Client %hu: method = %s, url = %s, protocol = %s.\n", clnt_id, method, url, protocol);
|
|
|
|
|
-
|
|
|
|
|
// request headers
|
|
// request headers
|
|
|
- int content_length = 0;
|
|
|
|
|
|
|
+ size_t content_length = 0;
|
|
|
|
|
|
|
|
for (;;)
|
|
for (;;)
|
|
|
{
|
|
{
|
|
@@ -187,7 +187,7 @@ void *conn(void *id)
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- printf("Client %hu: content length = %d.\n", clnt_id, content_length);
|
|
|
|
|
|
|
+ printf("Client %hu request: method = %s, url = %s, protocol = %s, content length = %lu.\n", clnt_id, method, url, protocol, content_length);
|
|
|
|
|
|
|
|
// request body
|
|
// request body
|
|
|
char *request_body = (char *)malloc(content_length + 1);
|
|
char *request_body = (char *)malloc(content_length + 1);
|