1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825
|
.TH httpd 3 "inets 5.0.9" "Ericsson AB" "ERLANG MODULE DEFINITION"
.SH MODULE
httpd \- An implementation of an HTTP 1\&.1 compliant Web server, as defined in RFC 2616\&.
.SH DESCRIPTION
.LP
Documents the HTTP server start options, some administrative functions and also specifies the Erlang Web server callback API
.SH COMMON DATA TYPES
.LP
Type definitions that are used more than once in this module:
.LP
\fIboolean() = true | false \fR
.LP
\fIstring() = list of ASCII characters\fR
.LP
\fIpath() = string() - representing a file or directory path\&.\fR
.LP
\fI ip_address() = {N1, N2, N3, N4} % IPv4 | {K1, K2, K3, K4, K5, K6, K7, K8} % IPv6\fR
.LP
\fIhostname() = string() - representing a host ex "foo\&.bar\&.com"\fR
.LP
\fIproperty() = atom()\fR
.SH ERLANG HTTP SERVER SERVICE START/STOP
.LP
A web server can be configured to start when starting the inets application or started dynamically in runtime by calling the Inets application API \fIinets:start(httpd, ServiceConfig)\fR, or \fIinets:start(httpd, ServiceConfig, How)\fR, see inets(3) Below follows a description of the available configuration options, also called properties\&.
.LP
\fIFile properties\fR
.LP
When the web server is started at application start time the properties should be fetched from a configuration file that could consist of a regular erlang property list, e\&.i\&. \fI[{Option, Value}] \fR where \fI Option = property() \fR and \fIValue = term()\fR, followed by a full stop, or for backwards compatibility a Apache like configuration file\&. If the web server is started dynamically at runtime you may still specify a file but you could also just specify the compleat property list\&.
.RS 2
.TP 4
.B
{proplist_file, path()}:
If this property is defined inets will expect to find all other properties defined in this file\&. Note that the file must include all properties listed under mandatory properties\&.
.TP 4
.B
{file, path()}:
If this property is defined inets will expect to find all other properties defined in this file, that uses Apache like syntax\&. Note that the file must include all properties listed under mandantory properties\&. The Apache like syntax is the property, written as one word where each new word begins with a capital, followed by a withe-space followed by the value followed by a new line\&. Ex:
.RS 4
.nf
{server_root, "/urs/local/www"} -> ServerRoot /usr/local/www
.fi
.LP
.LP
With a few exceptions, that are documented for each property that behaves differently, and the special case {directory, {path(), PropertyList}} and {security_directory, {Dir, PropertyList}} that are represented as:
.LP
.nf
<Directory Dir>
<Properties handled as described above>
</Directory>
.fi
.RE
.RE
.SS Note:
.LP
The properties proplist_file and file are mutually exclusive\&.
.LP
\fIMandatory properties\fR
.RS 2
.TP 4
.B
{port, integer()}:
The port that the HTTP server shall listen on\&. If zero is specified as port, an arbitrary available port will be picked and you can use the httpd:info/2 function to find out which port was picked\&.
.TP 4
.B
{server_name, string()}:
The name of your server, normally a fully qualified domain name\&.
.TP 4
.B
{server_root, path()}:
Defines the servers home directory where log files etc can be stored\&. Relative paths specified in other properties refer to this directory\&.
.TP 4
.B
{document_root, path()}:
Defines the top directory for the documents that are available on the HTTP server\&.
.RE
.LP
\fICommunication properties\fR
.RS 2
.TP 4
.B
{bind_address, ip_address() | hostname() | any}:
Defaults to any\&. Note any is denoted * in the apache like configuration file\&.
.TP 4
.B
{socket_type, ip_comm | ssl}:
Defaults to \fIip_comm\fR
.RE
.LP
\fIErlang Web server API moudles\fR
.RS 2
.TP 4
.B
{modules, [atom()]}:
Defines which modules the HTTP server will use to handle requests\&. Defaults to: \fI[mod_alias, mod_auth, mod_esi, mod_actions, mod_cgi, mod_dir, mod_get, mod_head, mod_log, mod_disk_log] \fR Note that some mod-modules are dependent on others see the Inets Web server Modules in the Users guide\&. So the order can not be entirely arbitrary\&.
.RE
.LP
\fILimit properties\fR
.RS 2
.TP 4
.B
{disable_chunked_transfer_encoding_send, boolean()}:
This property allows you to disable chunked transfer-encoding when sending a response to a HTTP/1\&.1 client, by default this is false\&.
.TP 4
.B
{keep_alive, boolean()}:
Instructs the server whether or not to use persistent connections when the client claims to be HTTP/1\&.1 compliant, default is true\&.
.TP 4
.B
{keep_alive_timeoute, integer()}:
The number of seconds the server will wait for a subsequent request from the client before closing the connection\&. Default is 150\&.
.TP 4
.B
{max_body_size, integer()}:
Limits the size of the message body of HTTP request\&. By the default there is no limit\&.
.TP 4
.B
{max_clients, integer()}:
Limits the number of simultaneous requests that can be supported\&. Defaults to 150\&.
.TP 4
.B
{max_header_size, integer()}:
Limits the size of the message header of HTTP request\&. Defaults to 10240\&.
.TP 4
.B
{max_uri, integer()}:
Limits the size of the HTTP request URI\&. By default there is no limit\&.
.TP 4
.B
{max_keep_alive_requests, integer()}:
The number of request that a client can do on one connection\&. When the server has responded to the number of requests defined by max_keep_alive_requests the server close the connection\&. The server will close it even if there are queued request\&. Defaults to no limit\&.
.RE
.LP
\fIAdministrative properties\fR
.RS 2
.TP 4
.B
{mime_types, [{MimeType, Extension}] | path()}:
Where MimeType = string() and Extension = string()\&. Files delivered to the client are MIME typed according to RFC 1590\&. File suffixes are mapped to MIME types before file delivery\&. The mapping between file suffixes and MIME types can be specified as an apache like file as well as directly in the property list\&. Such a file may look like:
.RS 4
.LP
.nf
# MIME type Extension
text/html html htm
text/plain asc txt
.fi
.LP
.LP
Defaults to [{"html","text/html"},{"htm","text/html"}]
.RE
.TP 4
.B
{mime_type, string()}:
When the server is asked to provide a document type which cannot be determined by the MIME Type Settings, the server will use this default type\&.
.TP 4
.B
{server_admin, string()}:
ServerAdmin defines the email-address of the server administrator, to be included in any error messages returned by the server\&.
.TP 4
.B
{log_format, common | combined}:
Defines if access logs should be written according to the common log format or to the extended common log format\&. The \fIcommon\fR format is one line that looks like this: \fIremotehost rfc931 authuser [date] "request" status bytes\fR
.RS 4
.LP
.nf
remotehost
Remote
rfc931
The client\&'s remote username (RFC 931)\&.
authuser
The username with which the user authenticated himself\&.
[date]
Date and time of the request (RFC 1123)\&.
"request"
The request line exactly as it came from the client(RFC 1945)\&.
status
The HTTP status code returned to the client (RFC 1945)\&.
bytes
The content-length of the document transferred\&.
.fi
.LP
.LP
The \fIcombined\fR format is on line that look like this: \fIremotehost rfc931 authuser [date] "request" status bytes "referer" "user_agent" \fR
.LP
.nf
"referer"
The url the client was on before
requesting your url\&. (If it could not be determined a minus
sign will be placed in this field)
"user_agent"
The software the client claims to be using\&. (If it
could not be determined a minus sign will be placed in
this field)
.fi
.LP
.LP
This affects the access logs written by mod_log and mod_disk_log\&.
.RE
.TP 4
.B
{error_log_format, pretty | compact}:
Defaults to pretty\&. If the error log is meant to be read directly by a human \fIpretty\fR will be the best option\&. \fIpretty\fR has the format corresponding to:
.RS 4
.LP
.nf
io:format("[~s] ~s, reason: ~n ~p ~n~n", [Date, Msg, Reason])\&.
.fi
.LP
.LP
\fIcompact\fR has the format corresponding to:
.LP
.nf
io:format("[~s] ~s, reason: ~w ~n", [Date, Msg, Reason])\&.
.fi
.LP
.LP
This affects the error logs written by mod_log and mod_disk_log\&.
.RE
.RE
.LP
\fIssl properties\fR
.RS 2
.TP 4
.B
{ssl_ca_certificate_file, path()}:
Used as cacertfile option in ssl:listen/2 see ssl(3)
.TP 4
.B
{ssl_certificate_file, path()}:
Used as certfile option in ssl:listen/2 see ssl(3)
.TP 4
.B
{ssl_ciphers, list()}:
Used as ciphers option in ssl:listen/2 see ssl(3)
.TP 4
.B
{ssl_verify_client, integer()}:
Used as verify option in ssl:listen/2 see ssl(3)
.TP 4
.B
{ssl_verify_depth, integer()}:
Used as depth option in ssl:listen/2 see ssl(3)
.TP 4
.B
{ssl_password_callback_function, atom()}:
Used together with ssl_password_callback_module to retrieve a value to use as password option to ssl:listen/2 see ssl(3)
.TP 4
.B
{ssl_password_callback_module, atom()}:
Used together with ssl_password_callback_function to retrieve a value to use as password option to ssl:listen/2 see ssl(3)
.RE
.LP
\fIURL aliasing properties - requires mod_alias\fR
.RS 2
.TP 4
.B
{alias, {Alias, RealName}}:
Where Alias = string() and RealName = string()\&. The Alias property allows documents to be stored in the local file system instead of the document_root location\&. URLs with a path that begins with url-path is mapped to local files that begins with directory-filename, for example:
.RS 4
.nf
{alias, {"/image", "/ftp/pub/image"}
.fi
.LP
and an access to http://your\&.server\&.org/image/foo\&.gif would refer to the file /ftp/pub/image/foo\&.gif\&.
.RE
.TP 4
.B
{directory_index, [string()]}:
DirectoryIndex specifies a list of resources to look for if a client requests a directory using a / at the end of the directory name\&. file depicts the name of a file in the directory\&. Several files may be given, in which case the server will return the first it finds, for example:
.RS 4
.nf
{directory_index, ["index\&.hml", "welcome\&.html"]}
.fi
.LP
and access to http://your\&.server\&.org/docs/ would return http://your\&.server\&.org/docs/index\&.html or http://your\&.server\&.org/docs/welcome\&.html if index\&.html do not exist\&.
.RE
.RE
.LP
\fICGI properties - requires mod_cgi\fR
.RS 2
.TP 4
.B
{script_alias, {Alias, RealName}}:
Where Alias = string() and RealName = string()\&. Has the same behavior as the Alias property, except that it also marks the target directory as containing CGI scripts\&. URLs with a path beginning with url-path are mapped to scripts beginning with directory-filename, for example:
.RS 4
.nf
{script_alias, {"/cgi-bin/", "/web/cgi-bin/"}
.fi
.LP
and an access to http://your\&.server\&.org/cgi-bin/foo would cause the server to run the script /web/cgi-bin/foo\&.
.RE
.TP 4
.B
{script_nocache, boolean()}:
If ScriptNoCache is set to true the HTTP server will by default add the header fields necessary to prevent proxies from caching the page\&. Generally this is something you want\&. Defaults to false\&.
.TP 4
.B
{script_timeout, integer()}:
The time in seconds the web server will wait between each chunk of data from the script\&. If the CGI-script not delivers any data before the timeout the connection to the client will be closed\&. Defaults to 15\&.
.TP 4
.B
{action, {MimeType, CgiScript}} - requires mod_action:
Where MimeType = string() and CgiScript = string()\&. Action adds an action, which will activate a cgi-script whenever a file of a certain mime-type is requested\&. It propagates the URL and file path of the requested document using the standard CGI PATH_INFO and PATH_TRANSLATED environment variables\&.
.RS 4
.nf
{action, {"text/plain", "/cgi-bin/log_and_deliver_text"}
.fi
.RE
.TP 4
.B
{script, {Method, CgiScript}} - requires mod_action:
Where Method = string() and CgiScript = string()\&. Script adds an action, which will activate a cgi-script whenever a file is requested using a certain HTTP method\&. The method is either GET or POST as defined in RFC 1945\&. It propagates the URL and file path of the requested document using the standard CGI PATH_INFO and PATH_TRANSLATED environment variables\&.
.RS 4
.nf
{script, {"PUT", "/cgi-bin/put"}
.fi
.RE
.RE
.LP
\fIESI properties - requires mod_esi\fR
.RS 2
.TP 4
.B
{erl_script_alias, {URLPath, [AllowedModule]}}:
Where URLPath = string() and AllowedModule = atom()\&. erl_script_alias marks all URLs matching url-path as erl scheme scripts\&. A matching URL is mapped into a specific module and function\&. For example:
.RS 4
.nf
{erl_script_alias, {"/cgi-bin/example" [httpd_example]}
.fi
.LP
and a request to http://your\&.server\&.org/cgi-bin/example/httpd_example:yahoo would refer to httpd_example:yahoo/2 and http://your\&.server\&.org/cgi-bin/example/other:yahoo would not be allowed to execute\&.
.RE
.TP 4
.B
{erl_script_nocache, boolean()}:
If erl_script_nocache is set to true the server will add http header fields that prevents proxies from caching the page\&. This is generally a good idea for dynamic content, since the content often vary between each request\&. Defaults to false\&.
.TP 4
.B
{erl_script_timeout, integer()}:
If erl_script_timeout sets the time in seconds the server will wait between each chunk of data to be delivered through mod_esi:deliver/2\&. Defaults to 15\&. This is only relevant for scripts that uses the erl scheme\&.
.TP 4
.B
{eval_script_alias, {URLPath, [AllowedModule]}}:
Where URLPath = string() and AllowedModule = atom()\&. Same as erl_script_alias but for scripts using the eval scheme\&. Note that this is only supported for backwards compatibility\&. The eval scheme is deprecated\&.
.RE
.LP
\fILog properties - requires mod_log\fR
.RS 2
.TP 4
.B
{error_log, path()}:
Defines the filename of the error log file to be used to log server errors\&. If the filename does not begin with a slash (/) it is assumed to be relative to the server_root
.TP 4
.B
{security_log, path()}:
Defines the filename of the access log file to be used to log security events\&. If the filename does not begin with a slash (/) it is assumed to be relative to the server_root\&.
.TP 4
.B
{transfer_log, path()}:
Defines the filename of the access log file to be used to log incoming requests\&. If the filename does not begin with a slash (/) it is assumed to be relative to the server_root\&.
.RE
.LP
\fIDisk Log properties - requires mod_disk_log\fR
.RS 2
.TP 4
.B
{disk_log_format, internal | external}:
Defines the file-format of the log files see disk_log for more information\&. If the internal file-format is used, the logfile will be repaired after a crash\&. When a log file is repaired data might get lost\&. When the external file-format is used httpd will not start if the log file is broken\&. Defaults to external\&.
.TP 4
.B
{error_disk_log, internal | external}:
Defines the filename of the (disk_log(3)) error log file to be used to log server errors\&. If the filename does not begin with a slash (/) it is assumed to be relative to the server_root\&.
.TP 4
.B
{error_disk_log_size, {MaxBytes, MaxFiles}}:
Where MaxBytes = integer() and MaxFiles = integer() Defines the properties of the (disk_log(3)) error log file\&. The disk_log(3) error log file is of type wrap log and max-bytes will be written to each file and max-files will be used before the first file is truncated and reused\&.
.TP 4
.B
{security_disk_log, path()}:
Defines the filename of the (disk_log(3)) access log file which logs incoming security events i\&.e authenticated requests\&. If the filename does not begin with a slash (/) it is assumed to be relative to the server_root\&.
.TP 4
.B
{security_disk_log_size, {MaxBytes, MaxFiles}}:
Where MaxBytes = integer() and MaxFiles = integer()\&. Defines the properties of the disk_log(3) access log file\&. The disk_log(3) access log file is of type wrap log and max-bytes will be written to each file and max-files will be used before the first file is truncated and reused\&.
.TP 4
.B
{transfer_disk_log, path()}:
Defines the filename of the (disk_log(3)) access log file which logs incoming requests\&. If the filename does not begin with a slash (/) it is assumed to be relative to the server_root\&.
.TP 4
.B
{transfer_disk_log_size, {MaxBytes, MaxFiles}}:
Where MaxBytes = integer() and MaxFiles = integer()\&. Defines the properties of the disk_log(3) access log file\&. The disk_log(3) access log file is of type wrap log and max-bytes will be written to each file and max-files will be used before the first file is truncated and reused\&.
.RE
.LP
\fIAuthentication properties - requires mod_auth\fR
.LP
\fI{directory, {path(), [{property(), term()}]}}\fR
.LP
Here follows the valid properties for directorys
.RS 2
.TP 4
.B
{allow_from, all | [RegxpHostString]}:
Defines a set of hosts which should be granted access to a given directory\&. For example:
.RS 4
.nf
{allow_from, ["123\&.34\&.56\&.11", "150\&.100\&.23"]
.fi
.LP
The host 123\&.34\&.56\&.11 and all machines on the 150\&.100\&.23 subnet are allowed access\&.
.RE
.TP 4
.B
{deny_from, all | [RegxpHostString]}:
Defines a set of hosts which should be denyed access to a given directory\&. For example:
.RS 4
.nf
{deny_from, ["123\&.34\&.56\&.11", "150\&.100\&.23"]
.fi
.LP
The host 123\&.34\&.56\&.11 and all machines on the 150\&.100\&.23 subnet are not allowed access\&.
.RE
.TP 4
.B
{auth_type, plain | dets | mnesia}:
Sets the type of authentication database that is used for the directory\&.The key difference between the different methods is that dynamic data can be saved when Mnesia and Dets is used\&. This property is called AuthDbType in the apache like configuration files\&.
.TP 4
.B
{auth_user_file, path()}:
Sets the name of a file which contains the list of users and passwords for user authentication\&. filename can be either absolute or relative to the \fIserver_root\fR\&. If using the plain storage method, this file is a plain text file, where each line contains a user name followed by a colon, followed by the non-encrypted password\&. If user names are duplicated, the behavior is undefined\&. For example:
.RS 4
.nf
ragnar:s7Xxv7
edward:wwjau8
.fi
.LP
If using the dets storage method, the user database is maintained by dets and should not be edited by hand\&. Use the API functions in mod_auth module to create / edit the user database\&. This directive is ignored if using the mnesia storage method\&. For security reasons, make sure that the \fIauth_user_file\fR is stored outside the document tree of the Web server\&. If it is placed in the directory which it protects, clients will be able to download it\&.
.RE
.TP 4
.B
{auth_group_file, path()}:
Sets the name of a file which contains the list of user groups for user authentication\&. Filename can be either absolute or relative to the \fIserver_root\fR\&. If you use the plain storage method, the group file is a plain text file, where each line contains a group name followed by a colon, followed by the member user names separated by spaces\&. For example:
.RS 4
.nf
group1: bob joe ante
.fi
.LP
If using the dets storage method, the group database is maintained by dets and should not be edited by hand\&. Use the API for mod_auth module to create / edit the group database\&. This directive is ignored if using the mnesia storage method\&. For security reasons, make sure that the \fIauth_group_file\fR is stored outside the document tree of the Web server\&. If it is placed in the directory which it protects, clients will be able to download it\&.
.RE
.TP 4
.B
{auth_name, string()}:
Sets the name of the authorization realm (auth-domain) for a directory\&. This string informs the client about which user name and password to use\&.
.TP 4
.B
{auth_access_password, string()}:
If set to other than "NoPassword" the password is required for all API calls\&. If the password is set to "DummyPassword" the password must be changed before any other API calls\&. To secure the authenticating data the password must be changed after the web server is started since it otherwise is written in clear text in the configuration file\&.
.TP 4
.B
{require_user, [string()]}:
Defines users which should be granted access to a given directory using a secret password\&.
.TP 4
.B
{require_group, [string()]}:
Defines users which should be granted access to a given directory using a secret password\&.
.RE
.LP
\fIHtacess authenication properties - requires mod_htacess\fR
.RS 2
.TP 4
.B
{access_files, [path()]}:
Specify which filenames that are used for access-files\&. When a request comes every directory in the path to the requested asset will be searched after files with the names specified by this parameter\&. If such a file is found the file will be parsed and the restrictions specified in it will be applied to the request\&.
.RE
.LP
\fIAuthentication properties - requires mod_security \fR
.LP
\fI{security_directory, {path(), [{property(), term()}]}\fR
.LP
Here follows the valid properties for security directorys
.RS 2
.TP 4
.B
{security_data_file, path()}:
Name of the security data file\&. The filename can either absolute or relative to the server_root\&. This file is used to store persistent data for the mod_security module\&.
.TP 4
.B
{security_max_retries, integer()}:
Specifies the maximum number of tries to authenticate, a user has before the user is blocked out\&. If a user successfully authenticates when the user has been blocked, the user will receive a 403 (Forbidden) response from the server\&. If the user makes a failed attempt while blocked the server will return 401 (Unauthorized), for security reasons\&. Defaults to 3 may also be set to infinity\&.
.TP 4
.B
{security_block_time, integer()}:
Specifies the number of minutes a user is blocked\&. After this amount of time, he automatically regains access\&. Defaults to 60
.TP 4
.B
{security_fail_expire_time, integer()}:
Specifies the number of minutes a failed user authentication is remembered\&. If a user authenticates after this amount of time, his previous failed authentications are forgotten\&. Defaults to 30
.TP 4
.B
{security_auth_timeout, integer()}:
Specifies the number of seconds a successful user authentication is remembered\&. After this time has passed, the authentication will no longer be reported\&. Defaults to 30\&.
.RE
.SH EXPORTS
.LP
.B
info(Pid) ->
.br
.B
info(Pid, Properties) -> [{Option, Value}]
.br
.RS
.TP
Types
Properties = [property()]
.br
Option = property()
.br
Value = term()
.br
.RE
.RS
.LP
Fetches information about the HTTP server\&. When called with only the pid all properties are fetched, when called with a list of specific properties they are fetched\&. Available properties are the same as the servers start options\&.
.SS Note:
.LP
Pid is the pid returned from inets:start/[2,3]\&. Can also be retrieved form inets:services/0, inets:services/0 see inets(3)
.RE
.LP
.B
info(Address, Port) ->
.br
.B
info(Address, Port, Properties) -> [{Option, Value}]
.br
.RS
.TP
Types
Address = ip_address()
.br
Port = integer()
.br
Properties = [property()]
.br
Option = property()
.br
Value = term()
.br
.RE
.RS
.LP
Fetches information about the HTTP server\&. When called with only the Address and Port all properties are fetched, when called with a list of specific properties they are fetched\&. Available properties are the same as the servers start options\&.
.SS Note:
.LP
Address has to be the ip-address and can not be the hostname\&.
.RE
.LP
.B
reload_config(Config, Mode) -> ok | {error, Reason}
.br
.RS
.TP
Types
Config = path() | [{Option, Value}]
.br
Option = property()
.br
Value = term()
.br
Mode = non_disturbing | disturbing
.br
.RE
.RS
.LP
Reloads the HTTP server configuration without restarting the server\&. Incoming requests will be answered with a temporary down message during the time the it takes to reload\&.
.SS Note:
.LP
Available properties are the same as the servers start options, although the properties bind_address and port can not be changed\&.
.LP
If mode is disturbing, the server is blocked forcefully and all ongoing requests are terminated and the reload will start immediately\&. If mode is non-disturbing, no new connections are accepted, but the ongoing requests are allowed to complete before the reload is done\&.
.RE
.SH ERLANG WEB SERVER API DATA TYPES
.nf
ModData = #mod{}
-record(mod, {
data = [],
socket_type = ip_comm,
socket,
config_db,
method,
absolute_uri,
request_uri,
http_version,
request_line,
parsed_header = [],
entity_body,
connection
})\&.
.fi
.LP
The fields of the \fImod\fR record has the following meaning:
.RS 2
.TP 4
.B
\fIdata\fR:
Type \fI[{InteractionKey, InteractionValue}]\fR is used to propagate data between modules\&. Depicted \fIinteraction_data()\fR in function type declarations\&.
.TP 4
.B
\fIsocket_type\fR:
\fIsocket_type()\fR, Indicates whether it is a ip socket or a ssl socket\&.
.TP 4
.B
\fIsocket\fR:
The actual socket in \fIip_comm\fR or \fIssl\fR format depending on the \fIsocket_type\fR\&.
.TP 4
.B
\fIconfig_db\fR:
The config file directives stored as key-value tuples in an ETS-table\&. Depicted \fIconfig_db()\fR in function type declarations\&.
.TP 4
.B
\fImethod\fR:
Type \fI"GET" | "POST" | "HEAD" | "TRACE"\fR, that is the HTTP metod\&.
.TP 4
.B
\fIabsolute_uri\fR:
If the request is a HTTP/1\&.1 request the URI might be in the absolute URI format\&. In that case httpd will save the absolute URI in this field\&. An Example of an absolute URI could be\fI"http://ServerName:Part/cgi-bin/find\&.pl?person=jocke"\fR
.TP 4
.B
\fIrequest_uri\fR:
The \fIRequest-URI\fR as defined in RFC 1945, for example \fI"/cgi-bin/find\&.pl?person=jocke"\fR
.TP 4
.B
\fIhttp_version\fR:
The \fIHTTP\fR version of the request, that is "HTTP/0\&.9", "HTTP/1\&.0", or "HTTP/1\&.1"\&.
.TP 4
.B
\fIrequest_line\fR:
The \fIRequest-Line\fR as defined in RFC 1945, for example \fI"GET /cgi-bin/find\&.pl?person=jocke HTTP/1\&.0"\fR\&.
.TP 4
.B
\fIparsed_header\fR:
Type \fI[{HeaderKey, HeaderValue}]\fR, \fIparsed_header\fR contains all HTTP header fields from the HTTP-request stored in a list as key-value tuples\&. See RFC 2616 for a listing of all header fields\&. For example the date field would be stored as: \fI{"date", "Wed, 15 Oct 1997 14:35:17 GMT"}\&. RFC 2616 defines that HTTP is a case insensitive protocol and the header fields may be in lowercase or upper case\&. Httpd will ensure that all header field names are in lowe case\fR\&.
.TP 4
.B
\fIentity_body\fR:
The \fIEntity-Body\fR as defined in RFC 2616, for example data sent from a CGI-script using the POST method\&.
.TP 4
.B
\fIconnection\fR:
\fItrue | false\fR If set to true the connection to the client is a persistent connections and will not be closed when the request is served\&.
.RE
.SH ERLANG WEB SERVER API CALLBACK FUNCTIONS
.SH EXPORTS
.LP
.B
Module:do(ModData)-> {proceed, OldData} | {proceed, NewData} | {break, NewData} | done
.br
.RS
.TP
Types
OldData = list()
.br
NewData = [{response, {StatusCode, Body}}] | [{response, {response, Head, NewBody}}] | [{response, {already_sent, Statuscode, Size}]
.br
StausCode = integer()
.br
Body = io_list() | nobody | {Fun, Arg}
.br
Head = [HeaderOption]
.br
HeaderOption = {Option, Value} | {code, StatusCode}
.br
Option = allow | cache_control | content_MD5 | content_encoding | content_encoding | content_language | content_length | content_location | content_range | content_type | date | etag | expires | last_modified | location | pragma | retry_after | server | trailer | transfer_encoding
.br
Value = string()
.br
Fun = fun( Arg ) -> sent| close | Body
.br
Arg = [term()]
.br
.RE
.RS
.LP
When a valid request reaches httpd it calls \fIdo/1\fR in each module defined by the Modules configuration option\&. The function may generate data for other modules or a response that can be sent back to the client\&.
.LP
The field \fIdata\fR in ModData is a list\&. This list will be the list returned from the from the last call to \fIdo/1\fR\&.
.LP
\fIBody\fR is the body of the http-response that will be sent back to the client an appropriate header will be appended to the message\&. \fIStatusCode\fR will be the status code of the response see RFC2616 for the appropriate values\&.
.LP
\fIHead\fR is a key value list of HTTP header fields\&. the server will construct a HTTP header from this data\&. See RFC 2616 for the appropriate value for each header field\&. If the client is a HTTP/1\&.0 client then the server will filter the list so that only HTTP/1\&.0 header fields will be sent back to the client\&.
.LP
If \fINewBody\fR is returned and equal to \fI{Fun, Arg}\fR The Web server will try \fIapply/2\fR\&. on \fIFun\fR with \fIArg\fR as argument and excpect that the fun either returns a list \fI(Body)\fR that is a HTTP-repsonse or the atom sent if the HTTP-response is sent back to the client\&. If close is returned from the fun something has gone wrong and the server will signal this to the client by closing the connection\&.
.RE
.LP
.B
Module:load(Line, AccIn)-> eof | ok | {ok, AccOut} | {ok, AccOut, {Option, Value}} | {ok, AccOut, [{Option, Value}]} | {error, Reason}
.br
.RS
.TP
Types
Line = string()
.br
AccIn = [{Option, Value}]
.br
AccOut = [{Option, Value}]
.br
Option = property()
.br
Value = term()
.br
Reason = term()
.br
.RE
.RS
.LP
Load is used to convert a line in a Apache like configuration file to a \fI{Option, Value}\fR tuple\&. Some more complex configuration options such as \fIdirectory\fR and \fIsecurity_directory\fR will create an accumulator\&.This function does only need clauses for the options implemented by this particular callback module\&.
.RE
.LP
.B
Module:store({Option, Value}, Config)-> {ok, {Option, NewValue}} | {error, Reason}
.br
.RS
.TP
Types
Line = string()
.br
Option = property()
.br
Config = [{Option, Value}]
.br
Value = term()
.br
Reason = term()
.br
.RE
.RS
.LP
This function is used to check the validity of the configuration options before saving them in the internal database\&. This function may also have a side effect e\&.i\&. setup necessary extra resources implied by the configuration option\&. It can also resolve possible dependencies among configuration options by changing the value of the option\&. This function does only need clauses for the options implemented by this particular callback module \&.
.RE
.LP
.B
Module:remove(ConfigDB) -> ok | {error, Reason}
.br
.RS
.TP
Types
ConfigDB = ets_table()
.br
Reason = term()
.br
.RE
.RS
.LP
When httpd is shutdown it will try to execute \fIremove/1\fR in each Erlang web server callback module\&. The programmer may use this to function to clean up resources that may have been crated in the store function\&.
.RE
.SH ERLANG WEB SERVER API HELP FUNCTIONS
.SH EXPORTS
.LP
.B
parse_query(QueryString) -> [{Key,Value}]
.br
.RS
.TP
Types
QueryString = string()
.br
Key = string()
.br
Value = string()
.br
.RE
.RS
.LP
\fIparse_query/1\fR parses incoming data to \fIerl\fR and \fIeval\fR scripts (See mod_esi(3)) as defined in the standard URL format, that is \&'+\&' becomes \&'space\&' and decoding of hexadecimal characters (\fI%xx\fR)\&.
.RE
.SH SEE ALSO
.LP
RFC 2616, inets(3), ssl(3)
|