Outdated egg!

This is an egg for CHICKEN 3, the unsupported old release. You're almost certainly looking for the CHICKEN 4 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

  1. Outdated egg!
  2. Introduction
  3. Examples
    1. Consuming an htpasswd file
    2. Producing an htpasswd file
  4. Authors
  5. License
  6. The htpasswd record
  7. Reading an htpasswd file
  8. Producing an htpasswd file
  9. 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.