Skip to content

Commit adda189

Browse files
committed
doc/modules/: Make docs use more consistent sentence structure
1 parent 2111120 commit adda189

File tree

8 files changed

+24
-16
lines changed

8 files changed

+24
-16
lines changed

doc/interfaces/connection.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The HTTP version number of the connection as a number.
1818

1919
### `connection:connect(timeout)` <!-- --> {#connection:connect}
2020

21-
Completes the connection to the remote server using the address specified, HTTP version and any options specified in the `connection.new` constructor. The `connect` function will yield until the connection attempt finishes (success or failure) or until `timeout` is exceeded. Connecting may include DNS lookups, TLS negotiation and HTTP2 settings exchange. Returns `true` on success. On failure returns `nil` and an error message.
21+
Completes the connection to the remote server using the address specified, HTTP version and any options specified in the `connection.new` constructor. The `connect` function will yield until the connection attempt finishes (success or failure) or until `timeout` is exceeded. Connecting may include DNS lookups, TLS negotiation and HTTP2 settings exchange. Returns `true` on success. On error, returns `nil`, an error message and an error number.
2222

2323

2424
### `connection:checktls()` <!-- --> {#connection:checktls}
@@ -28,12 +28,12 @@ Checks the socket for a valid Transport Layer Security connection. Returns the l
2828

2929
### `connection:localname()` <!-- --> {#connection:localname}
3030

31-
Returns the connection information for the local socket. Returns address family, IP address and port for an external socket. For Unix domain sockets, the function returns `AF_UNIX` and the path. If the connection object is not connected, returns `AF_UNSPEC` (0). On error, returns `nil` an error message and an error number.
31+
Returns the connection information for the local socket. Returns address family, IP address and port for an external socket. For Unix domain sockets, the function returns `AF_UNIX` and the path. If the connection object is not connected, returns `AF_UNSPEC` (0). On error, returns `nil`, an error message and an error number.
3232

3333

3434
### `connection:peername()` <!-- --> {#connection:peername}
3535

36-
Returns the connection information for the socket *peer* (as in, the next hop). Returns address family, IP address and port for an external socket. For unix sockets, the function returns `AF_UNIX` and the path. If the connection object is not connected, returns `AF_UNSPEC` (0). On error, returns `nil` an error message and an error number.
36+
Returns the connection information for the socket *peer* (as in, the next hop). Returns address family, IP address and port for an external socket. For unix sockets, the function returns `AF_UNIX` and the path. If the connection object is not connected, returns `AF_UNSPEC` (0). On error, returns `nil`, an error message and an error number.
3737

3838
*Note: If the client is using a proxy, the values returned `:peername()` point to the proxy, not the remote server.*
3939

@@ -55,7 +55,7 @@ Closes a connection and releases operating systems resources. Note that `:close(
5555

5656
### `connection:new_stream()` <!-- --> {#connection:new_stream}
5757

58-
Creates a new [*stream*](#stream) on the connection. Use `:new_stream()` to initiate a new http request. In HTTP 1, a new stream can be used for request/response exchanges. In HTTP 2 a new stream can be used for request/response exchanges, organising stream priorities or to initiate a push promise.
58+
Creates and returns a new [*stream*](#stream) on the connection.
5959

6060

6161
### `connection:get_next_incoming_stream(timeout)` <!-- --> {#connection:get_next_incoming_stream}

doc/interfaces/stream.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## stream
22

3+
An HTTP *stream* is an abstraction of a request/response within a HTTP connection. Within a stream there may be a number of "header" blocks as well as data known as the "body".
4+
35
All stream types expose the following fields and functions:
46

57
### `stream.connection` <!-- --> {#stream.connection}

doc/modules/http.h1_connection.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
## http.h1_connection
22

3-
The h1_connection module adheres to the [*connection*](#connection) interface and provides HTTP 1 and 1.1 specific operations.
3+
The *h1_connection* module adheres to the [*connection*](#connection) interface and provides HTTP 1 and 1.1 specific operations.
44

55
### `new(socket, conn_type, version)` <!-- --> {#connection.new}
66

7-
Constructor for a new connection. Takes a socket instance, a connection type string and a numeric HTTP version number. Valid values for the connection type are `"client"` and `"server"`. Valid values for the version number are `1` and `1.1`. On success returns the newly initialized connection object in a non-connected state. On failure returns `nil`, an error message and an error number.
7+
Constructor for a new connection. Takes a cqueues socket object, a [connection type string](#connection.type) and a numeric HTTP version number. Valid values for the connection type are `"client"` and `"server"`. Valid values for the version number are `1` and `1.1`. Returns the newly initialized connection object.
88

99

1010
### `h1_connection.version` <!-- --> {#http.h1_connection.version}
@@ -54,6 +54,8 @@ See [`connection:close()`](#connection:close)
5454

5555
### `h1_connection:new_stream()` <!-- --> {#http.h1_connection:new_stream}
5656

57+
In HTTP 1, only a client may initiate new streams with this function.
58+
5759
See [`connection:new_stream()`](#connection:new_stream) for more information.
5860

5961

doc/modules/http.h1_stream.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## http.h1_stream
22

3-
An h1_stream represents an HTTP 1.0 or 1.1 request/response. The module follows the [*stream*](#stream) interface as well as HTTP 1.x specific functions.
3+
The *h1_stream* module adheres to the [*stream*](#stream) interface and provides HTTP 1.x specific operations.
44

55
The gzip transfer encoding is supported transparently.
66

doc/modules/http.h2_connection.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
## http.h2_connection
22

3-
An HTTP 2 connection can have multiple streams actively transmitting data at once,
3+
The *h2_connection* module adheres to the [*connection*](#connection) interface and provides HTTP 2 specific operations. An HTTP 2 connection can have multiple streams actively transmitting data at once,
44
hence an *http.h2_connection* acts much like a scheduler.
55

66
### `new(socket, conn_type, settings)` <!-- --> {#http.h2_connection.new}
77

8+
Constructor for a new connection. Takes a cqueues socket object, a [connection type string](#connection.type) and an optional table of HTTP 2 settings. Returns the newly initialized connection object in a non-connected state.
9+
810

911
### `h2_connection.version` <!-- --> {#http.h2_connection.version}
1012

11-
Contains the value of the HTTP 2 version number for the connection. Currently will hold the value of `2`.
13+
Contains the HTTP connection version. Currently this will always be `2`.
1214

1315
See [`connection.version`](#connection.version)
1416

@@ -68,8 +70,8 @@ See [`connection:close()`](#connection:close)
6870

6971
### `h2_connection:new_stream(id)` <!-- --> {#http.h2_connection:new_stream}
7072

71-
`id` (optional) is the stream id to assign the new stream. For client initiated streams, this will be the next free odd numbered stream.
72-
For server initiated streams, this will be the next free even numbered stream.
73+
Create and return a new [*h2_stream*](#http.h2_stream).
74+
`id` (optional) is the stream id to assign the new stream, if not specified for client initiated streams this will be the next free odd numbered stream, for server initiated streams this will be the next free even numbered stream.
7375

7476
See [`connection:new_stream()`](#connection:new_stream) for more information.
7577

doc/modules/http.h2_stream.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ See [`stream:shutdown()`](#stream:shutdown)
105105

106106
### `h2_stream:write_http2_frame(typ, flags, payload, timeout)` <!-- --> {#http.h2_stream:write_http2_frame}
107107

108+
Writes a frame with `h2_stream`'s stream id.
109+
110+
See [`h2_connection:write_http2_frame(typ, flags, streamid, payload, timeout)`](#http.h2_connection:write_http2_frame)
111+
108112

109113
### `h2_stream:write_data_frame(payload, end_stream, padded, timeout)` <!-- --> {#http.h2_stream:write_data_frame}
110114

doc/modules/http.server.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Initializes the server socket and if required, resolves DNS. `server:listen()` i
5353

5454
### `server:localname()` <!-- --> {#http.server:localname}
5555

56-
Returns the connection information for the local socket. Returns address family, IP address and port for an external socket. For Unix domain sockets, the function returns AF_UNIX and the path. If the connection object is not connected, returns AF_UNSPEC (0). On error, returns `nil` an error message and an error number.
56+
Returns the connection information for the local socket. Returns address family, IP address and port for an external socket. For Unix domain sockets, the function returns AF_UNIX and the path. If the connection object is not connected, returns AF_UNSPEC (0). On error, returns `nil`, an error message and an error number.
5757

5858

5959
### `server:pause()` <!-- --> {#http.server:pause}
@@ -99,7 +99,7 @@ Returns `true` if the master socket and all client connection have been closed,
9999

100100
### `server:step(timeout)` <!-- --> {#http.server:step}
101101

102-
Step once through server's main loop: any waiting clients will be `accept()`-ed, any pending streams will start getting processed, and each `onstream` handler will get be run at most once. This method will block for *up to* `timeout` seconds. Returns `nil`, an error and an error message on failure.
102+
Step once through server's main loop: any waiting clients will be `accept()`-ed, any pending streams will start getting processed, and each `onstream` handler will get be run at most once. This method will block for *up to* `timeout` seconds. On error, returns `nil`, an error message and an error number.
103103

104104
This can be used for integration with external main loops.
105105

doc/modules/http.socks.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ Add username + password authorisation to the set of allowed authorisation method
3333

3434
Complete the SOCKS connection.
3535

36-
Negotiates a socks connection. `host` is a required string passed to the SOCKS server as the host address. The address will be resolved locally if [`.needs_resolve`](#http.socks.needs_resolve) is `true`. `port` is a required number to pass to the SOCKS server as the connection port.
37-
38-
On error, returns `nil` an error message and an error number.
36+
Negotiates a socks connection. `host` is a required string passed to the SOCKS server as the host address. The address will be resolved locally if [`.needs_resolve`](#http.socks.needs_resolve) is `true`. `port` is a required number to pass to the SOCKS server as the connection port. On error, returns `nil`, an error message and an error number.
3937

4038

4139
### `socks:close()` <!-- --> {#http.socks:close}

0 commit comments

Comments
 (0)