Apacheのログで416が大量に記録されていることに関する調査

2008 / 06 / 05 ( Thu )
この記事をはてなブックマークに登録する この記事をYahoo!ブックマークに登録する この記事をlivedoorクリップに登録する
Apacheのログ解析をしていたら、416が大量に記録されていることに気づいて調査。

416のステータスは
416: Requested Range Not Satisfiable
実ファイルのサイズを超えるデータを要求した。

という事のようです。

調べると、ファイルの部分取得を行っているとこういうエラーが出るみたい。
telnet でテストする時には、Range: を使用します。

通常のリクエストはこんな感じ。
$ telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0

HTTP/1.1 200 OK
Date: Thu, 05 Jun 2008 14:46:20 GMT
Server: Apache/2.0.55 (Unix) PHP/4.4.4
Last-Modified: Wed, 08 Mar 2006 07:52:14 GMT
ETag: "224004-f-9bb2780"
Accept-Ranges: bytes
Content-Length: 15
Connection: close
Content-Type: text/html

<html>
</html>
Connection closed by foreign host.


Range を使うとこんな感じ。
$ telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0
Range: bytes=2-
← ここを追加。

HTTP/1.1 206 Partial Content
Date: Thu, 05 Jun 2008 14:48:28 GMT
Server: Apache/2.0.55 (Unix) PHP/4.4.4
Last-Modified: Wed, 08 Mar 2006 07:52:14 GMT
ETag: "224004-f-9bb2780"
Accept-Ranges: bytes
Content-Length: 13
Content-Range: bytes 2-14/15
Connection: close
Content-Type: text/html

tml> ← <h が飛ばされて表示。
</html>
Connection closed by foreign host.


Range: にいい加減な値を入れると、416が返ってきます。
$ telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0
Range: bytes=100-
← 適当に大きい数字を入れると…

HTTP/1.1 416 Requested Range Not Satisfiable
Date: Thu, 05 Jun 2008 14:51:40 GMT
Server: Apache/2.0.55 (Unix) PHP/4.4.4
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>416 Requested Range Not Satisfiable</title>
</head><body>
<h1>Requested Range Not Satisfiable</h1>
<p>None of the range-specifier values in the Range
request-header field overlap the current extent
of the selected resource.</p>
<hr>
<address>Apache/2.0.55 (Unix) PHP/4.4.4 Server at www.example.com Port 80</address>
</body></html>
Connection closed by foreign host.



このRangeは、ファイルダウンロードソフトが分割ダウンロードを行うときに使っているようです。


サーバー構築・運用に関わるプロフェッショナルの方々の体験談や解説がいっぱい集まった、
こちら↓のページも合わせてご参照ください。
ブログランキング

テーマ:ソフトウェア - ジャンル:コンピュータ

23:57:51 | Unix/Linux | トラックバック(0) | コメント(0) | page top↑
<<バックアップは大切 | ホーム | W05Kは新幹線でどれほど使えるか?>>
コメント
コメントの投稿














管理者にだけ表示を許可する

トラックバック
トラックバックURL
http://iamse.blog110.fc2.com/tb.php/99-d263c29c
この記事にトラックバックする(FC2ブログユーザー)
| ホーム |