summaryrefslogtreecommitdiffstats
path: root/doc/http.n
diff options
context:
space:
mode:
authorkjnash <k.j.nash@usa.net>2022-05-10 07:48:31 (GMT)
committerkjnash <k.j.nash@usa.net>2022-05-10 07:48:31 (GMT)
commit3bdcb898d3c643d00352fcebe7fe7a3b79d2e9cc (patch)
tree421cc284e1377ea0243f425db98b7d88bff6b1f6 /doc/http.n
parentbdf3e8b15daa6eb5dbc8b8ead72235c091308a84 (diff)
downloadtcl-3bdcb898d3c643d00352fcebe7fe7a3b79d2e9cc.zip
tcl-3bdcb898d3c643d00352fcebe7fe7a3b79d2e9cc.tar.gz
tcl-3bdcb898d3c643d00352fcebe7fe7a3b79d2e9cc.tar.bz2
Fix the bug. Standardise and document protocol upgrades.
Diffstat (limited to 'doc/http.n')
-rw-r--r--doc/http.n34
1 files changed, 34 insertions, 0 deletions
diff --git a/doc/http.n b/doc/http.n
index 181b48b..a451f80 100644
--- a/doc/http.n
+++ b/doc/http.n
@@ -786,6 +786,40 @@ Subsequent GET and HEAD requests in a failed pipeline will also be retried.
that the retry is appropriate\fR - specifically, the application must know
that if the failed POST successfully modified the state of the server, a repeat POST
would have no adverse effect.
+.SH "PROTOCOL UPGRADES"
+.PP
+The HTTP/1.1 \fBConnection\fR and \fBUpgrade\fR client headers inform the server
+that the client wishes to change the protocol used over the existing connection
+(RFC 7230). This mechanism can be used to request a WebSocket (RFC 6455), a
+higher version of the HTTP protocol (HTTP 2 or 3), or TLS encryption. If the
+server accepts the upgrade request, its response code will be 101.
+.PP
+To request a protocol upgrade when calling \fBhttp::geturl\fR, the \fB-headers\fR
+option must supply appropriate values for \fBConnection\fR and \fBUpgrade\fR, and
+the \fB-command\fR option must supply a command that implements the requested
+protocol and can also handle the server response if the server refuses the
+protocol upgrade. For upgrade requests \fBhttp::geturl\fR ignores the value of
+option \fB-keepalive\fR, and always uses the value \fB0\fR so that the upgrade
+request is not made over a connection that is intended for multiple HTTP requests.
+.PP
+The Tcllib library \fBwebsocket\fR implements WebSockets, and makes the necessary
+calls to commands in the \fBhttp\fR package.
+.PP
+There is currently no native Tcl client library for HTTP/2 or HTTP/3.
+.PP
+The \fBUpgrade\fR mechanism is not used to request TLS in web browsers, because
+\fBhttp\fR and \fBhttps\fR are served over different ports. It is used by
+protocols such as Internet Printing Protocol (IPP) that are built on top of
+\fBhttp(s)\fR and use the same TCP port number for both secure and insecure
+traffic.
+.PP
+In browsers, opportunistic encryption is instead implemented by the
+\fBUpgrade-Insecure-Requests\fR client header. If a secure service is available,
+the server response code is a 307 redirect, and the response header
+\fBLocation\fR specifies the target URL. The browser must call \fBhttp::geturl\fR
+again in order to fetch this URL.
+See https://w3c.github.io/webappsec-upgrade-insecure-requests/
+.PP
.SH EXAMPLE
.PP
This example creates a procedure to copy a URL to a file while printing a