ふつうのLinuxプログラミング 第16章 httpサーバーtelnet風
ふぅ。やっと16章終了〜。
telnet風にリクエストを送ると、ファイルを返せるようになりましたぁ〜
% ./httpd .
GET httpd.c HTTP/1.0
HTTP/1.0 200 OK
Date: Mon, 16 Apr 2007 15:45:16 GMT
Server: httpd/1.0
Connection: close
Content-Length: 517
Content-Type: text/plain
#include <stdio.h>
...(略
int
main(int argc, char *argv[])
{
...(略
exit(EXIT_SUCCESS);
}
% ./httpd .
GET hoge.c HTTP/1.0
HTTP/1.0 404 Not Found
Date: Mon, 16 Apr 2007 15:46:06 GMT
Server: httpd/1.0
Connection: close
Content-Type: text/html
<html>
<head><title>404 Not Found</title></head>
</html>おぉぉぉ。
ソースが書籍に載っていない部分があるので、サポートサイトからダウンロードした方がよさげです。
次は17章!!ソケット接続して、ブラウザに!
どんな困難が待ち受けているのか・・・マイペースに遊びながら作っていきます(笑
あ、404のbodyがない(汗