inets

Reference Manual

Version 6.5

- User's Guide
- Reference Manual
- Release Notes
- PDF
- Top

- Expand All
- Contract All

### Table of Contents

- inets
  - Top of manual page
  - service_names/0
  - services/0
  - services_info/0
  - start/0
  - start/1
  - start/2
  - start/3
  - stop/0
  - stop/2
- ftp
  - Top of manual page
  - account/2
  - append/2
  - append/3
  - append_bin/3
  - append_chunk/2
  - append_chunk_end/1
  - append_chunk_start/2
  - cd/2
  - close/1
  - delete/2
  - formaterror/1
  - lcd/2
  - lpwd/1
  - ls/1
  - ls/2
  - mkdir/2
  - nlist/1
  - nlist/2
  - open/1
  - open/2
  - pwd/1
  - quote/2
  - recv/2
  - recv/3
  - recv_bin/2
  - recv_chunk/1
  - recv_chunk_start/2
  - rename/3
  - rmdir/2
  - send/2
  - send/3
  - send_bin/3
  - send_chunk/2
  - send_chunk_end/1
  - send_chunk_start/2
  - type/2
  - user/3
  - user/4
- tftp
  - Top of manual page
  - change_config/2
  - change_config/2
  - change_config/2
  - info/1
  - info/1
  - info/1
  - read_file/3
  - start/1
  - write_file/3
  - Logger:error_msg/2
  - Logger:info_msg/2
  - Logger:warning_msg/2
  - Module:abort/3
  - Module:open/6
  - Module:prepare/6
  - Module:read/1
  - Module:write/2
- httpc
  - Top of manual page
  - cancel_request/1
  - cancel_request/2
  - cookie_header/1
  - cookie_header/2
  - cookie_header/3
  - get_options/1
  - get_options/2
  - info/0
  - info/1
  - request/1
  - request/2
  - request/4
  - request/5
  - reset_cookies/0
  - reset_cookies/1
  - set_options/1
  - set_options/2
  - store_cookies/2
  - store_cookies/3
  - stream_next/1
  - which_cookies/0
  - which_cookies/1
  - which_sessions/0
  - which_sessions/1
- httpd
  - Top of manual page
  - info/1
  - info/2
  - info/2
  - info/3
  - info/4
  - info/3
  - parse_query/1
  - reload_config/2
  - Module:do/1
  - Module:load/2
  - Module:remove/1
  - Module:store/2
- httpd_custom_api
  - Top of manual page
  - request_header/1
  - response_default_headers/0
  - response_header/1
- httpd_socket
  - Top of manual page
  - deliver/3
  - peername/2
  - resolve/0
- httpd_util
  - Top of manual page
  - convert_request_date/1
  - create_etag/1
  - day/1
  - decode_hex/1
  - flatlength/1
  - hexlist_to_integer/1
  - integer_to_hexlist/1
  - lookup/2
  - lookup/3
  - lookup_mime/2
  - lookup_mime/3
  - lookup_mime_default/2
  - lookup_mime_default/3
  - message/3
  - month/1
  - multi_lookup/2
  - reason_phrase/1
  - rfc1123_date/0
  - rfc1123_date/2
  - split/3
  - split_path/1
  - split_script_path/1
  - strip/1
  - suffix/1
- mod_alias
  - Top of manual page
  - default_index/2
  - path/3
  - real_name/3
  - real_script_name/3
- mod_auth
  - Top of manual page
  - add_group_member/3
  - add_group_member/4
  - add_group_member/5
  - add_user/2
  - add_user/5
  - add_user/6
  - delete_group/2
  - delete_group/4
  - delete_group_member/3
  - delete_group_member/4
  - delete_group_member/5
  - delete_user/2
  - delete_user/3
  - delete_user/4
  - get_user/2
  - get_user/3
  - get_user/4
  - list_group_members/2
  - list_group_members/3
  - list_group_members/4
  - list_groups/1
  - list_groups/2
  - list_groups/3
  - list_users/1
  - list_users/2
  - list_users/3
  - update_password/5
  - update_password/6
- mod_esi
  - Top of manual page
  - deliver/2
  - Module:Function/3
  - Module:Function/2
- mod_security
  - Top of manual page
  - block_user/4
  - block_user/5
  - list_auth_users/1
  - list_auth_users/2
  - list_auth_users/2
  - list_auth_users/3
  - list_blocked_users/1
  - list_blocked_users/2
  - list_blocked_users/2
  - list_blocked_users/3
  - unblock_user/2
  - unblock_user/3
  - unblock_user/3
  - unblock_user/4
  - Module:event/4
  - Module:event/5
- http_uri
  - Top of manual page
  - decode/1
  - encode/1
  - parse/1
  - parse/2
  - scheme_defaults/0

# httpd_util

### Module

httpd_util

### Module Summary

Miscellaneous utility functions to be used when implementing Erlang web server API modules.

### Description

This module provides the Erlang web server API module programmer with miscellaneous utility functions.

### Exports

convert_request_date(DateString) -> ErlDate|bad_date

### Types

DateString = string()
ErlDate = {{Year,Month,Date},{Hour,Min,Sec}}
Year = Month = Date = Hour = Min = Sec = integer()

convert_request_date/1 converts DateString to the Erlang date format. DateString must be in one of the three date formats defined in RFC 2616.

create_etag(FileInfo) -> Etag

### Types

FileInfo = file_info()
Etag = string()

create_etag/1 calculates the Etag for a file from its size and time for last modification. FileInfo is a record defined in kernel/include/file.hrl.

day(NthDayOfWeek) -> DayOfWeek

### Types

NthDayOfWeek = 1-7
DayOfWeek = string()

day/1 converts the day of the week (NthDayOfWeek) from an integer (1-7) to an abbreviated string, that is:

1 = "Mon", 2 = "Tue", ..., 7 = "Sat".

decode_hex(HexValue) -> DecValue

### Types

HexValue = DecValue = string()

Converts the hexadecimal value HexValue into its decimal equivalent (DecValue).

flatlength(NestedList) -> Size

### Types

NestedList = list()
Size = integer()

flatlength/1 computes the size of the possibly nested list NestedList, which can contain binaries.

hexlist_to_integer(HexString) -> Number

### Types

Number = integer()
HexString = string()

hexlist_to_integer converts the hexadecimal value of HexString to an integer.

integer_to_hexlist(Number) -> HexString

### Types

Number = integer()
HexString = string()

integer_to_hexlist/1 returns a string representing Number in a hexadecimal form.

lookup(ETSTable,Key) -> Result
lookup(ETSTable,Key,Undefined) -> Result

### Types

ETSTable = ets_table()
Key = term()
Result = term() | undefined | Undefined
Undefined = term()

lookup extracts {Key,Value} tuples from ETSTable and returns the Value associated with Key. If ETSTable is of type bag, only the first Value associated with Key is returned. lookup/2 returns undefined and lookup/3 returns Undefined if no Value is found.

lookup_mime(ConfigDB,Suffix)
lookup_mime(ConfigDB,Suffix,Undefined) -> MimeType

### Types

ConfigDB = ets_table()
Suffix = string()
MimeType = string() | undefined | Undefined
Undefined = term()

lookup_mime returns the MIME type associated with a specific file suffix as specified in the file mime.types (located in the config directory).

lookup_mime_default(ConfigDB,Suffix)
lookup_mime_default(ConfigDB,Suffix,Undefined) -> MimeType

### Types

ConfigDB = ets_table()
Suffix = string()
MimeType = string() | undefined | Undefined
Undefined = term()

lookup_mime_default returns the MIME type associated with a specific file suffix as specified in the mime.types file (located in the config directory). If no appropriate association is found, the value of DefaultType is returned.

message(StatusCode,PhraseArgs,ConfigDB) -> Message

### Types

StatusCode = 301 | 400 | 403 | 404 | 500 | 501 | 504
PhraseArgs = term()
ConfigDB = ets_table
Message = string()

message/3 returns an informative HTTP 1.1 status string in HTML. Each StatusCode requires a specific PhraseArgs:

301

  string(): A URL pointing at the new document position.

400 | 401 | 500

  none (no PhraseArgs).

403 | 404

  string(): A Request-URI as described in RFC 2616.

501

  {Method,RequestURI,HTTPVersion}: The HTTP Method, Request-URI, and HTTP-Version as defined in RFC 2616.

504

  string(): A string describing why the service was unavailable.

month(NthMonth) -> Month

### Types

NthMonth = 1-12
Month = string()

month/1 converts the month NthMonth as an integer (1-12) to an abbreviated string, that is:

1 = "Jan", 2 = "Feb", ..., 12 = "Dec".

multi_lookup(ETSTable,Key) -> Result

### Types

ETSTable = ets_table()
Key = term()
Result = [term()]

multi_lookup extracts all {Key,Value} tuples from an ETSTable and returns all Values associated with Key in a list.

reason_phrase(StatusCode) -> Description

### Types

StatusCode = 100| 200 | 201 | 202 | 204 | 205 | 206 | 300 | 301 | 302 | 303 | 304 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 410 411 | 412 | 413 | 414 415 | 416 | 417 | 500 | 501 | 502 | 503 | 504 | 505
Description = string()

reason_phrase returns Description of an HTTP 1.1 StatusCode, for example, 200 is "OK" and 201 is "Created". For more information, see RFC 2616.

rfc1123_date() -> RFC1123Date
rfc1123_date({{YYYY,MM,DD},{Hour,Min,Sec}}) -> RFC1123Date

### Types

YYYY = MM = DD = Hour = Min = Sec = integer()
RFC1123Date = string()

rfc1123_date/0 returns the current date in RFC 1123 format. rfc_date/1 converts the date in the Erlang format to the RFC 1123 date format.

split(String,RegExp,N) -> SplitRes

### Types

String = RegExp = string()
SplitRes = {ok, FieldList} | {error, errordesc()}
Fieldlist = [string()]
N = integer

split/3 splits String in N chunks using RegExp. split/3 is equivalent to regexp:split/2 with the exception that N defines the maximum number of fields in FieldList.

split_script_path(RequestLine) -> Splitted

### Types

RequestLine = string()
Splitted = not_a_script | {Path, PathInfo, QueryString}
Path = QueryString = PathInfo = string()

split_script_path/1 is equivalent to split_path/1 with one exception. If the longest possible path is not a regular, accessible, and executable file, then not_a_script is returned.

split_path(RequestLine) -> {Path,QueryStringOrPathInfo}

### Types

RequestLine = Path = QueryStringOrPathInfo = string()

split_path/1 splits RequestLine in a file reference (Path), and a QueryString or a PathInfo string as specified in RFC 2616. A QueryString is isolated from Path with a question mark (?) and PathInfo with a slash (/). In the case of a QueryString, everything before ? is a Path and everything after ? is a QueryString. In the case of a PathInfo, RequestLine is scanned from left-to-right on the hunt for longest possible Path being a file or a directory. Everything after the longest possible Path, isolated with a /, is regarded as PathInfo. The resulting Path is decoded using decode_hex/1 before delivery.

strip(String) -> Stripped

### Types

String = Stripped = string()

strip/1 removes any leading or trailing linear white space from the string. Linear white space is to be read as horizontal tab or space.

suffix(FileName) -> Suffix

### Types

FileName = Suffix = string()

suffix/1 is equivalent to filename:extension/1 with the exception that Suffix is returned without a leading dot (.).

### SEE ALSO

httpd(3)