Debian Codegraph @

doc/pygopherd.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >PyGopherd Manual</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"></HEAD
9 ><BODY
10 CLASS="BOOK"
11 BGCOLOR="#FFFFFF"
12 TEXT="#000000"
13 LINK="#0000FF"
14 VLINK="#840084"
15 ALINK="#0000FF"
16 ><DIV
17 CLASS="BOOK"
18 ><A
19 NAME="PYGOPHERD"
20 ></A
21 ><DIV
22 CLASS="TITLEPAGE"
23 ><H1
24 CLASS="TITLE"
25 ><A
26 NAME="AEN2"
27 >PyGopherd Manual</A
28 ></H1
29 ><HR></DIV
30 ><DIV
31 CLASS="TOC"
32 ><DL
33 ><DT
34 ><B
35 >Table of Contents</B
36 ></DT
37 ><DT
38 >1. <A
39 HREF="#PYGOPHERD.INTRO"
40 >Introduction to PyGopherd</A
41 ></DT
42 ><DD
43 ><DL
44 ><DT
45 >1.1. <A
46 HREF="#FEATURES"
47 >Features</A
48 ></DT
49 ><DT
50 >1.2. <A
51 HREF="#ABOUTGOPHER"
52 >About Gopher</A
53 ></DT
54 ></DL
55 ></DD
56 ><DT
57 >2. <A
58 HREF="#QUICKSTART"
59 >Quick Start</A
60 ></DT
61 ><DT
62 >3. <A
63 HREF="#INSTALLATION"
64 >Installation</A
65 ></DT
66 ><DD
67 ><DL
68 ><DT
69 >3.1. <A
70 HREF="#INSTALLATION.DEBIAN"
71 >Debian System-Wide Installation</A
72 ></DT
73 ><DT
74 >3.2. <A
75 HREF="#INSTALLATION.OTHER"
76 >Other System-Wide Installation</A
77 ></DT
78 ><DT
79 >3.3. <A
80 HREF="#INSTALLATION.SINGLE"
81 >Single-Account Installation</A
82 ></DT
83 ></DL
84 ></DD
85 ><DT
86 >4. <A
87 HREF="#CONFIGURATION"
88 >Configuration</A
89 ></DT
90 ><DT
91 >5. <A
92 HREF="#HANDLERS"
93 >Handlers</A
94 ></DT
95 ><DD
96 ><DL
97 ><DT
98 >5.1. <A
99 HREF="#HANDLERS.DIRHANDLER"
100 >dir.DirHandler</A
101 ></DT
102 ><DT
103 >5.2. <A
104 HREF="#HANDLERS.BUCKGOPHERMAP"
105 >gophermap.BuckGophermapHandler</A
106 ></DT
107 ><DT
108 >5.3. <A
109 HREF="#HANDLERS.COMPRESSEDFILEHANDLER"
110 >file.CompressedFileHandler</A
111 ></DT
112 ><DT
113 >5.4. <A
114 HREF="#HANDLERS.FILEHANDLER"
115 >file.FileHandler</A
116 ></DT
117 ><DT
118 >5.5. <A
119 HREF="#HANDLERS.HTMLFILETITLEHANDLER"
120 >html.HTMLFileTitleHandler</A
121 ></DT
122 ><DT
123 >5.6. <A
124 HREF="#HANDLERS.MAILBOXES"
125 >mbox handlers</A
126 ></DT
127 ><DT
128 >5.7. <A
129 HREF="#HANDLERS.PYGHANDLER"
130 >pyg.PYGHandler</A
131 ></DT
132 ><DT
133 >5.8. <A
134 HREF="#HANDLERS.EXECHANDLER"
135 >scriptexec.ExecHandler</A
136 ></DT
137 ><DT
138 >5.9. <A
139 HREF="#HANDLERS.UMN"
140 >UMN.UMNDirHandler</A
141 ></DT
142 ><DD
143 ><DL
144 ><DT
145 >5.9.1. <A
146 HREF="#HANDLERS.UMN.LINKS"
147 >Links</A
148 ></DT
149 ><DT
150 >5.9.2. <A
151 HREF="#HANDLERS.UMN.OVERRIDING"
152 >Overriding Defaults</A
153 ></DT
154 ><DT
155 >5.9.3. <A
156 HREF="#HANDLERS.UMN.COOL"
157 >Adding Cool Links</A
158 ></DT
159 ><DT
160 >5.9.4. <A
161 HREF="#HANDLERS.UMN.HIDING"
162 >Hiding an Entry</A
163 ></DT
164 ><DT
165 >5.9.5. <A
166 HREF="#HANDLERS.UMN.ABSTRACTS"
167 >Abstracts and Info</A
168 ></DT
169 ></DL
170 ></DD
171 ><DT
172 >5.10. <A
173 HREF="#HANDLERS.HTMLURLHANDLER"
174 >url.HTMLURLHandler</A
175 ></DT
176 ><DT
177 >5.11. <A
178 HREF="#HANDLERS.URLTYPEREWRITER"
179 >url.URLTypeRewriter</A
180 ></DT
181 ><DT
182 >5.12. <A
183 HREF="#HANDLERS.VIRTUAL"
184 >virtual.Virtual</A
185 ></DT
186 ><DT
187 >5.13. <A
188 HREF="#HANDLERS.ZIP"
189 >ZIP.ZIPHandler</A
190 ></DT
191 ></DL
192 ></DD
193 ><DT
194 >6. <A
195 HREF="#TYPES"
196 >Gopher Item Types</A
197 ></DT
198 ><DT
199 >I. <A
200 HREF="#PYGOPHERD.MAN"
201 >PyGopherd Manpage</A
202 ></DT
203 ><DD
204 ><DL
205 ><DT
206 ><A
207 HREF="#AEN474"
208 >pygopherd</A
209 >&nbsp;--&nbsp;Multiprotocol Information Server</DT
210 ></DL
211 ></DD
212 ></DL
213 ></DIV
214 ><DIV
215 CLASS="CHAPTER"
216 ><HR><H1
217 ><A
218 NAME="PYGOPHERD.INTRO"
219 ></A
220 >Chapter 1. Introduction to PyGopherd</H1
221 ><P
222 > Welcome to <SPAN
223 CLASS="APPLICATION"
224 >PyGopherd</SPAN
225 >. In a nutshell, <SPAN
226 CLASS="APPLICATION"
227 >PyGopherd</SPAN
228 >
229 is a modern dynamic
230 multi-protocol hierarchical information server with a pluggable
231 modularized extension system,
232 full flexible caching, virtual files and
233 folders, and autodetection of file types -- all with support for
234 standardized yet extensible per-document metadata. Whew! Read on for
235 information on what all these buzzwords mean.
236 </P
237 ><DIV
238 CLASS="SECT1"
239 ><HR><H2
240 CLASS="SECT1"
241 ><A
242 NAME="FEATURES"
243 >1.1. Features</A
244 ></H2
245 ><P
246 > Here are some of <SPAN
247 CLASS="APPLICATION"
248 >PyGopherd</SPAN
249 >'s features:
250 </P
251 ><P
252 ></P
253 ><UL
254 ><LI
255 ><P
256 >Provides built-in support for multiple protocols:
257 HTTP (Web), Gopher+, Gopher (RFC1436), Enhanced Gopher0,
258 Gemini, Spartan, and WAP (mobile phones). Protocols can be enabled or
259 disabled as desired.
260 </P
261 ></LI
262 ><LI
263 ><P
264 >Provides protocol autodetection. That is,
265 <SPAN
266 CLASS="APPLICATION"
267 >PyGopherd</SPAN
268 > can listen for all the above protocols
269 <SPAN
270 CLASS="emphasis"
271 ><I
272 CLASS="EMPHASIS"
273 >on a single port</I
274 ></SPAN
275 > and will
276 automatically respond using the protocol it detects the
277 client is using. Practical effects of this are that you
278 can, for instance, give out a single URL and have it
279 viewable normally on desktop Web browsers and in WAP
280 mode on mobile phones -- and appropriately in various
281 Gopher browsers.
282 </P
283 ></LI
284 ><LI
285 ><P
286 >Metadata and site links can be entered in a
287 variety of formats, including full UMN dotfile metadata
288 formats as well as Bucktooth gophermap files. Moreover,
289 gophermap files are not limited to Gopher protocols, and
290 can be used for all protocols.
291 </P
292 ></LI
293 ><LI
294 ><P
295 >Support for inter-protocol linking (linking
296 from Gopher sites to web sites)</P
297 ></LI
298 ><LI
299 ><P
300 >Virtual folder system lets you serve up
301 anything as if it were regular files and directories.
302 PyGopherd comes with the following virtual folder systems
303 built in:</P
304 ><P
305 ></P
306 ><UL
307 ><LI
308 ><P
309 >Can present any Unix MBOX, MMDF box, MH
310 directory, Maildir directory, or Babyl mailbox as a
311 virtual folder, the contents of which are the
312 messages in the mailbox.
313 </P
314 ></LI
315 ><LI
316 ><P
317 >Can use a configurable separator to
318 split a file into multiple parts, the first line of each
319 becoming the name for the virtual folder.</P
320 ></LI
321 ><LI
322 ><P
323 >Can peek inside a ZIP file and serve it
324 up as first-class site citizens -- metadata can even be
325 stored in the ZIP files.
326 </P
327 ></LI
328 ><LI
329 ><P
330 >Can serve up the contents of a dictd
331 server as a filesystem.
332 </P
333 ></LI
334 ></UL
335 ></LI
336 ><LI
337 ><P
338 > Modular, extensible design: you can use PyGopherd's own
339 PYG extension format, or UMN- or Bucktooth-style
340 executables.
341 </P
342 ></LI
343 ><LI
344 ><P
345 > Runs on any platform supported by Python 2.2, 2.3, or 2.4.
346 This includes virtually every past and current flavor of
347 Unix (Linux, *BSD, Solaris, SunOS), Windows, MacOS 9.x
348 and X, and more. Some features may not be available on
349 non-Unix platforms.
350 </P
351 ></LI
352 ><LI
353 ><P
354 >Runs on any platform supported by Java 1.1
355 via the Jython Python implementation.</P
356 ></LI
357 ><LI
358 ><P
359 >Tunable server types via configuration
360 directive -- forking or threading.</P
361 ></LI
362 ><LI
363 ><P
364 >Secure design with support for chrooted execution.</P
365 ></LI
366 ><LI
367 ><P
368 >Feature-complete, full implementations of:
369 Gopher0 (RFC1435), Gopher+, HTTP, and WAP.</P
370 ></LI
371 ><LI
372 ><P
373 >Support for automatically finding the titles
374 of HTML documents for presentation in a directory.</P
375 ></LI
376 ><LI
377 ><P
378 >Versatile configuration file format is both
379 extensible and nicely complementary of the module system.</P
380 ></LI
381 ><LI
382 ><P
383 >Protocol-independent, handler-dependent
384 caching. This increases performance by letting handlers
385 cache dynamically-generated information -- currently used by
386 the directory handlers. This can improve performance of
387 directories by several orders of magnitude. Because this is
388 a handler cache only, all protocols share the single
389 cache. Since the processing time for the protocols is
390 negligible, this works out very well.</P
391 ></LI
392 ><LI
393 ><P
394 >Autosensing of MIME types and gopher0 item
395 types. Both are completely configurable. MIME type
396 detection is done using a standard mime.types file, and
397 gopher0 types are calculated by using a configurable
398 regexp-based MIME-to-gophertype map.</P
399 ></LI
400 ><LI
401 ><P
402 >Heavy support of regular expressions in configuration.</P
403 ></LI
404 ><LI
405 ><P
406 >ProtocolMultiplexer and HandlerMultiplexer
407 let you choose only those protocols and handlers that you
408 wish your server to support and the order in which they are
409 tried when a request comes in.
410 </P
411 ></LI
412 ><LI
413 ><P
414 >Full logging via syslog.</P
415 ></LI
416 ></UL
417 ></DIV
418 ><DIV
419 CLASS="SECT1"
420 ><HR><H2
421 CLASS="SECT1"
422 ><A
423 NAME="ABOUTGOPHER"
424 >1.2. About Gopher</A
425 ></H2
426 ><P
427 > <SPAN
428 CLASS="APPLICATION"
429 >PyGopherd</SPAN
430 > started life as a server for the Gopher Internet
431 protocol. With Gopher, you can mount a filesystem (viewing files and
432 folders as if they were local),
433 browse Gopherspace with a web browser,
434 download files, and be interactive with searching.
435 </P
436 ><P
437 > But this is only part of the story. The world of Gopher is more
438 expansive than this. There are two major gopher protocols: Gopher0
439 (also known as RFC1436) and Gopher+. Gopher0 is a small, simple,
440 lightweight protocol that is very functional yet also extremely easy
441 to implement. Gopher0 clients can be easily placed in small embedded
442 devices or in massive environments like a modern web browser.
443 </P
444 ><P
445 > Gopher+ is based on Gopher0 but extends it by providing document
446 metadata such as file size and MIME type. Gopher+ allows all sorts of
447 neat features, such as configurable metadata (serving up a bunch of
448 photos? Add a Subject field to your metadata to let
449 a customized photo
450 browser display who is pictured) and multiple
451 views of a file (let the
452 user select to view your photos as PNG or JPEG).
453 </P
454 ></DIV
455 ></DIV
456 ><DIV
457 CLASS="CHAPTER"
458 ><HR><H1
459 ><A
460 NAME="QUICKSTART"
461 ></A
462 >Chapter 2. Quick Start</H1
463 ><P
464 > If you have already installed <SPAN
465 CLASS="APPLICATION"
466 >PyGopherd</SPAN
467 > system-wide, or your
468 administrator has done that for you, your task for setting up
469 <SPAN
470 CLASS="APPLICATION"
471 >PyGopherd</SPAN
472 > for the first time is quite simple. You just need
473 to set up your configuration file, make your folder directory,
474 and run it!
475 </P
476 ><P
477 > You can quickly set up your configuration file. The
478 distribution includes two files of interest:
479 <TT
480 CLASS="FILENAME"
481 >conf/pygopherd.conf</TT
482 > and
483 <TT
484 CLASS="FILENAME"
485 >conf/mime.types</TT
486 >. Debian users will find
487 the configuration file pre-installed in
488 <TT
489 CLASS="FILENAME"
490 >/etc/pygopherd/pygopherd.conf</TT
491 > and the
492 <TT
493 CLASS="FILENAME"
494 >mime.types</TT
495 > file provided by the system
496 already.
497 </P
498 ><P
499 > Open up <TT
500 CLASS="FILENAME"
501 >pygopherd.conf</TT
502 > in your editor and
503 adjust to suit. The file is heavily commented and you can
504 refer to it for detailed information. Some settings to take a
505 look at include: <SPAN
506 CLASS="PROPERTY"
507 >detach</SPAN
508 >,
509 <SPAN
510 CLASS="PROPERTY"
511 >pidfile</SPAN
512 >, <SPAN
513 CLASS="PROPERTY"
514 >port</SPAN
515 >,
516 <SPAN
517 CLASS="PROPERTY"
518 >usechroot</SPAN
519 >, <SPAN
520 CLASS="PROPERTY"
521 >setuid</SPAN
522 >,
523 <SPAN
524 CLASS="PROPERTY"
525 >setgid</SPAN
526 >, and <SPAN
527 CLASS="PROPERTY"
528 >root</SPAN
529 >.
530 These may or may not work at their defaults for you. The
531 remaining ones should be fine for a basic setup.
532 </P
533 ><P
534 > Invoke <SPAN
535 CLASS="APPLICATION"
536 >PyGopherd</SPAN
537 > with <B
538 CLASS="COMMAND"
539 >pygopherd
540 path/to/configfile</B
541 > (or
542 <B
543 CLASS="COMMAND"
544 >/etc/init.d/pygopherd start</B
545 > on Debian).
546 Place some files in the location specified by the
547 <SPAN
548 CLASS="PROPERTY"
549 >root</SPAN
550 > directive in the config file and
551 you're ready to run!
552 </P
553 ></DIV
554 ><DIV
555 CLASS="CHAPTER"
556 ><HR><H1
557 ><A
558 NAME="INSTALLATION"
559 ></A
560 >Chapter 3. Installation</H1
561 ><P
562 > If you are reading this document via the "man" command, it is likely
563 that you have no installation tasks to perform; your system administrator
564 has already installed <SPAN
565 CLASS="APPLICATION"
566 >PyGopherd</SPAN
567 >. If you need to install it yourself, you
568 have three options: a system-wide installation with Debian, system-wide
569 installation with other systems, and a single-user installation. You
570 can download the latest version of PyGopherd
571 from
572 <A
573 HREF="https://github.com/michael-lazar/pygopherd"
574 TARGET="_top"
575 >https://github.com/michael-lazar/pygopherd</A
576 >
577 </P
578 ><DIV
579 CLASS="SECT1"
580 ><HR><H2
581 CLASS="SECT1"
582 ><A
583 NAME="INSTALLATION.DEBIAN"
584 >3.1. Debian System-Wide Installation</A
585 ></H2
586 ><P
587 > You may install
588 <SPAN
589 CLASS="APPLICATION"
590 >PyGopherd</SPAN
591 > by simply running this command as root:
592 </P
593 ><P
594 > <B
595 CLASS="COMMAND"
596 >apt-get install pygopherd</B
597 >
598 </P
599 ></DIV
600 ><DIV
601 CLASS="SECT1"
602 ><HR><H2
603 CLASS="SECT1"
604 ><A
605 NAME="INSTALLATION.OTHER"
606 >3.2. Other System-Wide Installation</A
607 ></H2
608 ><P
609 > Download the tar.gz version of the package from the website. Make
610 sure you have Python 3.7 or above installed; if not, download and
611 install it from <A
612 HREF="http://www.python.org/"
613 TARGET="_top"
614 >http://www.python.org/</A
615 >. Then run these
616 commands:
617 </P
618 ><PRE
619 CLASS="PROGRAMLISTING"
620 > <B
621 CLASS="COMMAND"
622 >tar -zxvf pygopherd-x.y.z.tar.gz</B
623 >
624 <B
625 CLASS="COMMAND"
626 >cd pygopherd-x.y.z</B
627 >
628 <B
629 CLASS="COMMAND"
630 >python3 setup.py</B
631 >
632 </PRE
633 ><P
634 > Next, proceed to configuration. Make sure that the
635 <TT
636 CLASS="FILENAME"
637 >/etc/pygopherd/pygopherd.conf</TT
638 > file
639 names valid users (<SPAN
640 CLASS="PROPERTY"
641 >setuid</SPAN
642 > and
643 <SPAN
644 CLASS="PROPERTY"
645 >setgid</SPAN
646 > options) and a valid document
647 root (<SPAN
648 CLASS="PROPERTY"
649 >root</SPAN
650 > option).
651 </P
652 ><P
653 > You will type <TT
654 CLASS="FILENAME"
655 >pygopherd</TT
656 > to invoke the
657 program.
658 </P
659 ></DIV
660 ><DIV
661 CLASS="SECT1"
662 ><HR><H2
663 CLASS="SECT1"
664 ><A
665 NAME="INSTALLATION.SINGLE"
666 >3.3. Single-Account Installation</A
667 ></H2
668 ><P
669 > Download the tar.gz version of the package from the website. Make
670 sure you have Python 2.2 or above installed; if now, download and
671 install it from <A
672 HREF="http://www.python.org/"
673 TARGET="_top"
674 >http://www.python.org/</A
675 >. Then run these
676 commands:
677 </P
678 ><PRE
679 CLASS="PROGRAMLISTING"
680 > <B
681 CLASS="COMMAND"
682 >tar -zxvf pygopherd-z.y.z.tar.gz</B
683 >
684 <B
685 CLASS="COMMAND"
686 >cd pygopherd-x.y.z</B
687 >
688 </PRE
689 ><P
690 > Modify <TT
691 CLASS="FILENAME"
692 >conf/pygopherd.conf</TT
693 > as follows:
694 </P
695 ><P
696 ></P
697 ><UL
698 ><LI
699 ><P
700 >Set <SPAN
701 CLASS="PROPERTY"
702 >usechroot = no</SPAN
703 ></P
704 ></LI
705 ><LI
706 ><P
707 >Set <SPAN
708 CLASS="PROPERTY"
709 >root</SPAN
710 > to something appropriate.</P
711 ></LI
712 ><LI
713 ><P
714 >Set <SPAN
715 CLASS="PROPERTY"
716 >port</SPAN
717 > to a number
718 greater than 1024.</P
719 ></LI
720 ></UL
721 ><P
722 > When you want to run <SPAN
723 CLASS="APPLICATION"
724 >PyGopherd</SPAN
725 >, you will issue the
726 <B
727 CLASS="COMMAND"
728 >cd</B
729 > command as above and then type
730 <B
731 CLASS="COMMAND"
732 >PYTHONPATH=. bin/pygopherd</B
733 >. There is no
734 installation step necessary.
735 </P
736 ></DIV
737 ></DIV
738 ><DIV
739 CLASS="CHAPTER"
740 ><HR><H1
741 ><A
742 NAME="CONFIGURATION"
743 ></A
744 >Chapter 4. Configuration</H1
745 ><P
746 > <SPAN
747 CLASS="APPLICATION"
748 >PyGopherd</SPAN
749 > is regulated by a configuration file normally
750 stored in <TT
751 CLASS="FILENAME"
752 >/etc/pygopherd/pygopherd.conf</TT
753 >.
754 You can specify an alternate configuration file on the command
755 line. The <SPAN
756 CLASS="APPLICATION"
757 >PyGopherd</SPAN
758 > distribution ships
759 with a sample <TT
760 CLASS="FILENAME"
761 >pygopherd.conf</TT
762 > file that
763 thoroughly documents the configuration file options and
764 settings.
765 </P
766 ></DIV
767 ><DIV
768 CLASS="CHAPTER"
769 ><HR><H1
770 ><A
771 NAME="HANDLERS"
772 ></A
773 >Chapter 5. Handlers</H1
774 ><P
775 > <SPAN
776 CLASS="APPLICATION"
777 >PyGopherd</SPAN
778 > defines several handlers which are responsible for
779 finding data on your server and presenting it to the user. The
780 handlers are used to generate things like links to other documents and
781 directory listings. They are also responsible for serving up regular
782 files and even virtual folders.
783 </P
784 ><P
785 > Handlers are specified with the <SPAN
786 CLASS="PROPERTY"
787 >handlers</SPAN
788 >
789 option in <TT
790 CLASS="FILENAME"
791 >pygopherd.conf</TT
792 >. This option is
793 a list of handlers to use. For each request that arrives,
794 <SPAN
795 CLASS="APPLICATION"
796 >PyGopherd</SPAN
797 > will ask each handler in
798 turn whether or not it can handle the request, and will handle the
799 request according to the first handler that is capable of doing so.
800 If no handlers can handle the request, a file not found error is
801 generated. See the example configuration file for an example.
802 </P
803 ><P
804 > The remaining parts of this section describe the different
805 handlers that ship with <SPAN
806 CLASS="APPLICATION"
807 >PyGopherd</SPAN
808 >.
809 </P
810 ><DIV
811 CLASS="SECT1"
812 ><HR><H2
813 CLASS="SECT1"
814 ><A
815 NAME="HANDLERS.DIRHANDLER"
816 >5.1. dir.DirHandler</A
817 ></H2
818 ><P
819 > This handler is a basic one that generates menus based
820 on the contents of a directory. It is used for
821 directories that contain neither a
822 <TT
823 CLASS="FILENAME"
824 >gophermap</TT
825 > file nor UMN-style links
826 files, or situations where you have no need for either
827 of those.
828 </P
829 ><P
830 > This handler simply reads the contents of your on-disk
831 directory, determines the appropriate types of each file,
832 and sends the result to the client. The descriptions of
833 each item are usually set to the filename, but the
834 <SPAN
835 CLASS="PROPERTY"
836 >html.HTMLFileTitleHandler</SPAN
837 > may override
838 that.
839 </P
840 ></DIV
841 ><DIV
842 CLASS="SECT1"
843 ><HR><H2
844 CLASS="SECT1"
845 ><A
846 NAME="HANDLERS.BUCKGOPHERMAP"
847 >5.2. gophermap.BuckGophermapHandler</A
848 ></H2
849 ><P
850 > This handler is used to generate directory listings
851 based on <TT
852 CLASS="FILENAME"
853 >gophermap</TT
854 > files. It will
855 not read the directory on-disk, instead serving content
856 from the <TT
857 CLASS="FILENAME"
858 >gophermap</TT
859 > file only.
860 Gophermaps are useful if you want to present a directory
861 in which the files do not frequently change and there is
862 general information to present. Overall, if you only
863 wish to present information particular to certain files,
864 you should consider using the abstract feature of
865 UMN.UMNDirHandler.
866 </P
867 ><P
868 > The <TT
869 CLASS="FILENAME"
870 >gophermap</TT
871 > files contain two
872 types of lines, which are described here using the same
873 convention normally used for command line arguments. In
874 this section, the symbol \t will be used to indicate a
875 tab character, Control-I.
876 </P
877 ><P
878 > <TT
879 CLASS="REPLACEABLE"
880 ><I
881 >full line of informational
882 text</I
883 ></TT
884 > </P
885 ><P
886 > <TT
887 CLASS="REPLACEABLE"
888 ><I
889 >gophertypeDESCRIPTION</I
890 ></TT
891 > [\t<TT
892 CLASS="REPLACEABLE"
893 ><I
894 >selector</I
895 ></TT
896 > [\t<TT
897 CLASS="REPLACEABLE"
898 ><I
899 >host</I
900 ></TT
901 > [\t<TT
902 CLASS="REPLACEABLE"
903 ><I
904 >port</I
905 ></TT
906 >]]]</P
907 ><P
908 > Note: spaces shown above are for clarity only and should
909 not actually be present in your file.
910 </P
911 ><P
912 > The informational text must not contain any tab
913 characters, but may contain spaces. Informational text
914 will be rendered with gopher type
915 <SPAN
916 CLASS="PROPERTY"
917 >i</SPAN
918 >, which will cause it to be
919 displayed on a client's screen at its particular
920 position in the file.
921 </P
922 ><P
923 > The second type of line represents a link to a file or
924 directory. It begins with a single-character Gopher
925 type (see Gopher Item Types below) followed immediately
926 by a description and a tab character. There is no space
927 or other separator between the gopher type and the
928 description. The description may contain spaces but not
929 tabs.
930 </P
931 ><P
932 > The remaining arguments are optional, but only to the
933 extent that arguments may be omitted only if all
934 arguments after them are also omitted. These arguments
935 are:
936 </P
937 ><P
938 ></P
939 ><DIV
940 CLASS="VARIABLELIST"
941 ><DL
942 ><DT
943 ><TT
944 CLASS="REPLACEABLE"
945 ><I
946 >selector</I
947 ></TT
948 ></DT
949 ><DD
950 ><P
951 >The <SPAN
952 CLASS="PROPERTY"
953 >selector</SPAN
954 > is
955 the name of the file on the server. If it begins
956 with a slash, it is an absolute path; otherwise,
957 it is interpreted relative to the directory that
958 the gophermap file is in. If no selector is
959 specified, the description is also used as the
960 selector.
961 </P
962 ></DD
963 ><DT
964 ><TT
965 CLASS="REPLACEABLE"
966 ><I
967 >host</I
968 ></TT
969 ></DT
970 ><DD
971 ><P
972 >The <SPAN
973 CLASS="PROPERTY"
974 >host</SPAN
975 >
976 specifies the host on which this resource is
977 located. If not specified, defaults to the
978 current server.
979 </P
980 ></DD
981 ><DT
982 ><TT
983 CLASS="REPLACEABLE"
984 ><I
985 >port</I
986 ></TT
987 ></DT
988 ><DD
989 ><P
990 >The <SPAN
991 CLASS="PROPERTY"
992 >port</SPAN
993 >
994 specifies the port on which the resource is
995 located. If not specified, defaults to the port
996 the current server is listening on.
997 </P
998 ></DD
999 ></DL
1000 ></DIV
1001 ><P
1002 > An example of a gophermap to help illustrate the concept
1003 is included with the <SPAN
1004 CLASS="APPLICATION"
1005 >PyGopherd</SPAN
1006 > distribution in the
1007 file <TT
1008 CLASS="FILENAME"
1009 >examples/gophermap</TT
1010 >.
1011 </P
1012 ></DIV
1013 ><DIV
1014 CLASS="SECT1"
1015 ><HR><H2
1016 CLASS="SECT1"
1017 ><A
1018 NAME="HANDLERS.COMPRESSEDFILEHANDLER"
1019 >5.3. file.CompressedFileHandler</A
1020 ></H2
1021 ><P
1022 > In order to save space, you might want to store
1023 documents on-disk in a compressed format. But then
1024 clients would ordinarily have to decompress the files
1025 themselves. It would be nice to have the server
1026 automatically decompress the files on the fly, sending
1027 that result to the client. That's where
1028 <SPAN
1029 CLASS="PROPERTY"
1030 >file.CompressedFileHandler</SPAN
1031 > comes
1032 in.
1033 </P
1034 ><P
1035 > This handler will take compressed files, pipe them
1036 through your chosen decompression program, and send the
1037 result directly to clients -- completely transparently.
1038 </P
1039 ><P
1040 > To use this handler, set the
1041 <SPAN
1042 CLASS="PROPERTY"
1043 >decompressors</SPAN
1044 > option in the
1045 configuration file. This option defines a mapping from
1046 MIME encodings (as defined with the
1047 <SPAN
1048 CLASS="PROPERTY"
1049 >encoding</SPAN
1050 > option) to decompression
1051 programs. Files that are not encoded, or which have an
1052 encoding that does not occur in the
1053 <SPAN
1054 CLASS="PROPERTY"
1055 >decompressors</SPAN
1056 > map, will not be
1057 decompressed by this handler.
1058 </P
1059 ><P
1060 > Please see the sample configuration file for more
1061 examples and details about the configuration of this
1062 handler.
1063 </P
1064 ></DIV
1065 ><DIV
1066 CLASS="SECT1"
1067 ><HR><H2
1068 CLASS="SECT1"
1069 ><A
1070 NAME="HANDLERS.FILEHANDLER"
1071 >5.4. file.FileHandler</A
1072 ></H2
1073 ><P
1074 > The <SPAN
1075 CLASS="PROPERTY"
1076 >file.FileHandler</SPAN
1077 > is just that
1078 -- its duty is to serve up regular files to clients.
1079 </P
1080 ></DIV
1081 ><DIV
1082 CLASS="SECT1"
1083 ><HR><H2
1084 CLASS="SECT1"
1085 ><A
1086 NAME="HANDLERS.HTMLFILETITLEHANDLER"
1087 >5.5. html.HTMLFileTitleHandler</A
1088 ></H2
1089 ><P
1090 > This handler is used when generating directories and
1091 will set the description of HTML files to the HTML title
1092 defined in them rather than let it be the default
1093 filename. Other than that, it has no effect. UMN
1094 gopherd implements a similar policy.
1095 </P
1096 ></DIV
1097 ><DIV
1098 CLASS="SECT1"
1099 ><HR><H2
1100 CLASS="SECT1"
1101 ><A
1102 NAME="HANDLERS.MAILBOXES"
1103 >5.6. mbox handlers</A
1104 ></H2
1105 ><P
1106 > There are four mailbox handlers:
1107 </P
1108 ><P
1109 ></P
1110 ><UL
1111 ><LI
1112 ><P
1113 >mbox.MaildirFolderHandler</P
1114 ></LI
1115 ><LI
1116 ><P
1117 >mbox.MaildirMessageHandler</P
1118 ></LI
1119 ><LI
1120 ><P
1121 >mbox.MBoxMessageHandler</P
1122 ></LI
1123 ><LI
1124 ><P
1125 >mbox.MBoxFolderHandler</P
1126 ></LI
1127 ></UL
1128 ><P
1129 > These four handlers provide a unique "virtual folder"
1130 service. They allow you to present mailboxes as if they
1131 were folders, the items of the folders being the
1132 messages in the mailbox, organized by subject. This is
1133 useful for presenting mail archives or just making
1134 e-mail accessible in a nice and easy fashion.
1135 </P
1136 ><P
1137 > To use these handlers, all you have to do is enable them
1138 in your <SPAN
1139 CLASS="PROPERTY"
1140 >handlers</SPAN
1141 > section. They
1142 will automatically detect requests for mailboxes and
1143 handle them appropriately.
1144 </P
1145 ><P
1146 > The different handlers are for traditional Unix mbox
1147 mailboxes (all messages in a single file) and new
1148 qmail-stype Maildir mailboxes. You can enable only the
1149 two handlers for the specific mailbox type that you use,
1150 if desired.
1151 </P
1152 ></DIV
1153 ><DIV
1154 CLASS="SECT1"
1155 ><HR><H2
1156 CLASS="SECT1"
1157 ><A
1158 NAME="HANDLERS.PYGHANDLER"
1159 >5.7. pyg.PYGHandler</A
1160 ></H2
1161 ><P
1162 > PYG (short for PYGopherd) is a mechanism that provides a
1163 tremendous amount of flexibility. Rather than just
1164 letting you execute a script like other Gopher or HTTP
1165 servers, PYGs are actually loaded up into PyGopherd and
1166 become fully-capable first-class virtual handlers. Yet
1167 they need not be known ahead of time, and are loaded
1168 dynamically.
1169 </P
1170 ><P
1171 > With a PYG handler, you can generate gopher directories,
1172 handle searches, generate files, and more on the fly.
1173 You can create entire virtual directory trees (for
1174 instance, to interface with NNTP servers or with DICT
1175 servers), and access them all using the standard Gopher
1176 protocol. All of this without having to modify even one
1177 line of <SPAN
1178 CLASS="APPLICATION"
1179 >PyGopherd</SPAN
1180 > code.
1181 </P
1182 ><P
1183 > If enabled, the <SPAN
1184 CLASS="PROPERTY"
1185 >pyg.PYGHandler</SPAN
1186 > will
1187 look for files with the extension .pyg that are marked
1188 executable. If found, they will be loaded and run as
1189 PYGs.
1190 </P
1191 ><P
1192 > Please note: this module provides the capability to
1193 execute arbitrary code. Please consider the security
1194 ramifications of that before enabling it.
1195 </P
1196 ><P
1197 > See the <SPAN
1198 CLASS="PROPERTY"
1199 >virtual.Virtual</SPAN
1200 > handler for
1201 more information about passing data to your scripts at
1202 runtime.
1203 </P
1204 ><P
1205 > At present, documentation on writing PYGs is not
1206 provided, but you may find examples in the
1207 <SPAN
1208 CLASS="PROPERTY"
1209 >pygfarm</SPAN
1210 > directory included with the
1211 <SPAN
1212 CLASS="APPLICATION"
1213 >PyGopherd</SPAN
1214 > distribution.
1215 </P
1216 ></DIV
1217 ><DIV
1218 CLASS="SECT1"
1219 ><HR><H2
1220 CLASS="SECT1"
1221 ><A
1222 NAME="HANDLERS.EXECHANDLER"
1223 >5.8. scriptexec.ExecHandler</A
1224 ></H2
1225 ><P
1226 > This handler implements "old-style" script execution;
1227 that is, executing arbitrary programs and piping the
1228 result to the client. It is, for the most part,
1229 compatible with both scripts written for UMN gopherd and
1230 the Bucktooth gopher server. If enabled, it will
1231 execute any file that is marked executable in the
1232 filesystem. It will normally list scripts as returning
1233 plain text, but you may create a custom link to the
1234 script that defines it as returning whatever kind of
1235 file you desire. Unlike PYGs, this type must be known
1236 in advance.
1237 </P
1238 ><P
1239 > The <SPAN
1240 CLASS="PROPERTY"
1241 >scriptexec.ExecHandler</SPAN
1242 > will set
1243 environment variables for your scripts to use. They are
1244 as follows:
1245 </P
1246 ><P
1247 ></P
1248 ><DIV
1249 CLASS="VARIABLELIST"
1250 ><DL
1251 ><DT
1252 >SERVER_NAME</DT
1253 ><DD
1254 ><P
1255 >The name of this server as defined in
1256 the configuration file or detected from the
1257 operating system.</P
1258 ></DD
1259 ><DT
1260 >SERVER_PORT</DT
1261 ><DD
1262 ><P
1263 >The port this server is listening on.</P
1264 ></DD
1265 ><DT
1266 >REMOTE_ADDR</DT
1267 ><DD
1268 ><P
1269 >The IP address of the client.</P
1270 ></DD
1271 ><DT
1272 >REMOTE_PORT</DT
1273 ><DD
1274 ><P
1275 >The port number of the client.</P
1276 ></DD
1277 ><DT
1278 >REMOTE_HOST</DT
1279 ><DD
1280 ><P
1281 >The same value as <SPAN
1282 CLASS="PROPERTY"
1283 >REMOTE_ADDR</SPAN
1284 ></P
1285 ></DD
1286 ><DT
1287 >SELECTOR</DT
1288 ><DD
1289 ><P
1290 >The file that was requested; that is,
1291 the relative path to this script. If the selector
1292 included additional parameters after a |, they
1293 will be included in this string as well.
1294 </P
1295 ></DD
1296 ><DT
1297 >REQUEST</DT
1298 ><DD
1299 ><P
1300 >The "base" part of the selector; that
1301 is, the part leading up to the |.</P
1302 ></DD
1303 ><DT
1304 >SEARCHREQUEST</DT
1305 ><DD
1306 ><P
1307 >Included only if the client specified
1308 search data, this is used if the client is
1309 searching for something.
1310 </P
1311 ></DD
1312 ></DL
1313 ></DIV
1314 ><P
1315 > See the <SPAN
1316 CLASS="PROPERTY"
1317 >virtual.Virtual</SPAN
1318 > handler for
1319 more information about passing data to your scripts at
1320 runtime.
1321 </P
1322 ><P
1323 > Please note: this module provides the capability to
1324 execute arbitrary code. Please consider the security
1325 ramifications of that before enabling it.
1326 </P
1327 ></DIV
1328 ><DIV
1329 CLASS="SECT1"
1330 ><HR><H2
1331 CLASS="SECT1"
1332 ><A
1333 NAME="HANDLERS.UMN"
1334 >5.9. UMN.UMNDirHandler</A
1335 ></H2
1336 ><P
1337 > This is one of the most powerful workhorse handlers in
1338 <SPAN
1339 CLASS="APPLICATION"
1340 >PyGopherd</SPAN
1341 >. It is designed to emulate most of the ways
1342 in which the UMN gopherd distribution generates
1343 directories, even going so far as to be bug-compatible
1344 in some cases. Generating directories with this handler
1345 is often the best general-purpose way to make nice
1346 directories in gopherspace.
1347 </P
1348 ><P
1349 > The remainder of the description of the
1350 <SPAN
1351 CLASS="PROPERTY"
1352 >UMN.UMNDirHandler</SPAN
1353 >, except for the
1354 Abstracts and Info section, is lifted directly from the
1355 original UMN gopherd documentation, with light editing,
1356 because this handler implements it so exactly that there
1357 was no point in rewriting all that documentation :-)
1358 </P
1359 ><DIV
1360 CLASS="SECT2"
1361 ><HR><H3
1362 CLASS="SECT2"
1363 ><A
1364 NAME="HANDLERS.UMN.LINKS"
1365 >5.9.1. Links</A
1366 ></H3
1367 ><P
1368 > You can override the default view of a directory as
1369 generated by <SPAN
1370 CLASS="PROPERTY"
1371 >dir.DirHandler</SPAN
1372 > by
1373 creating what are known as <SPAN
1374 CLASS="emphasis"
1375 ><I
1376 CLASS="EMPHASIS"
1377 >Links</I
1378 ></SPAN
1379 > in
1380 the data tree.
1381 </P
1382 ><P
1383 > The ability to make links to other hosts is how gopher
1384 distributes itself among multiple hosts. There are two
1385 different ways to make a link. The first and simplest is
1386 to create a link file that contains the data needed by the
1387 server. By default all files in the gopher data directory
1388 starting with a period are taken to be link files. A link
1389 file can contain multiple links. To define a link you
1390 need to put five lines in a link file that define the
1391 needed characteristics for the document. Here is an
1392 example of a link.
1393 </P
1394 ><PRE
1395 CLASS="PROGRAMLISTING"
1396 >Name=Cheese Ball Recipes
1397 Numb=1
1398 Type=1
1399 Port=150
1400 Path=1/Moo/Cheesy
1401 Host=zippy.micro.umn.edu
1402 </PRE
1403 ><P
1404 > The Name= line is what the user will see when cruising
1405 through the database. In this case the name is "Cheese
1406 Ball Recipes". The "Type=" defines what kind of document
1407 this object is. For a list of all defined types, see
1408 Gopher Item Types below. For Gopher+ and HTTP, a MIME
1409 type is also used, which is determined automatically based
1410 on the type you specify.
1411 </P
1412 ><P
1413 > The "Path=" line contains the selector string that the
1414 client will use to retrieve the actual document. The
1415 Numb= specifies that this entry should be presented first
1416 in the directory list (instead of being alphabetized).
1417 The "Numb=" line is optional. If it is present it cannot
1418 be the last line of the link. The "Host=" and "Port="
1419 lines specify a fully qualified domain name (FQDN) and a
1420 port respectively. You may substitute a plus '+' for
1421 these two parameters if you wish. The server will insert
1422 the current hostname and the current port when it sees a
1423 plus in either of these two fields.
1424 </P
1425 ><P
1426 >An easy way to retrieve links is to use the Curses
1427 Gopher Client. By pressing '=' You can get information
1428 suitable for inclusion in a link file.
1429 </P
1430 ></DIV
1431 ><DIV
1432 CLASS="SECT2"
1433 ><HR><H3
1434 CLASS="SECT2"
1435 ><A
1436 NAME="HANDLERS.UMN.OVERRIDING"
1437 >5.9.2. Overriding Defaults</A
1438 ></H3
1439 ><P
1440 > The server looks for a directory called
1441 <TT
1442 CLASS="FILENAME"
1443 >.cap</TT
1444 > when parsing a directory. The
1445 server then checks to see if the <TT
1446 CLASS="FILENAME"
1447 >.cap</TT
1448 >
1449 directory contains a file with the same name as the file
1450 it's parsing. If this file exists then the server will
1451 open it for reading. The server parses this file just
1452 like a link file. However, instead of making a new
1453 object, the parameters inside the
1454 <TT
1455 CLASS="FILENAME"
1456 >.cap/</TT
1457 > file are used to override any
1458 of the server supplied default values.
1459 </P
1460 ><P
1461 > For instance, say you wanted to change the Title of a text
1462 file for gopher, but don't want to change the filename.
1463 You also don't want it alphabetized, instead you want it
1464 second in the directory listing. You could make a
1465 set-aside file in the <TT
1466 CLASS="FILENAME"
1467 >.cap</TT
1468 > directory with the same
1469 filename that contained the following lines:
1470 </P
1471 ><PRE
1472 CLASS="PROGRAMLISTING"
1473 >Name=New Long Cool Name
1474 Numb=2
1475 </PRE
1476 ><P
1477 > An alternative to <TT
1478 CLASS="FILENAME"
1479 >.cap</TT
1480 > files are
1481 extended link files. They work just the same as the files
1482 described in Links above, but have a somewhat abbreviated
1483 format. As an example, if the name of the file was
1484 <TT
1485 CLASS="FILENAME"
1486 >file-to-change</TT
1487 >, then you could create
1488 a file called <TT
1489 CLASS="FILENAME"
1490 >.names</TT
1491 > with the
1492 following contents:
1493 </P
1494 ><PRE
1495 CLASS="PROGRAMLISTING"
1496 >Path=./file-to-change
1497 Name=New Long Cool Name
1498 Numb=2
1499 </PRE
1500 ></DIV
1501 ><DIV
1502 CLASS="SECT2"
1503 ><HR><H3
1504 CLASS="SECT2"
1505 ><A
1506 NAME="HANDLERS.UMN.COOL"
1507 >5.9.3. Adding Cool Links</A
1508 ></H3
1509 ><P
1510 > One cool thing you can do with .Links is to add neato
1511 services to your gopher server. Adding a link like this:
1512 </P
1513 ><PRE
1514 CLASS="PROGRAMLISTING"
1515 >Name=Cool ftp directory
1516 Type=h
1517 Path=/URL:ftp://hostname/path/
1518 Host=+
1519 Port=+
1520
1521 Name=Cool web site
1522 Type=h
1523 Path=/URL:http://hostname/
1524 Host=+
1525 Port=+
1526 </PRE
1527 ><P
1528 > Will allow you to link in any FTP or Web site to your
1529 gopher. (See url.URLHandler for more details.)
1530 </P
1531 ><P
1532 > You can easily add a finger site to your gopher server thusly:
1533 </P
1534 ><PRE
1535 CLASS="PROGRAMLISTING"
1536 >Name=Finger information
1537 Type=0
1538 Path=lindner
1539 Host=mudhoney.micro.umn.edu
1540 Port=79
1541 </PRE
1542 ></DIV
1543 ><DIV
1544 CLASS="SECT2"
1545 ><HR><H3
1546 CLASS="SECT2"
1547 ><A
1548 NAME="HANDLERS.UMN.HIDING"
1549 >5.9.4. Hiding an Entry</A
1550 ></H3
1551 ><P
1552 > This kind of trick may be necessary in some cases,
1553 and thus for
1554 object "fred", the overriding .names file entry would be:
1555 </P
1556 ><PRE
1557 CLASS="PROGRAMLISTING"
1558 >Type=X
1559 Path=./fred
1560 </PRE
1561 ><P
1562 > by overriding default type to be "X". This
1563 may be useful, when for some reason there are
1564 symlinks (or whatever) in the directory at which
1565 <SPAN
1566 CLASS="APPLICATION"
1567 >PyGopherd</SPAN
1568 > looks, and those entries are not desired to
1569 be shown at all.
1570 </P
1571 ></DIV
1572 ><DIV
1573 CLASS="SECT2"
1574 ><HR><H3
1575 CLASS="SECT2"
1576 ><A
1577 NAME="HANDLERS.UMN.ABSTRACTS"
1578 >5.9.5. Abstracts and Info</A
1579 ></H3
1580 ><P
1581 > Many modern gopher server maintainers like to intersperse
1582 gopher directory listings with other information -- often,
1583 additional information about the contents of files in the
1584 directory. The gophermap system provides one way to do
1585 that, and abstracts used with UMN gopher directories
1586 provides another.
1587 </P
1588 ><P
1589 > Subject to the <SPAN
1590 CLASS="PROPERTY"
1591 >abstract_headers</SPAN
1592 > and
1593 <SPAN
1594 CLASS="PROPERTY"
1595 >abstract_entries</SPAN
1596 > configuration file
1597 options, this feature allows you to define that extra
1598 information. You can do that by simply creating a file
1599 named <TT
1600 CLASS="FILENAME"
1601 >filename.abstract</TT
1602 > right
1603 alongside the regular file in your directory. The file
1604 will be interpreted as the abstract. For a directory,
1605 create a file named <TT
1606 CLASS="FILENAME"
1607 >.abstract</TT
1608 > in the
1609 directory. Simple as that!
1610 </P
1611 ></DIV
1612 ></DIV
1613 ><DIV
1614 CLASS="SECT1"
1615 ><HR><H2
1616 CLASS="SECT1"
1617 ><A
1618 NAME="HANDLERS.HTMLURLHANDLER"
1619 >5.10. url.HTMLURLHandler</A
1620 ></H2
1621 ><P
1622 > <SPAN
1623 CLASS="APPLICATION"
1624 >PyGopherd</SPAN
1625 > provides ways for you to link to pages outside
1626 Gopherspace -- that is, web pages, FTP sites, and the like.
1627 This is accomplished according to the <A
1628 HREF="http://lists.complete.org/[email protected]/2002/02/msg00033.html.gz"
1629 TARGET="_top"
1630 >Links
1631 to URL</A
1632 > specification (see Conforming To below for
1633 details). In order to link to a URL (EXCEPT gopher URLs)
1634 from a menu, you create a link of type h (regardless of the
1635 actual type of the resource that you are linking to) in your
1636 <TT
1637 CLASS="FILENAME"
1638 >gophermap</TT
1639 > or
1640 <TT
1641 CLASS="FILENAME"
1642 >.Links</TT
1643 >
1644 file that looks like this:
1645 </P
1646 ><PRE
1647 CLASS="PROGRAMLISTING"
1648 >/URL:http://www.complete.org/
1649 </PRE
1650 ><P
1651 > Modern Gopher clients that follow the Links to URL
1652 specification will automatically follow that link when you
1653 select it. The rest need some help, and that's where this
1654 handler comes in.
1655 </P
1656 ><P
1657 > For Gopher clients that do not follow the Links to URL
1658 specification, the <SPAN
1659 CLASS="PROPERTY"
1660 >url.HTMLURLHandler</SPAN
1661 >
1662 will automatically generate an HTML document for them on the
1663 fly. This document includes a refresh code that will send
1664 them to the proper page. You should not disable this
1665 handler.
1666 </P
1667 ></DIV
1668 ><DIV
1669 CLASS="SECT1"
1670 ><HR><H2
1671 CLASS="SECT1"
1672 ><A
1673 NAME="HANDLERS.URLTYPEREWRITER"
1674 >5.11. url.URLTypeRewriter</A
1675 ></H2
1676 ><P
1677 > Some people wish to serve HTML documents from their Gopher
1678 server. One problem with that is that links in Gopherspace
1679 include an extra type character at the beginning, whereas
1680 links in HTTP do not. This handler will remove the extra
1681 type character from HTTP requests that come in, allowing a
1682 single relative-to-root link to work for both.
1683 </P
1684 ></DIV
1685 ><DIV
1686 CLASS="SECT1"
1687 ><HR><H2
1688 CLASS="SECT1"
1689 ><A
1690 NAME="HANDLERS.VIRTUAL"
1691 >5.12. virtual.Virtual</A
1692 ></H2
1693 ><P
1694 > This handler is not intended to ever be used directly, but
1695 is used by many other handlers such as the mbox support, PYG
1696 handlers, and others. It is used to generate virtual
1697 entries in the directory hierarchy -- that is, entries that
1698 look normal to a client, but do not actually correspond to a
1699 file on disk.
1700 </P
1701 ><P
1702 > One special feature of the
1703 <SPAN
1704 CLASS="PROPERTY"
1705 >virtual.Virtual</SPAN
1706 > handler is that you can
1707 send information to it at runtime in a manner similar to a
1708 CGI script on the web. You do this by adding a question
1709 mark after the regular selector, followed by any arbitrary
1710 data that you wish to have sent to the virtual request
1711 handler.
1712 </P
1713 ></DIV
1714 ><DIV
1715 CLASS="SECT1"
1716 ><HR><H2
1717 CLASS="SECT1"
1718 ><A
1719 NAME="HANDLERS.ZIP"
1720 >5.13. ZIP.ZIPHandler</A
1721 ></H2
1722 ><P
1723 > Using zip.ZIPHandler, you can save space on your server by
1724 converting part or all of your site into a ZIP file.
1725 <SPAN
1726 CLASS="APPLICATION"
1727 >PyGopherd</SPAN
1728 > can use the contents of that ZIP file as the
1729 contents of your site -- completely transparently.
1730 </P
1731 ><P
1732 > The ZIP file handler must be enabled in the configuration
1733 file for this to work.
1734 </P
1735 ></DIV
1736 ></DIV
1737 ><DIV
1738 CLASS="CHAPTER"
1739 ><HR><H1
1740 ><A
1741 NAME="TYPES"
1742 ></A
1743 >Chapter 6. Gopher Item Types</H1
1744 ><P
1745 > When you construct links to files via
1746 <TT
1747 CLASS="FILENAME"
1748 >.Links</TT
1749 > or <TT
1750 CLASS="FILENAME"
1751 >gophermap</TT
1752 >
1753 files, or modify the <SPAN
1754 CLASS="PROPERTY"
1755 >mapping</SPAN
1756 > in the
1757 configuration file, you will need to know these. Items
1758 bearing the "not implemented" text are not served up by
1759 <SPAN
1760 CLASS="APPLICATION"
1761 >PyGopherd</SPAN
1762 > as it ships, generally due to requirements of
1763 customized per-site software, but may be served up via PYG
1764 extension modules or other gopher servers.
1765 </P
1766 ><P
1767 > This list was prepared based on RFC1436, the UMN gopherd(1) manpage,
1768 and best current practices.
1769 </P
1770 ><P
1771 ></P
1772 ><DIV
1773 CLASS="VARIABLELIST"
1774 ><DL
1775 ><DT
1776 >0</DT
1777 ><DD
1778 ><P
1779 >Plain text file</P
1780 ></DD
1781 ><DT
1782 >1</DT
1783 ><DD
1784 ><P
1785 >Directory</P
1786 ></DD
1787 ><DT
1788 >2</DT
1789 ><DD
1790 ><P
1791 >CSO phone book server (not implemented by <SPAN
1792 CLASS="APPLICATION"
1793 >PyGopherd</SPAN
1794 >)</P
1795 ></DD
1796 ><DT
1797 >3</DT
1798 ><DD
1799 ><P
1800 >Error condition; text that follows is plain text</P
1801 ></DD
1802 ><DT
1803 >4</DT
1804 ><DD
1805 ><P
1806 >Macintosh file, BinHex format</P
1807 ></DD
1808 ><DT
1809 >5</DT
1810 ><DD
1811 ><P
1812 >DOS binary archive (not implemented by
1813 <SPAN
1814 CLASS="APPLICATION"
1815 >PyGopherd</SPAN
1816 >; use type 9 instead)</P
1817 ></DD
1818 ><DT
1819 >6</DT
1820 ><DD
1821 ><P
1822 >uuencoded file; not directly generated by
1823 <SPAN
1824 CLASS="APPLICATION"
1825 >PyGopherd</SPAN
1826 > automatically, but can be linked to
1827 manually. Most gopher clients will handle this better
1828 as type 1.
1829 </P
1830 ></DD
1831 ><DT
1832 >7</DT
1833 ><DD
1834 ><P
1835 >Search</P
1836 ></DD
1837 ><DT
1838 >8</DT
1839 ><DD
1840 ><P
1841 >Telnet link</P
1842 ></DD
1843 ><DT
1844 >9</DT
1845 ><DD
1846 ><P
1847 >Binary file</P
1848 ></DD
1849 ><DT
1850 >+</DT
1851 ><DD
1852 ><P
1853 >Redundant server (not implemented by <SPAN
1854 CLASS="APPLICATION"
1855 >PyGopherd</SPAN
1856 >)</P
1857 ></DD
1858 ><DT
1859 >c</DT
1860 ><DD
1861 ><P
1862 >Calendar (not implemented by <SPAN
1863 CLASS="APPLICATION"
1864 >PyGopherd</SPAN
1865 >)</P
1866 ></DD
1867 ><DT
1868 >e</DT
1869 ><DD
1870 ><P
1871 >Event (not implemented by <SPAN
1872 CLASS="APPLICATION"
1873 >PyGopherd</SPAN
1874 >)</P
1875 ></DD
1876 ><DT
1877 >g</DT
1878 ><DD
1879 ><P
1880 >GIF-format graphic</P
1881 ></DD
1882 ><DT
1883 >h</DT
1884 ><DD
1885 ><P
1886 >HTML file</P
1887 ></DD
1888 ><DT
1889 >I</DT
1890 ><DD
1891 ><P
1892 >Any kind of graphic file other than GIF</P
1893 ></DD
1894 ><DT
1895 >i</DT
1896 ><DD
1897 ><P
1898 >Informational
1899 text included in a directory that is displayed but does not
1900 link to any actual file.</P
1901 ></DD
1902 ><DT
1903 >M</DT
1904 ><DD
1905 ><P
1906 >MIME multipart/mixed file</P
1907 ></DD
1908 ><DT
1909 >s</DT
1910 ><DD
1911 ><P
1912 >Any kind of sound file</P
1913 ></DD
1914 ><DT
1915 >T</DT
1916 ><DD
1917 ><P
1918 >tn3270 link</P
1919 ></DD
1920 ><DT
1921 >X, -</DT
1922 ><DD
1923 ><P
1924 > UMN-specific -- signifies that this entry should not be
1925 displayed in a directory entry, but may be accessed via a
1926 direct link. This value is never transmitted in any Gopher
1927 protocol.
1928 </P
1929 ></DD
1930 ></DL
1931 ></DIV
1932 ></DIV
1933 ><DIV
1934 CLASS="REFERENCE"
1935 ><A
1936 NAME="PYGOPHERD.MAN"
1937 ></A
1938 ><DIV
1939 CLASS="TITLEPAGE"
1940 ><H1
1941 CLASS="TITLE"
1942 >I. PyGopherd Manpage</H1
1943 ><DIV
1944 CLASS="TOC"
1945 ><DL
1946 ><DT
1947 ><B
1948 >Table of Contents</B
1949 ></DT
1950 ><DT
1951 ><A
1952 HREF="#AEN474"
1953 >pygopherd</A
1954 >&nbsp;--&nbsp;Multiprotocol Information Server</DT
1955 ></DL
1956 ></DIV
1957 ></DIV
1958 ><H1
1959 ><A
1960 NAME="AEN474"
1961 ></A
1962 >pygopherd</H1
1963 ><DIV
1964 CLASS="REFNAMEDIV"
1965 ><A
1966 NAME="AEN485"
1967 ></A
1968 ><H2
1969 >Name</H2
1970 >PyGopherd&nbsp;--&nbsp;Multiprotocol Information Server</DIV
1971 ><DIV
1972 CLASS="REFSYNOPSISDIV"
1973 ><A
1974 NAME="AEN488"
1975 ></A
1976 ><H2
1977 >Synopsis</H2
1978 ><P
1979 ><B
1980 CLASS="COMMAND"
1981 >pygopherd</B
1982 > [<TT
1983 CLASS="REPLACEABLE"
1984 ><I
1985 >configfile</I
1986 ></TT
1987 >]</P
1988 ></DIV
1989 ><DIV
1990 CLASS="REFSECT1"
1991 ><A
1992 NAME="MAN.DESCRIPTION"
1993 ></A
1994 ><H2
1995 >Description</H2
1996 ><P
1997 > Welcome to <SPAN
1998 CLASS="APPLICATION"
1999 >PyGopherd</SPAN
2000 >. In a nutshell, <SPAN
2001 CLASS="APPLICATION"
2002 >PyGopherd</SPAN
2003 >
2004 is a modern dynamic
2005 multi-protocol hierarchical information server with a pluggable
2006 modularized extension system,
2007 full flexible caching, virtual files and
2008 folders, and autodetection of file types -- all with support for
2009 standardized yet extensible per-document metadata. Whew! Read on for
2010 information on this what all these buzzwords mean.
2011 </P
2012 ></DIV
2013 ><DIV
2014 CLASS="REFSECT1"
2015 ><A
2016 NAME="MANPAGE.QUICKSTART"
2017 ></A
2018 ><H2
2019 >Quick Start</H2
2020 ><P
2021 > If you have already installed <SPAN
2022 CLASS="APPLICATION"
2023 >PyGopherd</SPAN
2024 > system-wide, or your
2025 administrator has done that for you, your task for setting up
2026 <SPAN
2027 CLASS="APPLICATION"
2028 >PyGopherd</SPAN
2029 > for the first time is quite simple. You just need
2030 to set up your configuration file, make your folder directory,
2031 and run it!
2032 </P
2033 ><P
2034 > You can quickly set up your configuration file. The
2035 distribution includes two files of interest:
2036 <TT
2037 CLASS="FILENAME"
2038 >conf/pygopherd.conf</TT
2039 > and
2040 <TT
2041 CLASS="FILENAME"
2042 >conf/mime.types</TT
2043 >. Debian users will find
2044 the configuration file pre-installed in
2045 <TT
2046 CLASS="FILENAME"
2047 >/etc/pygopherd/pygopherd.conf</TT
2048 > and the
2049 <TT
2050 CLASS="FILENAME"
2051 >mime.types</TT
2052 > file provided by the system
2053 already.
2054 </P
2055 ><P
2056 > Open up <TT
2057 CLASS="FILENAME"
2058 >pygopherd.conf</TT
2059 > in your editor and
2060 adjust to suit. The file is heavily commented and you can
2061 refer to it for detailed information. Some settings to take a
2062 look at include: <SPAN
2063 CLASS="PROPERTY"
2064 >detach</SPAN
2065 >,
2066 <SPAN
2067 CLASS="PROPERTY"
2068 >pidfile</SPAN
2069 >, <SPAN
2070 CLASS="PROPERTY"
2071 >port</SPAN
2072 >,
2073 <SPAN
2074 CLASS="PROPERTY"
2075 >usechroot</SPAN
2076 >, <SPAN
2077 CLASS="PROPERTY"
2078 >setuid</SPAN
2079 >,
2080 <SPAN
2081 CLASS="PROPERTY"
2082 >setgid</SPAN
2083 >, and <SPAN
2084 CLASS="PROPERTY"
2085 >root</SPAN
2086 >.
2087 These may or may not work at their defaults for you. The
2088 remaining ones should be fine for a basic setup.
2089 </P
2090 ><P
2091 > Invoke <SPAN
2092 CLASS="APPLICATION"
2093 >PyGopherd</SPAN
2094 > with <B
2095 CLASS="COMMAND"
2096 >pygopherd
2097 path/to/configfile</B
2098 > (or
2099 <B
2100 CLASS="COMMAND"
2101 >/etc/init.d/pygopherd start</B
2102 > on Debian).
2103 Place some files in the location specified by the
2104 <SPAN
2105 CLASS="PROPERTY"
2106 >root</SPAN
2107 > directive in the config file and
2108 you're ready to run!
2109 </P
2110 ></DIV
2111 ><DIV
2112 CLASS="REFSECT1"
2113 ><A
2114 NAME="OPTIONS"
2115 ></A
2116 ><H2
2117 >Options</H2
2118 ><P
2119 > All <SPAN
2120 CLASS="APPLICATION"
2121 >PyGopherd</SPAN
2122 > configuratoin is done via the configuration
2123 file. Therefore, the program has only one command-line
2124 option:
2125 </P
2126 ><P
2127 ></P
2128 ><DIV
2129 CLASS="VARIABLELIST"
2130 ><DL
2131 ><DT
2132 ><TT
2133 CLASS="REPLACEABLE"
2134 ><I
2135 >configfile</I
2136 ></TT
2137 ></DT
2138 ><DD
2139 ><P
2140 >This option argument specifies the location
2141 of the configuration file that <SPAN
2142 CLASS="APPLICATION"
2143 >PyGopherd</SPAN
2144 > is to use.</P
2145 ></DD
2146 ></DL
2147 ></DIV
2148 ></DIV
2149 ><DIV
2150 CLASS="REFSECT1"
2151 ><A
2152 NAME="CONFORMING"
2153 ></A
2154 ><H2
2155 >Conforming To</H2
2156 ><P
2157 ></P
2158 ><UL
2159 ><LI
2160 ><P
2161 > The Internet Gopher Protocol as specified in RFC1436
2162 </P
2163 ></LI
2164 ><LI
2165 ><P
2166 > The Gopher+ upward-compatible enhancements to the Internet Gopher
2167 Protocol from the University of Minnesota as laid out at
2168 <A
2169 HREF="gopher://gopher.quux.org/0/Archives/mirrors/boombox.micro.umn.edu/pub/gopher/gopher_protocol/Gopher+/Gopher+.txt"
2170 TARGET="_top"
2171 >gopher://gopher.quux.org/0/Archives/mirrors/boombox.micro.umn.edu/pub/gopher/gopher_protocol/Gopher+/Gopher+.txt</A
2172 >.
2173 </P
2174 ></LI
2175 ><LI
2176 ><P
2177 > The gophermap file format as originally implemented in the
2178 Bucktooth gopher server and described at
2179 <A
2180 HREF="gopher://gopher.floodgap.com/0/buck/dbrowse%3Ffaquse%201"
2181 TARGET="_top"
2182 >gopher://gopher.floodgap.com/0/buck/dbrowse%3Ffaquse%201</A
2183 >.
2184 </P
2185 ></LI
2186 ><LI
2187 ><P
2188 > The Links to URL specification as laid out by John Goerzen
2189 at
2190 <A
2191 HREF="gopher://gopher.quux.org/0/Archives/Mailing%20Lists/gopher/gopher.2002-02%3f/MBOX-MESSAGE/34"
2192 TARGET="_top"
2193 >gopher://gopher.quux.org/0/Archives/Mailing%20Lists/gopher/gopher.2002-02%3f/MBOX-MESSAGE/34</A
2194 >.
2195 </P
2196 ></LI
2197 ><LI
2198 ><P
2199 > The UMN format for specifying object attributes and links
2200 with .cap, .Links, .abstract, and similar files as specified elsewhere
2201 in this document and implemented by UMN gopherd.
2202 </P
2203 ></LI
2204 ><LI
2205 ><P
2206 > The PYG format for extensible Python gopher objects as created for
2207 <SPAN
2208 CLASS="APPLICATION"
2209 >PyGopherd</SPAN
2210 >.</P
2211 ></LI
2212 ><LI
2213 ><P
2214 > Hypertext Transfer Protocol HTTP/1.0 as specified in
2215 RFC1945
2216 </P
2217 ></LI
2218 ><LI
2219 ><P
2220 > Hypertext Markup Language (HTML) 3.2 and 4.0
2221 Transitional as specified in RFC1866 and RFC2854.
2222 </P
2223 ></LI
2224 ><LI
2225 ><P
2226 > Maildir as specified in
2227 <A
2228 HREF="http://www.qmail.org/qmail-manual-html/man5/maildir.html"
2229 TARGET="_top"
2230 >http://www.qmail.org/qmail-manual-html/man5/maildir.html</A
2231 > and
2232 <A
2233 HREF="http://cr.yp.to/proto/maildir.html"
2234 TARGET="_top"
2235 >http://cr.yp.to/proto/maildir.html</A
2236 >.
2237 </P
2238 ></LI
2239 ><LI
2240 ><P
2241 > The mbox mail storage format as specified in
2242 <A
2243 HREF="http://www.qmail.org/qmail-manual-html/man5/mbox.html"
2244 TARGET="_top"
2245 >http://www.qmail.org/qmail-manual-html/man5/mbox.html</A
2246 >.
2247 </P
2248 ></LI
2249 ><LI
2250 ><P
2251 > Registered MIME media types as specified in RFC2048.
2252 </P
2253 ></LI
2254 ><LI
2255 ><P
2256 > Script execution conforming to both UMN standards as laid out in UMN
2257 gopherd(1) and Bucktooth standards as specified at
2258 <A
2259 HREF="gopher://gopher.floodgap.com:70/0/buck/dbrowse%3ffaquse%202"
2260 TARGET="_top"
2261 >gopher://gopher.floodgap.com:70/0/buck/dbrowse%3ffaquse%202</A
2262 >,
2263 so far as each can be implemented consistent with secure
2264 design principles.
2265 </P
2266 ></LI
2267 ><LI
2268 ><P
2269 > Standard Python 2.2.1 or above as implemented on
2270 POSIX-compliant systems.
2271 </P
2272 ></LI
2273 ><LI
2274 ><P
2275 > WAP/WML as defined by the WAP Forum.</P
2276 ></LI
2277 ></UL
2278 ></DIV
2279 ><DIV
2280 CLASS="REFSECT1"
2281 ><A
2282 NAME="BUGS"
2283 ></A
2284 ><H2
2285 >Bugs</H2
2286 ><P
2287 > Reports of bugs should be sent via e-mail to the <SPAN
2288 CLASS="APPLICATION"
2289 >PyGopherd</SPAN
2290 > issue tracker
2291 at <A
2292 HREF="https://github.com/michael-lazar/pygopherd/issues"
2293 TARGET="_top"
2294 >https://github.com/michael-lazar/pygopherd/issues</A
2295 >.
2296 </P
2297 ><P
2298 > The Web site also lists all current bugs, where you can check their
2299 status or contribute to fixing them.
2300 </P
2301 ></DIV
2302 ><DIV
2303 CLASS="REFSECT1"
2304 ><A
2305 NAME="COPYRIGHT"
2306 ></A
2307 ><H2
2308 >Copyright</H2
2309 ><P
2310 > <SPAN
2311 CLASS="APPLICATION"
2312 >PyGopherd</SPAN
2313 > is Copyright (C) 2002-2019 John Goerzen, 2021 Michael Lazar.
2314 </P
2315 ><P
2316 > This program is free software; you can redistribute it and/or
2317 modify it under the terms of the GNU General Public License as
2318 published by the Free Software Foundation; version 2 of the
2319 License.
2320 </P
2321 ><P
2322 > This program is distributed in the hope that it will be useful,
2323 but WITHOUT ANY WARRANTY; without even the implied warranty of
2324 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2325 GNU General Public License for more details.
2326 </P
2327 ><P
2328 > You should have received a copy of the GNU General Public License
2329 along with this program; if not, write to:
2330 </P
2331 ><PRE
2332 CLASS="PROGRAMLISTING"
2333 >Free Software Foundation, Inc.
2334 59 Temple Place
2335 Suite 330
2336 Boston, MA 02111-1307
2337 USA
2338 </PRE
2339 ></DIV
2340 ><DIV
2341 CLASS="REFSECT1"
2342 ><A
2343 NAME="AUTHOR"
2344 ></A
2345 ><H2
2346 >Author</H2
2347 ><P
2348 > <SPAN
2349 CLASS="APPLICATION"
2350 >PyGopherd</SPAN
2351 >, its libraries, documentation, and all included
2352 files (except where noted) was written by John Goerzen
2353 <CODE
2354 CLASS="EMAIL"
2355 >&#60;<A
2356 HREF="mailto:[email protected]"
2357 >[email protected]</A
2358 >&#62;</CODE
2359 >
2360 and copyright is held as stated in the
2361 Copyright section.
2362 </P
2363 ><P
2364 > Portions of this manual (specifically relating to certian UMN gopherd
2365 features and characteristics that PyGopherd emulates) are modified
2366 versions of the original
2367 gopherd(1) manpage accompanying the UMN gopher distribution. That
2368 document is distributed under the same terms as this, and
2369 bears the following copyright notices:
2370 </P
2371 ><PRE
2372 CLASS="PROGRAMLISTING"
2373 >Copyright (C) 1991-2000 University of Minnesota
2374 Copyright (C) 2000-2002 John Goerzen and other developers
2375 </PRE
2376 ><P
2377 > <SPAN
2378 CLASS="APPLICATION"
2379 >PyGopherd</SPAN
2380 > may be downloaded, and information found, from its
2381 homepage:
2382 </P
2383 ><P
2384 > <A
2385 HREF="https://github.com/michael-lazar/pygopherd"
2386 TARGET="_top"
2387 >https://github.com/michael-lazar/pygopherd</A
2388 ></P
2389 ><P
2390 >&#13; </P
2391 ></DIV
2392 ><DIV
2393 CLASS="REFSECT1"
2394 ><A
2395 NAME="AEN598"
2396 ></A
2397 ><H2
2398 >See Also</H2
2399 ><P
2400 > python (1).
2401 </P
2402 ></DIV
2403 ></DIV
2404 ></DIV
2405 ></BODY
2406 ></HTML
2407 >