The myweb Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The myweb Reference Manual

This is the myweb Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 05:26:28 2022 GMT+0.

Table of Contents


1 Introduction

myweb - simple web server written in common lisp for educational reasons (tested on sbcl but should work with other implementations)

Author: Dmitry Geurkov 

Licensed under LGPL v3 (see LICENSE file)


Meaning?
	It was written so that i could become more acquainted with Common Lisp 
	It doesn't support parsing of POST requests (if you need it you can implement it)
	It's not 100% accurate and it might be buggy so it's not for a production use
	It's not striving to become anything more than a hobby 

Things you need
	sbcl (or any other Common Lisp implementation)
	quicklisp (will download all needed dependencies for you)

Depends on 
	swank
	usocket
	bordeaux-threads
	trivial-utf-8
	cl-log
	local-time
	
To start type
	sbcl --load load.lisp
	
And then to start web server type
	(myweb:start-http "localhost" 8080)

Open your browser at http://localhost:8080

Additional start options
	you can specify worker limit (maximum number of threads that will process http requests) and idle worker number using
	(myweb:start-http "localhost" 8080 :worker-limit 100 :idle-workers 10)
	
Where do i start if i want to have my code?
	Well first of all you should see handler.lisp
	This file contains all request processing logic and you can modify
	it to suite your needs
	
What encondings it support?
	well since it uses trivial-utf-8 it supports only utf-8 enconding sorry
	
How can i test load on it?
	well if you have apache2 installed you could try doing
	ab -n 10000 -c 10 http://localhost:8080

How can i log something when i'm processing my request?
	Use myweb.util:log-info myweb.util:log-warning and myweb.util:log-error functions


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 myweb

simple web server written in common lisp for educational reasons

Maintainer

Dmitry Geurkov <d.geurkov@gmail.com>

Author

Dmitry Geurkov <d.geurkov@gmail.com>

License

LGPLv3

Dependencies
  • usocket (system).
  • bordeaux-threads (system).
  • local-time (system).
  • cl-log (system).
  • trivial-utf-8 (system).
Source

myweb.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 myweb/myweb.asd

Source

myweb.asd.

Parent Component

myweb (system).

ASDF Systems

myweb.

Packages

myweb.config.

Public Interface

*base-directory* (special variable).


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.2 myweb/package.lisp

Source

myweb.asd.

Parent Component

myweb (system).

Packages

Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.3 myweb/util.lisp

Dependency

package.lisp (file).

Source

myweb.asd.

Parent Component

myweb (system).

Public Interface
Internals

Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.4 myweb/web.lisp

Dependency

util.lisp (file).

Source

myweb.asd.

Parent Component

myweb (system).

Public Interface
Internals

Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.5 myweb/log.lisp

Dependency

web.lisp (file).

Source

myweb.asd.

Parent Component

myweb (system).


Previous: , Up: Lisp   [Contents][Index]

3.1.6 myweb/handler.lisp

Dependency

log.lisp (file).

Source

myweb.asd.

Parent Component

myweb (system).

Public Interface

process-request (function).

Internals

process-index (function).


4 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

4.1 myweb.config

Source

myweb.asd.

Public Interface

*base-directory* (special variable).


Next: , Previous: , Up: Packages   [Contents][Index]

4.2 myweb

Source

package.lisp.

Use List
  • bordeaux-threads.
  • common-lisp.
  • usocket.
Public Interface
Internals

Next: , Previous: , Up: Packages   [Contents][Index]

4.3 myweb.handler

Source

package.lisp.

Use List

common-lisp.

Public Interface

process-request (function).

Internals

process-index (function).


Previous: , Up: Packages   [Contents][Index]

4.4 myweb.util

Source

package.lisp.

Use List
  • common-lisp.
  • local-time.
  • trivial-utf-8.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Special variables

Special Variable: *base-directory*
Package

myweb.config.

Source

myweb.asd.


5.1.2 Ordinary functions

Function: file-response (filename type request stream)
Package

myweb.util.

Source

util.lisp.

Function: get-header (name request)
Package

myweb.util.

Source

util.lisp.

Function: get-param (name request)
Package

myweb.util.

Source

util.lisp.

Function: html-template (filename type params request stream)
Package

myweb.util.

Source

util.lisp.

Function: http-response (code headers stream)
Package

myweb.util.

Source

util.lisp.

Function: list-requests ()
Package

myweb.

Source

web.lisp.

Function: list-workers ()
Package

myweb.

Source

web.lisp.

Function: log-error (message)
Package

myweb.util.

Source

util.lisp.

Function: log-info (message)
Package

myweb.util.

Source

util.lisp.

Function: log-warning (message)
Package

myweb.util.

Source

util.lisp.

Function: parse-request (stream)
Package

myweb.util.

Source

util.lisp.

Function: process-request (request stream)
Package

myweb.handler.

Source

handler.lisp.

Function: response-write (text stream)
Package

myweb.util.

Source

util.lisp.

Function: start-http (host port &key worker-limit idle-workers)
Package

myweb.

Source

web.lisp.

Function: stop-http ()
Package

myweb.

Source

web.lisp.

Function: stop-thread ()
Package

myweb.

Source

web.lisp.


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Special variables

Special Variable: *idle-workers*
Package

myweb.

Source

web.lisp.

Special Variable: *idle-workers-num*
Package

myweb.

Source

web.lisp.

Special Variable: *listen-socket*
Package

myweb.

Source

web.lisp.

Special Variable: *listen-thread*
Package

myweb.

Source

web.lisp.

Special Variable: *log-queue*
Package

myweb.util.

Source

util.lisp.

Special Variable: *log-queue-cond*
Package

myweb.util.

Source

util.lisp.

Special Variable: *log-queue-cond-lock*
Package

myweb.util.

Source

util.lisp.

Special Variable: *log-queue-lock*
Package

myweb.util.

Source

util.lisp.

Special Variable: *log-queue-time*
Package

myweb.util.

Source

util.lisp.

Special Variable: *new-line*
Package

myweb.util.

Source

util.lisp.

Special Variable: *request-mutex*
Package

myweb.

Source

web.lisp.

Special Variable: *request-queue*
Package

myweb.

Source

web.lisp.

Special Variable: *request-threads*
Package

myweb.

Source

web.lisp.

Special Variable: *worker-mutex*
Package

myweb.

Source

web.lisp.

Special Variable: *worker-num*
Package

myweb.

Source

web.lisp.

Special Variable: *workers*
Package

myweb.

Source

web.lisp.


Previous: , Up: Internals   [Contents][Index]

5.2.2 Ordinary functions

Function: decode-kv (s)
Package

myweb.util.

Source

util.lisp.

Function: decode-param (s)
Package

myweb.util.

Source

util.lisp.

Function: decode-params (s)
Package

myweb.util.

Source

util.lisp.

Function: http-404-not-found (message stream)
Package

myweb.util.

Source

util.lisp.

Function: http-acceptor (host port worker-limit idle-workers)
Package

myweb.

Source

web.lisp.

Function: http-char (c1 c2 &optional default)
Package

myweb.util.

Source

util.lisp.

Function: http-worker (request-id socket)
Package

myweb.

Source

web.lisp.

Function: log-worker ()
Package

myweb.util.

Source

util.lisp.

Function: parse-get-header (header stream)
Package

myweb.util.

Source

util.lisp.

Function: parse-header (header)
Package

myweb.util.

Source

util.lisp.

Function: parse-headers (stream)
Package

myweb.util.

Source

util.lisp.

Function: parse-params (s)
Package

myweb.util.

Source

util.lisp.

Function: parse-path (path)
Package

myweb.util.

Source

util.lisp.

Function: parse-post-header (header stream)
Package

myweb.util.

Source

util.lisp.

Function: process-index (request stream)
Package

myweb.handler.

Source

handler.lisp.

Function: worker-thread (request-id socket idle-workers)
Package

myweb.

Source

web.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   D   F   G   H   L   P   R   S   W  
Index Entry  Section

D
decode-kv: Private ordinary functions
decode-param: Private ordinary functions
decode-params: Private ordinary functions

F
file-response: Public ordinary functions
Function, decode-kv: Private ordinary functions
Function, decode-param: Private ordinary functions
Function, decode-params: Private ordinary functions
Function, file-response: Public ordinary functions
Function, get-header: Public ordinary functions
Function, get-param: Public ordinary functions
Function, html-template: Public ordinary functions
Function, http-404-not-found: Private ordinary functions
Function, http-acceptor: Private ordinary functions
Function, http-char: Private ordinary functions
Function, http-response: Public ordinary functions
Function, http-worker: Private ordinary functions
Function, list-requests: Public ordinary functions
Function, list-workers: Public ordinary functions
Function, log-error: Public ordinary functions
Function, log-info: Public ordinary functions
Function, log-warning: Public ordinary functions
Function, log-worker: Private ordinary functions
Function, parse-get-header: Private ordinary functions
Function, parse-header: Private ordinary functions
Function, parse-headers: Private ordinary functions
Function, parse-params: Private ordinary functions
Function, parse-path: Private ordinary functions
Function, parse-post-header: Private ordinary functions
Function, parse-request: Public ordinary functions
Function, process-index: Private ordinary functions
Function, process-request: Public ordinary functions
Function, response-write: Public ordinary functions
Function, start-http: Public ordinary functions
Function, stop-http: Public ordinary functions
Function, stop-thread: Public ordinary functions
Function, worker-thread: Private ordinary functions

G
get-header: Public ordinary functions
get-param: Public ordinary functions

H
html-template: Public ordinary functions
http-404-not-found: Private ordinary functions
http-acceptor: Private ordinary functions
http-char: Private ordinary functions
http-response: Public ordinary functions
http-worker: Private ordinary functions

L
list-requests: Public ordinary functions
list-workers: Public ordinary functions
log-error: Public ordinary functions
log-info: Public ordinary functions
log-warning: Public ordinary functions
log-worker: Private ordinary functions

P
parse-get-header: Private ordinary functions
parse-header: Private ordinary functions
parse-headers: Private ordinary functions
parse-params: Private ordinary functions
parse-path: Private ordinary functions
parse-post-header: Private ordinary functions
parse-request: Public ordinary functions
process-index: Private ordinary functions
process-request: Public ordinary functions

R
response-write: Public ordinary functions

S
start-http: Public ordinary functions
stop-http: Public ordinary functions
stop-thread: Public ordinary functions

W
worker-thread: Private ordinary functions

Jump to:   D   F   G   H   L   P   R   S   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*base-directory*: Public special variables
*idle-workers*: Private special variables
*idle-workers-num*: Private special variables
*listen-socket*: Private special variables
*listen-thread*: Private special variables
*log-queue*: Private special variables
*log-queue-cond*: Private special variables
*log-queue-cond-lock*: Private special variables
*log-queue-lock*: Private special variables
*log-queue-time*: Private special variables
*new-line*: Private special variables
*request-mutex*: Private special variables
*request-queue*: Private special variables
*request-threads*: Private special variables
*worker-mutex*: Private special variables
*worker-num*: Private special variables
*workers*: Private special variables

S
Special Variable, *base-directory*: Public special variables
Special Variable, *idle-workers*: Private special variables
Special Variable, *idle-workers-num*: Private special variables
Special Variable, *listen-socket*: Private special variables
Special Variable, *listen-thread*: Private special variables
Special Variable, *log-queue*: Private special variables
Special Variable, *log-queue-cond*: Private special variables
Special Variable, *log-queue-cond-lock*: Private special variables
Special Variable, *log-queue-lock*: Private special variables
Special Variable, *log-queue-time*: Private special variables
Special Variable, *new-line*: Private special variables
Special Variable, *request-mutex*: Private special variables
Special Variable, *request-queue*: Private special variables
Special Variable, *request-threads*: Private special variables
Special Variable, *worker-mutex*: Private special variables
Special Variable, *worker-num*: Private special variables
Special Variable, *workers*: Private special variables

Jump to:   *  
S