Skip to content

Commit

Permalink
修改一些小问题
Browse files Browse the repository at this point in the history
Change-Id: I66cc97e3f21c1ec52ca306196dae6a4a0cc3ce02
  • Loading branch information
lishuai committed Jul 24, 2018
1 parent dda5c32 commit 247f06b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions reference/homework1/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ int main(int argc, char *argv[]) {
}

// 如果漏掉这个,会导致什么问题?
// 试验一下,然后好好思考一下这个问题
close(clientfd);
}

Expand Down Expand Up @@ -122,6 +123,7 @@ void handle_client(char *root_path, int fd) {
}
req_len += n;
req[req_len] = '\0';
printf("%s\n", req);
}

// 获取 URI
Expand Down Expand Up @@ -176,5 +178,6 @@ void handle_client(char *root_path, int fd) {
"Content-Type: %s\r\n\r\n", st.st_size, type);
write(fd, head, strlen(head));
write(fd, content, st.st_size);
// 如果这里我们不close,是否可以继续再读请求?了解一下http的: Connection: keep-alive
close(fd);
}
2 changes: 1 addition & 1 deletion resource/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<script type="text/javascript" src="js/index.js"></script>
<link rel="stylesheet" href="css/style.css" type="text/css">
</head>
<body>
<body onload="load()">
<h1 id="id1">Hello, world</h1>
<img src="img/logo.jpg" />
</body>
Expand Down
Binary file removed resource/js/.index.js.swp
Binary file not shown.
2 changes: 1 addition & 1 deletion resource/js/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
function load() {
//document.getElementById("id1").innerHTML("Javascript: Hello, world");
document.getElementById("id1").innerHTML = "Javascript: Hello, world";
}

0 comments on commit 247f06b

Please sign in to comment.