Permalink
Browse files

Remove mod_chm

This has been superseded by archmage -p serving a directory of files
  • Loading branch information...
1 parent d5e1d61 commit 1fdaedc5413b3a6a6c6d9e6a25e91318ca7a854a @dottedmag committed May 16, 2015
Showing with 15 additions and 88 deletions.
  1. +10 −0 NEWS
  2. +2 −9 README.md
  3. +1 −11 archmage.1
  4. +2 −2 archmod/cli.py
  5. +0 −66 archmod/mod_chm.py
View
@@ -1,3 +1,13 @@
+arCHMage X.Y
+============
+New features:
+
+* archmage -p can now serve a whole directory with .chm files
+
+Changes:
+
+* mod_chm was removed. Use archmage -p and proxy requests from Apache.
+
arCHMage 0.3.1
==============
Bug fixes:
View
@@ -33,21 +33,16 @@ This feature requires `htmldoc(1)`, and `lynx(1)` or `elinks(1)` installed.
Serve CHM contents over HTTP
----------------------------
- archmage -p <port> <chmfile|unpacked chm dir>
+ archmage -p <port> <chmfile|dir with chm files>
Serve CHM contents from Apache
------------------------------
-Add those lines to your `httpd.conf` and restart Apache:
-
- AddHandler python-program .chm
- PythonHandler archmod.mod_chm
+TODO: document how to proxy Apache to running `archmage -p`.
Then `http://youserver/sample.chm` will serve raw CHM file, and
`http://yourserver/sample.chm/` will serve unpacked CHM file view.
-This feature requires `mod_python`.
-
Installation
============
@@ -63,8 +58,6 @@ Optional dependencies:
(Debian/Ubuntu: `htmldoc`)
* Lynx or ELinks - converting to plain text
(Debian/Ubuntu: `lynx`)
- * mod_python - Apache module
- (Debian/Ubuntu: `libapache2-mod-python`)
Use the regular `setup.py` stanza:
View
@@ -50,17 +50,7 @@ specified port:
archmage \-p <port> <chmfile>
.PP
-3) Tune your apache to publish chm file contents if there is trailing
-slash in request to that file (you will need working mod_python for
-that):
-
- Add that lines to your httpd.conf:
-
- AddHandler python-program .chm
-.br
- PythonHandler archmod.mod_chm
-
- Restart apache.
+3) TODO: document how to proxy Apache to running `archmage -p`.
.PP
Let's suppose, you have file sample.chm in DocumentRoot of your
apache. After that tuning you can receive raw chm file, if you point
View
@@ -42,8 +42,8 @@
-p number
--port=number
Acts as HTTP server on specified port number, so you can read
- CHM file with your favorite browser. You can specify a directory
- with decompressed content.
+ CHM file with your favorite browser. You can specify a single file
+ or a directory with .chm files to be served as an argument.
-d / --dump
Dump HTML data from CHM file into standard output.
View
@@ -1,66 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# archmage -- CHM decompressor
-# Copyright (c) 2003 Eugeny Korekin <aaaz@users.sourceforge.net>
-# Copyright (c) 2005-2009 Basil Shubin <bashu@users.sourceforge.net>
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-# details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
-# Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-
-from mod_python import apache
-from mimetypes import guess_type
-from archmod.CHM import CHMFile
-
-chmfile = None
-chmname = None
-
-
-def handler(req):
- source = req.filename
- pagename = req.path_info
-
- global chmfile, chmname
-
- if chmname != source:
- chmfile = CHMFile(source)
-
- chmname = source
-
- if pagename:
- try:
- page = chmfile.get_entry(pagename)
- except:
- return apache.HTTP_NOT_FOUND
-
- if pagename == '/':
- mimetype = 'text/html'
- else:
- mimetype = guess_type(pagename)[0] or 'application/octet-stream'
-
- req.content_type = mimetype
- req.send_http_header()
-
- req.write(page)
- else:
- mimetype = 'application/chm'
- req.content_type = mimetype
- req.send_http_header()
- file = open(source, 'rb')
- while 1:
- tmp = file.read(4096)
- if len(tmp) == 0:
- break
- req.write(tmp)
- return apache.OK

0 comments on commit 1fdaedc

Please sign in to comment.