Skip to content

Commit 50a36a7

Browse files
authored
Merge pull request #303 from sshanks-kx/http
changed page order for http, changed title
2 parents 24cdbf8 + 45626d3 commit 50a36a7

File tree

1 file changed

+54
-50
lines changed

1 file changed

+54
-50
lines changed

docs/kb/http.md

Lines changed: 54 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,57 @@ keywords: browser, http, https, kdb+, q, web
55
---
66
# :fontawesome-solid-handshake: HTTP
77

8+
## HTTP server
9+
10+
kdb+ has an in-built service capable of handling HTTP/HTTPS requests.
11+
12+
### Listening port
13+
14+
When kdb+ is [configured](../basics/listening-port.md) to listen on a port, it uses the same port as that serving kdb+ IPC and websocket connections.
15+
16+
### SSL/TLS
17+
18+
HTTPS can be handled once kdb+ has been [configured to use SSL/TLS](ssl.md).
19+
20+
### Authentication / Authorization
21+
22+
Client requests can be authenticated/authorized using [.z.ac](../ref/dotz.md#zac-http-auth).
23+
This allows kdb+ to be customized with a variety of mechanisms for securing HTTP requests e.g. LDAP, OAuth2, OpenID Connect, etc.
24+
25+
### Request handling
26+
27+
HTTP request handling is customized by using the following callbacks:
28+
29+
* [.z.ph](../ref/dotz.md#zph-http-get) for HTTP GET
30+
* [.z.pp](../ref/dotz.md##zpp-http-post) for HTTP POST
31+
* [.z.pm](../ref/dotz.md##zpp-http-post) for HTTP OPTIONS/PATCH/PUT/DELETE
32+
33+
#### Default .z.ph handling
34+
35+
The default implementation of .z.ph displays all variables and views. For example, starting kdb+ listening on port (`q -p 8080`) and visiting `http://localhost:8080` from a web browser on the same machine, displays all created variables/views).
36+
37+
Providing q code as a GET param causes it to be evaluated eg. `http://localhost:8080?1+1` returns `2`.
38+
39+
[.h.HOME](../ref/doth.md#hhome-webserver-root) can be set to be the webserver root to serve files contained in the directory e.g.
40+
creating an HTML file index.html in directory `/webserver/` and setting `.h.HOME="/webserver"` allows the file to be viewed via `http://localhost:8080/index.html'.
41+
42+
:fontawesome-regular-map:
43+
[Restricting HTTP queries](../wp/permissions/index.md#restricting-http-queries)
44+
<br>
45+
:fontawesome-regular-map:
46+
[Custom web server](custom-web.md)
47+
48+
### Keep-alive
49+
50+
Persistent connections to supported clients can be enabled via [.h.ka](../ref/doth.md#hka-http-keepalive)
51+
52+
### Compression
53+
54+
HTTP server supports gzip compression via `Content-Encoding: gzip` for responses to `form?…`-style requests.
55+
The response payload must be 2,000+ chars and the client must indicate support via `Accept-Encoding: gzip` in the HTTP header.
56+
(Since V4.0 2020.03.17.)
57+
58+
859
## HTTP client
960

1061
### Creating HTTP requests
@@ -81,61 +132,14 @@ q)@["\r\n\r\n" vs x;1]
81132

82133
To use SSL/TLS, kdb+ should first be [configured to use SSL/TLS](ssl.md). For any request requiring SSL/TLS, replace `http` with `https`.
83134

84-
## HTTP server
85-
86-
kdb+ has an in-built service capable of handling HTTP/HTTPS requests.
87-
88-
### Listening port
89-
90-
When kdb+ is [configured](../basics/listening-port.md) to listen on a port, it uses the same port as that serving kdb+ IPC and websocket connections.
91-
92-
### SSL/TLS
93-
94-
HTTPS can be handled once kdb+ has been [configured to use SSL/TLS](ssl.md).
95-
96-
### Authentication / Authorization
97-
98-
Client requests can be authenticated/authorized using [.z.ac](../ref/dotz.md#zac-http-auth).
99-
This allows kdb+ to be customized with a variety of mechanisms for securing HTTP requests e.g. LDAP, OAuth2, OpenID Connect, etc.
100-
101-
### Request handling
102-
103-
HTTP request handling is customized by using the following callbacks:
104-
105-
* [.z.ph](../ref/dotz.md#zph-http-get) for HTTP GET
106-
* [.z.pp](../ref/dotz.md##zpp-http-post) for HTTP POST
107-
* [.z.pm](../ref/dotz.md##zpp-http-post) for HTTP OPTIONS/PATCH/PUT/DELETE
108-
109-
#### Default .z.ph handling
110-
111-
The default implementation of .z.ph displays all variables and views. For example, starting kdb+ listening on port (`q -p 8080`) and visiting `http://localhost:8080` from a web browser on the same machine, displays all created variables/views).
112135

113-
Providing q code as a GET param causes it to be evaluated eg. `http://localhost:8080?1+1` returns `2`.
114-
115-
[.h.HOME](../ref/doth.md#hhome-webserver-root) can be set to be the webserver root in order to serve files contained in the directory e.g.
116-
creating an HTML file index.html in directory `/webserver/` and setting `.h.HOME="/webserver"` allows the file to be viewed via `http://localhost:8080/index.html'.
117-
118-
:fontawesome-regular-map:
119-
[Restricting HTTP queries](../wp/permissions/index.md#restricting-http-queries)
120-
<br>
121-
:fontawesome-regular-map:
122-
[Custom web server](custom-web.md)
123-
124-
### Keep-alive
125-
126-
Persistent connections to supported clients can be enabled via [.h.ka](../ref/doth.md#hka-http-keepalive)
127-
128-
### Compression
129-
130-
HTTP server supports gzip compression via `Content-Encoding: gzip` for responses to `form?…`-style requests.
131-
The response payload must be 2,000+ chars and the client must indicate support via `Accept-Encoding: gzip` in the HTTP header.
132-
(Since V4.0 2020.03.17.)
133-
134-
## HTTP markup
136+
## HTTP/HTML markup
135137

136138
The [.h namespace](../ref/doth.md) provides a range of markup and HTTP protocol formatting tools.
137139

138140
----
139141
:fontawesome-solid-street-view:
140142
_Q for Mortals_
141143
[§11.7.1 HTTP Connections](/q4m3/q4m3/11_IO/#1171-http-connections)
144+
145+

0 commit comments

Comments
 (0)