This commit is contained in:
~lucidiot 2021-04-03 16:07:22 +02:00
parent 66b6b177f6
commit 30f149ec13
3 changed files with 569 additions and 0 deletions

357
assets/lirs/original.html Normal file
View File

@ -0,0 +1,357 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="ja">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta name="author" content="hiya">
<meta name="copyright" content="Copyright (C) 1998-2004 hiya All Rights Reserved.">
<style type="text/css">
<!--
BODY{
color: #000000;
background-color: #FFFFFF;
font-family: Helvetica, Arial, ' ゴシック', Osaka;
text-align: left;
margin: 4px 12px;
}
A{
text-decoration: none;
}
A:hover{
color: #00CC00;
text-decoration: underline;
}
H1{
font-size: 150%;
font-weight: 700;
margin: 5px 0px 0px 0px;
}
H2{
font-size: 140%;
font-weight: 700;
margin: 5px 0px 0px 0px;
}
H3{
font-size: 130%;
font-weight: 700;
margin: 5px 0px 0px 0px;
}
H4{
font-size: 120%;
font-weight: 700;
margin: 5px 0px 0px 0px;
}
H5{
font-size: 110%;
font-weight: 700;
margin: 5px 0px 0px 0px;
}
P{
margin: 0px 0px 10px 30px;
}
EM{
font-weight: 700;
font-style: normal;
}
PRE{
color: #000000;
background-color: #CCCCCC;
margin: 0px 0px 10px 30px;
padding: 4px;
}
LI{
margin: 0px 0px 0px 20px;
}
DT{
margin: 0px 0px 0px 0px;
}
DD{
margin: 0px 0px 10px 15px;
}
DL{
margin: 0px 0px 10px 30px;
}
UL{
margin: 0px 0px 10px 30px;
}
OL{
margin: 0px 0px 10px 30px;
}
HR{
color: #000000;
text-align: center;
width: 100%;
height: 1px;
margin: 10px 0px;
}
ADDRESS{
font-size: 90%;
text-align: center;
padding: 0px 0px 20px 0px;
}
-->
</style>
<title lang="ja">Last modified Information Relaying Specification</title>
</head>
<body lang="ja">
<h1>
Last modified Information Relaying Specification<br>
更新時刻情報受け渡しデータ仕様(LIRS)仕様書<br>
</h1>
<p style="text-align: right;">
作成日時1999/10/13 18:00<br>
更新日時2001/12/16 22:48<br>
ver.2.1<br>
</p>
<hr>
<h2>LIRSとは</h2>
<ul>
<li>LIRSとは、更新時刻取得エージェント(アンテナ)間で交換される有益な更新時刻取得情報の中で、もっとも必要である最小最低限の情報を選りすぐって、円滑に交換しあうために定義されたデータ形式および交換手段である。</li>
<li>LIRSでは、更新時刻を取得する対象のサイトに、更新時刻を取得するための最低限のこと以外の負担をかけないことを前提としている。</li>
<li>LIRSに関するすべての仕様の取り決めは、情報の散乱を防ぐために、立案者であるひや(mailto:hiya@hauN.org)が専任して執り行う。</li>
</ul>
<h2>注意事項</h2>
<ul>
<li>LIRSでは内部情報を全てGMTの1970年1月1日0時0分0秒からの秒数(UTC)で表す。</li>
<li>LIRSは原則として、UNIXのサーバーにおいて運用される更新時刻取得アンテナで用いることを前提として定義されており、これ以外の環境は想定していない。</li>
<li>LIRSの内部漢字コードは、EUC限定である。改行コードはLFを推奨するが、LIRS.pmはCRLFにも対応している。なお、CRのみは推奨されない。</li>
<li>「#」で始まる行はコメントとする。</li>
</ul>
<h2>データ書式</h2>
<p>
LIRSは、ヘッダ部「LIRS,」と、「,」で区切られるデータ部、そしてレコード区切り(フッタ部)「,(\015)\012」をひとつのデータレコードとして構成される。<br>
</p>
<p>
データの書式は下記のようになっている。<br>
</p>
<pre>LIRS,938779260,938781002,32400,49383,http://hiya.ouchi.to/n/,ただよう記憶,ひや,http://amano.hauN.org/,(etc.etc...),(\015)\012</pre>
<p>
左より、<br>
</p>
<pre>LIRSレコードヘッダ,更新時刻(Last-ModifiedGMT),更新時刻を取得した時刻(Last-DetectedGMT),対象サイトのGMTとの誤差(秒),対象サイトの容量(Content-Lengthバイト),対象サイトのURL,対象サイトのタイトル,対象サイトの管理者名,情報取得元サイトのURL,(拡張部...),(\015)\012</pre>
<ul>
<li>データは全て「,」一つで区切られる。末尾には独自拡張の情報を付け加えることができるが、行末には必ず区切り文字を一つ余分に入れておくこと。</li>
<li>データには、「,」を含めてはならない。通常、「,」を使わなければならない、という事例はあまり無いと思われるが、「,」を含める場合は「\,」としてエスケープすること。また、それに伴って「\」も「\\」としてエスケープしなければならない。</li>
<li>レコード区切り(フッタ部)が改行コードになるため、データには改行コード(\015,\012いずれも)を含めてはならない。</li>
<li>全ての項において、値無しの場合は「0」が入る。原則として値無し(空欄)ということはない(拡張部に関しては例外)。</li>
<li>更新時刻取得に失敗したサイトは、更新時刻「0」、取得時刻「0」とし、事実上使えない情報として記載される。</li>
</ul>
<h3>更新時刻(Last-ModifiedGMT)</h3>
<p>
そのサイトが更新された時刻。LIRSでは内部情報を全てGMTの1970年1月1日0時0分0秒からの秒数(UTC)で表すため、ここの秒数もGMTである。<br>
この項は、0-9以外の文字は使用できない。<br>
</p>
<h3>更新時刻を取得した時刻(Last-DetectedGMT)</h3>
<p>
そのサイトの更新時刻を最後に直接(自力で)得た時刻。更新されたことを最初に検知した時刻ではない。これはHEAD/GETリクエスト、もしくはファイ
ルのタイムスタンプからの取得、などの自力取得の場合にのみ書き換えることができるが、リモート取得の時はリモート情報から受けたLast-
Detectedを継承する。<br>
Last-Detectedはその情報の鮮度を表すために必要である。LIRSにおいては、自力取得してからどれぐらい時間が経過したかを、その情報の新しさ(古さ)として考えているからである。<br>
内部処理としては、現在時刻からLast-Detectedを差し引いた値(経過した時間)が大きければ大きいほど、この情報の優先度が下がっていき、そ
れが情報を破棄する指標「expiresCount」(下記参照)に指定されている時刻(秒)を越えると、この情報は無視されるようになる。<br>
この項は、0-9以外の文字は使用できない。<br>
</p>
<h3>対象サイトのGMTとの時差(秒)</h3>
<p>
前述の通り、LIRSでは内部情報を全てGMTの1970年1月1日0時0分0秒からの秒数(UTC)で表すため、対象サイトの更新時刻をローカルタイムで表すための、GMTからの時差の情報を必要とする。<br>
日本国内で使う場合は常に(+)32400固定と思って良い。<br>
この項は、0-9と、+と-以外の文字は使用できない。<br>
</p>
<h3>対象サイトの容量(Content-Lengthバイト)</h3>
<p>
対象サイトの容量を表す。これはエージェントにより異なるが、対象サイトの容量から更新時刻を取得するエージェントのために用意されている。<br>
内部処理としては、キャッシュに保存されたLIRSの容量情報と比較し、このサイズと異なった場合に「更新された」と認識する。<br>
この情報が取得できなかった場合は0に設定する。<br>
なお、この方法による更新時刻取得は、現段階ではLast-Detectedの対象外とする。<br>
この項は、0-9以外の文字は使用できない。<br>
</p>
<h3>対象サイトのURL</h3>
<p>
対象サイトのURLは、LIRS形式においてユニークなキーとして扱われる。<br>
URL中のドメイン名は、大小文字の判定はしないこととする。ディレクトリ位置については大小文字の判別を行う。<br>
この項は、URLとして使用できる文字以外は使用できない。<br>
</p>
<h3>対象サイトのタイトル</h3>
<p>
対象サイトのタイトルは、タイトルや管理者名を記さなくても更新できるエージェントに提供される情報として用意されている。<br>
</p>
<h3>対象サイトの管理者名</h3>
<p>
対象サイトの管理者名は、タイトルや管理者名を記さなくても更新できるエージェントに提供される情報として用意されている。<br>
</p>
<h3>情報取得元サイトのURL</h3>
<p>
このレコードの情報を取得した元のサイトのURLを記しておく。原則として、自力取得したサイトを指す。<br>
これの利用法は各エージェントに委ねられる。<br>
</p>
<h3>独自情報の追記</h3>
<p>
上記情報以外の、エージェント独自の情報は、これらの情報を書き出した後に追記することができる。<br>
ただし、一行につき一サイトの原則は守らなければならず、行末に区切り文字を含めなければならない。<br>
なお、独自情報を書き出したエージェント以外で、ここに定義された情報を利用したときの動作は保証されない。<br>
</p>
<h2>LIRS形式のデータを扱うエージェントで、設定に追加していただきたい項目</h2>
<p>
LIRS形式のデータを扱うエージェントは、下記の設定項目を追加すること。<br>
</p>
<ul>
<li>サーバーの時刻帯(GMTよりの誤差を秒で日本は-32400)<br>
<em>localTimeZone = -32400;</em><br>
</li>
<li>gzipの場所<br>
<em>gzip = '/usr/bin/gzip';</em><br>
</li>
</ul>
<h2>LIRS形式のデータを出力するエージェントに必要なことがら</h2>
<p>
LIRS形式のデータを扱うエージェントは、下記の要項に従うこと。<br>
</p>
<ul>
<li>内部で利用するキャッシュ情報を、LIRS形式で保存しておく必要がある。<br>
</li>
<li>LIRSのファイルは、出力完了後UNIX gzipで圧縮して保管しておく必要がある。この際、元のLIRSファイルを削除しないようにする。<br>
ちなみに、LIRSファイルを受けるときはHTTPを用い、gzipで展開した上で用いる。<br>
</li>
<li>更新時刻取得時刻から換算して更新時刻情報を無視するまでの時間を、ユーザーが設定ファイルで更新できない場所で設定する必要がある。<br>
<em>expiresCount = 28800;</em><br>
この値は28800固定である。<br>
</li>
</ul>
<h2>転送方法</h2>
<p>
LIRS形式のデータを送受信する際は、下記の要項に従うこと。<br>
</p>
<ul>
<li>転送はHTTPで行う。<br>
</li>
<li>LIRSファイルはgzipで圧縮されている必要がある。受け取った後、gzipで展開後読み込む。<br>
</li>
</ul>
<h2>LIRSにおける「情報の鮮度」の概念</h2>
<p>
LIRSにおいて、情報の鮮度の計測方法は、そのサイトに対して直に情報を取得して(Last-Detected)からどれだけの時間が経過しているか、を基準としている。<br>
時間が経過するごとに、その情報の価値がどんどん下がっていき、ある一定の値(expiresCount)を越えたところで、その情報は破棄される。<br>
</p>
<p>
また、LIRSにおいては、情報がリモートで渡ってきたときに、そこに記載されている更新時刻取得時刻の情報を元にして、Last-Detectedを指定し出力する。エージェントによるが、必ずしも継承される必要はない。<br>
</p>
<h2>LIRSにおける「時差」の概念</h2>
<p>
LIRSにおける「時差」の概念は、一般的にGMTを基準として、それぞれのサーバー(あるいはAuthor)所在地との時差を指す。<br>
エージェントが情報を出力するときにLIRSで設定された「時差」の値を元にして、対象となるサーバーの所在地のローカルタイムで表記することが可能となる。<br>
</p>
<h2>その他</h2>
<ul>
<li>LIRS ver.2.0型のオブジェクトをPerl上で扱えるモジュールを、中川 勝樹さんが作成して下さいました。<br>
<em><a href="https://web.archive.org/web/20041204124747/http://m-factory.zone.ne.jp/archive/Meta-LIRS-pm.html">http://m-factory.zone.ne.jp/archive/Meta-LIRS-pm.html</a></em><br>
</li>
<li>LIRS形式のデータを扱うRubyのモジュールをTAKAHASHI 'Maki' Masayoshiさんが提供して下さっています。<br>
<em><a href="https://web.archive.org/web/20041204124747/http://www.open-news.com/%7Emaki/di/lirs.rb">http://www.open-news.com/~maki/di/lirs.rb</a></em><br>
</li>
<li>LIRS ver.2.0のデータ構造・圧縮展開処理を扱いやすくするPerl5のモジュールを下記にて提供している。<br>
オブジェクト指向Perlプログラミングのメソッドとしても、従来通りのサブルーチンとしても使用可能である。<br>
<em><a href="https://web.archive.org/web/20041204124747/http://amano.haun.org/LIRS.pm">http://amano.hauN.org/LIRS.pm</a></em><br>
</li>
</ul>
<h2>改版履歴他</h2>
<dl>
<dt>2001/12/16 22:48<br></dt>
<dd>Meta::LIRS Perlモジュールについてを追加<br>
</dd>
<dt>2000/10/25 14:36<br></dt>
<dd>当該ドキュメントの、LIRSレコードのURLの説明部分の致命的な誤りほかを修正。<br>
</dd>
<dt>2000/10/13 15:20<br></dt>
<dd>LIRS.pmにおけるgzipの用法に誤りがあったので修正。<br>
</dd>
<dt>2000/06/23 13:52<br></dt>
<dd>データ内における改行コード(\015,\012)の扱いについての説明を追加。<br>
</dd>
<dt>2000/06/16 13:47<br></dt>
<dd>lirs.rbへのリンクを追加<br>
</dd>
<dt>2000/05/31 20:00<br></dt>
<dd>LIRSデータ内で「\」を「\\」にエスケープしなければならない旨を新たに仕様に追加。<br>
LIRS.pmのバージョンアップに伴い微修正。<br>
</dd>
<dt>1999/11/11 19:41<br></dt>
<dd>HTML化と、それにともない微修正。<br>
</dd>
<dt>1999/11/03 03:25<br></dt>
<dd>DIに関する議論のなかで出てきた事柄などを考慮に入れ、微修正。<br>
「LIRSとは」などを追加。<br>
</dd>
<dt>1999/10/13 18:00<br></dt>
<dd>原文作成。<br>
</dd>
</dl>
<hr>
<hr>
<p style="margin: 0px; padding: 0px;">
<b>ひやの他のサイト</b><br>
<nobr><a href="https://web.archive.org/web/20041204124747/http://aniki.haun.org/">[TOP]</a></nobr>
 <nobr><a href="https://web.archive.org/web/20041204124747/http://www.polsta.jp/%7Ehiya/mt/">[暇な時間に書く雑記]</a></nobr>
 <nobr><a href="https://web.archive.org/web/20041204124747/http://a.hatena.ne.jp/hiyaan/">[ひやあんテナ]</a></nobr>
 <nobr>[<a href="https://web.archive.org/web/20041204124747/http://www.polsta.jp/%7Ehiya/FFXI/">FFXI</a> <a href="https://web.archive.org/web/20041204124747/http://www.polsta.jp/%7Ehiya/FFXI/culture.php">栽培</a> <a href="https://web.archive.org/web/20041204124747/http://www.polsta.jp/%7Ehiya/FFXI/auction.php">競売</a>]</nobr>
 <nobr><a href="https://web.archive.org/web/20041204124747/http://www.polsta.jp/%7Ehiya/legend/">[伝説]</a></nobr>
 <nobr><a href="https://web.archive.org/web/20041204124747/http://www.polsta.jp/%7Ehiya/tripge/">[tripge]</a></nobr>
 <nobr><a href="https://web.archive.org/web/20041204124747/http://www.polsta.jp/%7Ehiya/board/">[掲示板]</a></nobr>
<br>
</p>
<p style="margin: 0px; padding: 0px;">
<b>ひやうぇあ</b><br>
<nobr><a href="https://web.archive.org/web/20041204124747/http://aniki.haun.org/mp/">[mail porter(めるぽ)]</a></nobr>
<br>
</p>
<hr>
<p style="margin: 0px; padding: 0px;">
<nobr><a href="https://web.archive.org/web/20041204124747/http://aniki.haun.org/copyright.html">[copyright]</a></nobr>
<br>
</p>
<hr>
<address style="text-align: center; font-size: 80%;">
Copyright (C) 1998-2004 <em>hiya</em>. All Rights Reserved.<br>
</address>
</body></html>

31
content/lirs/index.md Normal file
View File

@ -0,0 +1,31 @@
---
title: LIRS
---
Last-modified Information Relaying Specification (LIRS) was a syndication
format. It was a Japanese version of RSS, like [Hina-Di][hina], but based
on CSV instead of XML or RFC 822 headers.
## Specification
I could only recover version 2.1 of the specification.
It is available [on the Wayback Machine][wayback], but I converted it to UTF-8
and reuploaded it [here](./original.html) for convenience.
An unofficial [English translation](./spec.html) of mine is available.
## Known implementations
* Official Perl 5 module: [LIRS.pm][LIRS.pm]
* [Text::LIRS][Text::LIRS], previously known as Meta::LIRS
* [lirs.rb][lirs.rb] (dead link), a Ruby module for LIRS
I could not recover the source code for the last two implementations;
if you have them, please [contact][contact] me!
[hina]: ../hina/index.html
[wayback]: https://web.archive.org/web/20041204124747/http://aniki.haun.org:80/natsu/LIRS.html
[LIRS.pm]: https://web.archive.org/web/20020621223342/http://amano.haun.org:80/LIRS.pm
[Text::LIRS]: https://web.archive.org/web/20031211200149/http://m-factory.zone.ne.jp:80/archive/
[lirs.rb]: http://www.open-news.com/~maki/di/lirs.rb
[contact]: https://tilde.town/~lucidiot/contact.html

181
content/lirs/spec.md Normal file
View File

@ -0,0 +1,181 @@
---
title: Last modified Information Relaying Specification (LIRS) 2.1
---
Creation date: 1999-10-13 18:00
Update date: 2001-12-16 22:48
> This document is an unofficial English translation of the original Japanese
> specification made by someone who has no knowledge of Japanese.
> Implement at your own risk.
## About LIRS
LIRS is designed to include the minimal necessary information for update time
acquisition agents (antennas). It assumes that a site that provides update
times should not be burdened with anything other than reporting update times.
It also assumes that the sites all run on UNIX environments.
The person exclusively responsible for changes to this specification is Hiya
(hiya@haun.org).
## Format
* An LIRS file is a text file compressed using gzip.
* The text is encoded using EUC-JP and consists in a series of records.
* A record starts with `LIRS,`, followed by a data part, and ends with a comma
and LF or CRLF.
* LF is recommended, and CR alone is prohibited.
* Lines that begin with `#` are comments and should be ignored.
* The data part of a record consists in a series of fields separated by commas
(`,`).
* Field values must not include the CR or LF characters, or unescaped commas.
* All dates are expressed as Unix timestamps: seconds from 1970-01-01T00:00:00Z.
* With the exception of the extension field, blank fields should be represented
as a zero (`0`).
### Escaping
The backslash character (`\`) is the escape character. Commas in fields should
be escaped (`\,`). A literal backslash can be inserted using two backslashes
(`\\`).
## Fields
The following fields should appear in all records, in this order:
* Last-Modified
* Last-Detected
* Time difference
* Content-Length
* URL
* Title
* Author name
* Source URL
* Extension
### Last-Modified
Timestamp of when the target site was last updated.
Should the last update detection fail, the LIRS provider should set this field
to zero, and antenna agents should assume this record is unusable.
### Last-Detected
Timestamp of when the LIRS provider last checked for the last update time for
this site. This defines a notion of "freshness" that antenna agents can use to
sort records by priority, or discard old records.
Should the last update detection fail, the LIRS provider should set this field
to zero, and antenna agents should assume this record is unusable.
### Time difference
Signed integer. Difference, in seconds, between GMT and the timezone of the
target site; 32400 or +32400 in Japan. Since update times are reported in GMT,
this allows sharing the timezone of the target site.
### Content-Length
Size of the content served at the target URL, in bytes. LIRS providers that
check the target site, and do not have more internal ways to detect an update,
should consider a change in the Content-Length to be an update.
### URL
URL of the target site. This field must be unique; a single URL must not be
repeated twice in the same LIRS file. This field can be used as a unique
identifier by antenna implementations.
### Title
Title of the content served at the target site; usually the contents of the
HTML `<title>` tag.
### Author name
Name of the author of the content served at this URL.
### Source URL
URL that was used by the LIRS provider to acquire update information. This is
usually the same as the URL; in case of an implementation that aggregates update
information from other LIRS providers, this could be the URL of each LIRS file.
How to use this field is left to the implementor.
### Extension
Arbitrary string for agent-specific information. Instead of `0` as the default
for a blank field, this should be left empty.
## Best practices
* LIRS files should be cached, not generated dynamically.
* LIRS implementations should automatically discard records that were last
detected more than 28800 seconds (8 hours) ago.
## Example
This is a single LIRS record, uncompressed:
```
LIRS,938779260,938781002,32400,49383,http://hiya.ouchi.to/n/,Tadayo Memories,Hiya,http://amano.hauN.org/,blah blah,\r\n
```
This translates to the following fields:
Title
: Tadayo Memories
Author
: Hiya
Site URL
: http://hiya.ouchi.to/n/
Last modified
: 1999-10-01T14:01:00Z
Last detected
: 1999-10-01T14:30:02Z
Server timezone
: UTC+9 (32400 seconds)
Source
: http://amano.hauN.org/
Custom data
: `blah blah`
## Changelog
2001-12-16 22:48
: Added a link to the Meta::LIRS Perl module
2000-10-25 14:36
: Fixed an error in the description of the URL field.
2000-10-13 15:20
: Fixed an error in the usage of gzip in LIRS.pm.
2000-06-23 13:52
: Added details about handling line feeds (\015, \012).
2000-06-16 13:47
: Added a link to lirs.rb.
2000-05-31 20:00
: Backslashes should now be escaped too (`\\`).
: Minor corrections due to changes in LIRS.pm.
1999-11-11 19:41
: Document converted to HTML, and minor corrections.
1999-11-03 03:25
: Minor corrections after a discussion about DI.
: Added the About LIRS section.
1999-10-13 18:00
: Initial version.