1. Introduction
  2. Examples
    1. Consuming an htpasswd file
    2. Producing an htpasswd file
  3. Authors
  4. License
  5. The htpasswd record
  6. Reading an htpasswd file
  7. Producing an htpasswd file
  8. Version History

Introduction

The stream-htpasswd eggs|egg provides lazy generation and parsing of Apache htpasswd files. The htpasswd files are simple files that the Apache web server (and other related programs such as Subversion) use to keep a table of usernames and hashed passwords.

Examples

Consuming an htpasswd file

The following code reads an htpasswd file from current-input-port and prints information from it.

(use stream-ext stream-htpasswd format-modular)

(stream-for-each
  (lambda (entry)
    (format #t "User: ~A~%  Password hash: ~A~%"
               (stream->string (htpasswd-user entry))
               (stream->string (htpasswd-hash entry))))
  (stream->htpasswd (port->stream)))

Producing an htpasswd file

The following code produces an htpasswd file with a few hard-coded users.

(use stream-htpasswd stream-ext)

(define *users*
  (list->stream
    '(("pedro" "9qQnjR7L49qOk")
      ("juan" "9aoaXUqySXwKc")
      ("felix" "Q9i.QlCcFByfs"))))

(write-stream
  (htpasswd->stream
    (stream-map
      (lambda (token)
        (make-htpasswd
          (string->stream (car token))
          (string->stream (cadr token))))
      *users*)))

Authors

This egg is made by Alejandro Forero Cuervo <azul@freaks-unidos.net>.

License

The stream htpasswd egg for Chicken Scheme is in the public domain and may be reproduced or copied without permission from its author. Citation of the source is appreciated.

The htpasswd record

...

Reading an htpasswd file

...

Producing an htpasswd file

...

Version History

1.0
First release.