← はまんど | メイン | 朝 →

2005年02月19日

備忘録::MIMETypeのフック

前々から薄々とこーやればできるんではなかろーかと推測してたwebサーバが返す特定Content-typeをプログラムでブラウザからぶんどる仕組み。
研究で必要だったので、ようやく自分で調べた。自分の手書きのメモは自動暗号化されてしまう…というか読むに耐えないので、ここにメモ。

まずはtelnetでwebサーバとお話。レスポンスボディが地獄わかりやすいiEPGで試す。

#telnet www.tvguide.or.jp 80
GET /cgi-bin/iepg.pl?station=Z0608&airdate=20050218&airtime=2300 HTTP/1.0(CRLF)
(CRLF)
HTTP/1.1 200 OK
Date: Fri, 18 Feb 2005 15:46:33 GMT
Server: Apache/1.3.27 (Unix) mod_perl/1.26
Connection: close
Content-Type: application/x-tv-program-info

Content-type: application/x-tv-program-info; charset=shift_jis
version: 1
station: 岡山放送
year: 2005
month: 02
date: 18
start: 23:00
end: 23:30
program-title: メントレG

藤井隆VS今田耕司&ユー大爆笑暴露対決…

Content-TypeのMIMEの振る舞いを処理系でフックしてれやればよし。
動的コンテンツならCGIでContent-Typeを明示してレスポンスヘッダに加えればよし。
静的コンテンツになると、httpd.conf書き換えないとダメか…
Internet Explorerの場合

HKEY_CLASSES_ROOT\MIME\DataBase\Content TypeにさきほどのContent-Typeをキー名にする。
そのキーにそれらしい値を突っ込めば自分のプログラムで拾えるはず。iEPGを拾ってるアプリを参考にガンガル。

Firefoxの場合
…だるー。MIMEはすべてプラグインに任せてたのか…


Warning: include() [function.include]: URL file-access is disabled in the server configuration in /virtual/technerd/public_html/blog.technerd.org/2005/02/19-004711.php on line 270

Warning: include(http://blog.technerd.org/rightmenu.php) [function.include]: failed to open stream: no suitable wrapper could be found in /virtual/technerd/public_html/blog.technerd.org/2005/02/19-004711.php on line 270

Warning: include() [function.include]: Failed opening 'http://blog.technerd.org/rightmenu.php' for inclusion (include_path='.:/usr/local/lib/php') in /virtual/technerd/public_html/blog.technerd.org/2005/02/19-004711.php on line 270


Warning: include() [function.include]: URL file-access is disabled in the server configuration in /virtual/technerd/public_html/blog.technerd.org/2005/02/19-004711.php on line 274

Warning: include(http://blog.technerd.org/footer.php) [function.include]: failed to open stream: no suitable wrapper could be found in /virtual/technerd/public_html/blog.technerd.org/2005/02/19-004711.php on line 274

Warning: include() [function.include]: Failed opening 'http://blog.technerd.org/footer.php' for inclusion (include_path='.:/usr/local/lib/php') in /virtual/technerd/public_html/blog.technerd.org/2005/02/19-004711.php on line 274