Skip to content

Commit 88af2df

Browse files
kamahenJanWielemaker
authored andcommitted
Add documentation pointing to http_server for most use cases.
1 parent 5b9b6ba commit 88af2df

9 files changed

+42
-3
lines changed

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ both HTTP and HTTPS connections and handle all request methods.
1010

1111
## Server library
1212

13-
The main server libarys are
13+
The main server libraris are
1414

1515
- `library(http/thread_httpd)` implements the server
1616
- `library(http/http_dispatch)` implements binding locations
@@ -21,6 +21,12 @@ The main server libarys are
2121
- `library(http/html_write)` implements generating HTML
2222
- `library(http/http_json)` implements reading and writing JSON documents.
2323

24+
For simplicity, you can use `library(http/http_server)`, which
25+
combines the typical HTTP libraries that most servers need. The
26+
idea of a common request handling system and three controlling
27+
libraries is outdated; the threaded server now being the only sensible
28+
controlling library.
29+
2430
# Requirements
2531

2632
This library uses functionality from the `ssl` package to support HTTPS,

html_write.pl

+4
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@
101101

102102
/** <module> Write HTML text
103103
104+
Most code doesn't need to use this directly; instead use
105+
library(http/http_server), which combines this library with the
106+
typical HTTP libraries that most servers need.
107+
104108
The purpose of this library is to simplify writing HTML pages. Of
105109
course, it is possible to use format/3 to write to the HTML stream
106110
directly, but this is generally not very satisfactory:

http_dispatch.pl

+4
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@
7676

7777
/** <module> Dispatch requests in the HTTP server
7878
79+
Most code doesn't need to use this directly; instead use
80+
library(http/http_server), which combines this library with the
81+
typical HTTP libraries that most servers need.
82+
7983
This module can be placed between http_wrapper.pl and the application
8084
code to associate HTTP _locations_ to predicates that serve the pages.
8185
In addition, it associates parameters with locations that deal with

http_dyn_workers.pl

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050

5151
/** <module> Dynamically schedule HTTP workers.
5252
53+
Most code doesn't need to use this directly; instead use
54+
library(http/http_server), which combines this library with the
55+
typical HTTP libraries that most servers need.
56+
5357
This module defines hooks into the HTTP framework to dynamically
5458
schedule worker threads. Dynamic scheduling relieves us from finding a
5559
good value for the size of the HTTP worker pool.

http_json.pl

+4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@
8080

8181
/** <module> HTTP JSON Plugin module
8282
83+
Most code doesn't need to use this directly; instead use
84+
library(http/http_server), which combines this library with the
85+
typical HTTP libraries that most servers need.
86+
8387
This module adds hooks to several parts of the HTTP libraries, making
8488
them JSON-aware. Notably:
8589

http_parameters.pl

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959

6060
/** <module> Extract parameters (GET and POST) from HTTP requests
6161
62+
Most code doesn't need to use this directly; instead use
63+
library(http/http_server), which combines this library with the
64+
typical HTTP libraries that most servers need.
65+
6266
This module is used to extract the value of GET or POST parameters from
6367
an HTTP request. The typical usage is e.g.,
6468

http_server.pl

+7-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,13 @@
8787

8888
/** <module> HTTP server library
8989
90-
This library combines the core server functionality provided by several
91-
libraries that are needed by almost any web server.
90+
This library combines the core server functionality provided by
91+
several libraries that are needed by almost any web server. It exports
92+
the commonly used predicates from library(http/thread_httpd),
93+
library(http/http_dispatch), library(http/http_wrapper),
94+
library(http/http_parameters), library(http/html_write),
95+
library(http/http_json), and library(http/http_dyn_workers).
96+
9297
*/
9398

9499
%! http_server(+Options) is det.

http_wrapper.pl

+4
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757

5858
/** <module> Server processing of an HTTP request
5959
60+
Most code doesn't need to use this directly; instead use
61+
library(http/http_server), which combines this library with the
62+
typical HTTP libraries that most servers need.
63+
6064
This library provides the core of the implementation of the HTTP
6165
protocol at the server side and is mainly intended for *internal use*.
6266
It is used by library(thread_httpd) and library(inet_httpd)

thread_httpd.pl

+4
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@
8383

8484
/** <module> Threaded HTTP server
8585
86+
Most code doesn't need to use this directly; instead use
87+
library(http/http_server), which combines this library with the
88+
typical HTTP libraries that most servers need.
89+
8690
This library defines the HTTP server frontend of choice for SWI-Prolog.
8791
It is based on the multi-threading capabilities of SWI-Prolog and thus
8892
exploits multiple cores to serve requests concurrently. The server

0 commit comments

Comments
 (0)