The myweb Reference Manual

Table of Contents

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

The myweb Reference Manual

This is the myweb Reference Manual, generated automatically by Declt version 2.3 "Robert April" on Wed Mar 14 04:20:56 2018 GMT+0.


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

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


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

2 Systems

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


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

2.1 myweb

Maintainer

Dmitry Geurkov <d.geurkov@gmail.com>

Author

Dmitry Geurkov <d.geurkov@gmail.com>

License

LGPLv3

Description

simple web server written in common lisp for educational reasons

Dependencies
Source

myweb.asd (file)

Components

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

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 files   [Contents][Index]

3.1.1 myweb.asd

Location

myweb.asd

Systems

myweb (system)

Packages

myweb.config

Exported Definitions

*base-directory* (special variable)


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

3.1.2 myweb/package.lisp

Parent

myweb (system)

Location

package.lisp

Packages

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

3.1.3 myweb/util.lisp

Dependency

package.lisp (file)

Parent

myweb (system)

Location

util.lisp

Exported Definitions
Internal Definitions

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

3.1.4 myweb/web.lisp

Dependency

util.lisp (file)

Parent

myweb (system)

Location

web.lisp

Exported Definitions
Internal Definitions

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

3.1.5 myweb/log.lisp

Dependency

web.lisp (file)

Parent

myweb (system)

Location

log.lisp


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

3.1.6 myweb/handler.lisp

Dependency

log.lisp (file)

Parent

myweb (system)

Location

handler.lisp

Exported Definitions

process-request (function)

Internal Definitions

process-index (function)


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

4 Packages

Packages are listed by definition order.


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

4.1 myweb.config

Source

myweb.asd

Exported Definitions

*base-directory* (special variable)


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

4.2 myweb.handler

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions

process-request (function)

Internal Definitions

process-index (function)


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

4.3 myweb.util

Source

package.lisp (file)

Use List
Exported Definitions
Internal Definitions

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

4.4 myweb

Source

package.lisp (file)

Use List
Exported Definitions
Internal Definitions

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

5 Definitions

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


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

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Special variables

Special Variable: *base-directory*
Package

myweb.config

Source

myweb.asd


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: file-response FILENAME TYPE REQUEST STREAM
Package

myweb.util

Source

util.lisp (file)

Function: get-header NAME REQUEST
Package

myweb.util

Source

util.lisp (file)

Function: get-param NAME REQUEST
Package

myweb.util

Source

util.lisp (file)

Function: html-template FILENAME TYPE PARAMS REQUEST STREAM
Package

myweb.util

Source

util.lisp (file)

Function: http-response CODE HEADERS STREAM
Package

myweb.util

Source

util.lisp (file)

Function: list-requests ()
Package

myweb

Source

web.lisp (file)

Function: list-workers ()
Package

myweb

Source

web.lisp (file)

Function: log-error MESSAGE
Package

myweb.util

Source

util.lisp (file)

Function: log-info MESSAGE
Package

myweb.util

Source

util.lisp (file)

Function: log-warning MESSAGE
Package

myweb.util

Source

util.lisp (file)

Function: parse-request STREAM
Package

myweb.util

Source

util.lisp (file)

Function: process-request REQUEST STREAM
Package

myweb.handler

Source

handler.lisp (file)

Function: response-write TEXT STREAM
Package

myweb.util

Source

util.lisp (file)

Function: start-http HOST PORT &key WORKER-LIMIT IDLE-WORKERS
Package

myweb

Source

web.lisp (file)

Function: stop-http ()
Package

myweb

Source

web.lisp (file)

Function: stop-thread ()
Package

myweb

Source

web.lisp (file)


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

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: *idle-workers*
Package

myweb

Source

web.lisp (file)

Special Variable: *idle-workers-num*
Package

myweb

Source

web.lisp (file)

Special Variable: *listen-socket*
Package

myweb

Source

web.lisp (file)

Special Variable: *listen-thread*
Package

myweb

Source

web.lisp (file)

Special Variable: *log-queue*
Package

myweb.util

Source

util.lisp (file)

Special Variable: *log-queue-cond*
Package

myweb.util

Source

util.lisp (file)

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

myweb.util

Source

util.lisp (file)

Special Variable: *log-queue-lock*
Package

myweb.util

Source

util.lisp (file)

Special Variable: *log-queue-time*
Package

myweb.util

Source

util.lisp (file)

Special Variable: *new-line*
Package

myweb.util

Source

util.lisp (file)

Special Variable: *request-mutex*
Package

myweb

Source

web.lisp (file)

Special Variable: *request-queue*
Package

myweb

Source

web.lisp (file)

Special Variable: *request-threads*
Package

myweb

Source

web.lisp (file)

Special Variable: *worker-mutex*
Package

myweb

Source

web.lisp (file)

Special Variable: *worker-num*
Package

myweb

Source

web.lisp (file)

Special Variable: *workers*
Package

myweb

Source

web.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: decode-kv S
Package

myweb.util

Source

util.lisp (file)

Function: decode-param S
Package

myweb.util

Source

util.lisp (file)

Function: decode-params S
Package

myweb.util

Source

util.lisp (file)

Function: http-404-not-found MESSAGE STREAM
Package

myweb.util

Source

util.lisp (file)

Function: http-acceptor HOST PORT WORKER-LIMIT IDLE-WORKERS
Package

myweb

Source

web.lisp (file)

Function: http-char C1 C2 &optional DEFAULT
Package

myweb.util

Source

util.lisp (file)

Function: http-worker REQUEST-ID SOCKET
Package

myweb

Source

web.lisp (file)

Function: log-worker ()
Package

myweb.util

Source

util.lisp (file)

Function: parse-get-header HEADER STREAM
Package

myweb.util

Source

util.lisp (file)

Function: parse-header HEADER
Package

myweb.util

Source

util.lisp (file)

Function: parse-headers STREAM
Package

myweb.util

Source

util.lisp (file)

Function: parse-params S
Package

myweb.util

Source

util.lisp (file)

Function: parse-path PATH
Package

myweb.util

Source

util.lisp (file)

Function: parse-post-header HEADER STREAM
Package

myweb.util

Source

util.lisp (file)

Function: process-index REQUEST STREAM
Package

myweb.handler

Source

handler.lisp (file)

Function: worker-thread REQUEST-ID SOCKET IDLE-WORKERS
Package

myweb

Source

web.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   L   M  
Index Entry  Section

F
File, Lisp, myweb.asd: The myweb<dot>asd file
File, Lisp, myweb/handler.lisp: The myweb/handler<dot>lisp file
File, Lisp, myweb/log.lisp: The myweb/log<dot>lisp file
File, Lisp, myweb/package.lisp: The myweb/package<dot>lisp file
File, Lisp, myweb/util.lisp: The myweb/util<dot>lisp file
File, Lisp, myweb/web.lisp: The myweb/web<dot>lisp file

L
Lisp File, myweb.asd: The myweb<dot>asd file
Lisp File, myweb/handler.lisp: The myweb/handler<dot>lisp file
Lisp File, myweb/log.lisp: The myweb/log<dot>lisp file
Lisp File, myweb/package.lisp: The myweb/package<dot>lisp file
Lisp File, myweb/util.lisp: The myweb/util<dot>lisp file
Lisp File, myweb/web.lisp: The myweb/web<dot>lisp file

M
myweb.asd: The myweb<dot>asd file
myweb/handler.lisp: The myweb/handler<dot>lisp file
myweb/log.lisp: The myweb/log<dot>lisp file
myweb/package.lisp: The myweb/package<dot>lisp file
myweb/util.lisp: The myweb/util<dot>lisp file
myweb/web.lisp: The myweb/web<dot>lisp file

Jump to:   F   L   M  

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: Internal functions
decode-param: Internal functions
decode-params: Internal functions

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

G
get-header: Exported functions
get-param: Exported functions

H
html-template: Exported functions
http-404-not-found: Internal functions
http-acceptor: Internal functions
http-char: Internal functions
http-response: Exported functions
http-worker: Internal functions

L
list-requests: Exported functions
list-workers: Exported functions
log-error: Exported functions
log-info: Exported functions
log-warning: Exported functions
log-worker: Internal functions

P
parse-get-header: Internal functions
parse-header: Internal functions
parse-headers: Internal functions
parse-params: Internal functions
parse-path: Internal functions
parse-post-header: Internal functions
parse-request: Exported functions
process-index: Internal functions
process-request: Exported functions

R
response-write: Exported functions

S
start-http: Exported functions
stop-http: Exported functions
stop-thread: Exported functions

W
worker-thread: Internal 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*: Exported special variables
*idle-workers*: Internal special variables
*idle-workers-num*: Internal special variables
*listen-socket*: Internal special variables
*listen-thread*: Internal special variables
*log-queue*: Internal special variables
*log-queue-cond*: Internal special variables
*log-queue-cond-lock*: Internal special variables
*log-queue-lock*: Internal special variables
*log-queue-time*: Internal special variables
*new-line*: Internal special variables
*request-mutex*: Internal special variables
*request-queue*: Internal special variables
*request-threads*: Internal special variables
*worker-mutex*: Internal special variables
*worker-num*: Internal special variables
*workers*: Internal special variables

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

Jump to:   *  
S  

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

A.4 Data types

Jump to:   M   P   S  
Index Entry  Section

M
myweb: The myweb system
myweb: The myweb package
myweb.config: The myweb<dot>config package
myweb.handler: The myweb<dot>handler package
myweb.util: The myweb<dot>util package

P
Package, myweb: The myweb package
Package, myweb.config: The myweb<dot>config package
Package, myweb.handler: The myweb<dot>handler package
Package, myweb.util: The myweb<dot>util package

S
System, myweb: The myweb system

Jump to:   M   P   S