]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
demos/guide: switch clients to HTTP/1.1
authorEugene Adell <eugene.adell@gmail.com>
Sun, 26 Apr 2026 17:50:26 +0000 (19:50 +0200)
committerNorbert Pocs <norbertp@openssl.org>
Sun, 3 May 2026 15:21:23 +0000 (17:21 +0200)
The Host Header comes with HTTP/1.1, not 1.0, and some
Web Server now doesn't want to answer to such requests.

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
MergeDate: Sun May  3 15:21:35 2026
(Merged from https://github.com/openssl/openssl/pull/30981)

12 files changed:
demos/guide/quic-client-block.c
demos/guide/quic-client-non-block.c
demos/guide/quic-multi-stream.c
demos/guide/quic-server-block.c
demos/guide/quic-server-non-block.c
demos/guide/tls-client-block.c
demos/guide/tls-client-non-block.c
doc/man7/ossl-guide-quic-client-block.pod
doc/man7/ossl-guide-quic-multi-stream.pod
doc/man7/ossl-guide-quic-server-block.pod
doc/man7/ossl-guide-quic-server-non-block.pod
doc/man7/ossl-guide-tls-client-block.pod

index dd3e1e12a5173b41d678f4756c8c9b419d34c532..805569d8eb10fd7237ce6c029fdcb9a024a7213c 100644 (file)
@@ -109,8 +109,8 @@ static BIO *create_socket_bio(const char *hostname, const char *port,
 }
 
 /*
- * Simple application to send a basic HTTP/1.0 request to a server and
- * print the response on the screen. Note that HTTP/1.0 over QUIC is
+ * Simple application to send a basic HTTP/1.1 request to a server and
+ * print the response on the screen. Note that HTTP/1.1 over QUIC is
  * non-standard and will not typically be supported by real world servers. This
  * is for demonstration purposes only.
  */
@@ -121,8 +121,8 @@ int main(int argc, char *argv[])
     BIO *bio = NULL;
     int res = EXIT_FAILURE;
     int ret;
-    unsigned char alpn[] = { 8, 'h', 't', 't', 'p', '/', '1', '.', '0' };
-    const char *request_start = "GET / HTTP/1.0\r\nConnection: close\r\nHost: ";
+    unsigned char alpn[] = { 8, 'h', 't', 't', 'p', '/', '1', '.', '1' };
+    const char *request_start = "GET / HTTP/1.1\r\nConnection: close\r\nHost: ";
     const char *request_end = "\r\n\r\n";
     size_t written, readbytes;
     char buf[160];
index 34a0000788ec3bd28965230aa6e4890bd86f09a3..02712857733413a2b695fd34cfeeee5e72da0703 100644 (file)
@@ -216,8 +216,8 @@ static int handle_io_failure(SSL *ssl, int res)
     }
 }
 /*
- * Simple application to send a basic HTTP/1.0 request to a server and
- * print the response on the screen. Note that HTTP/1.0 over QUIC is
+ * Simple application to send a basic HTTP/1.1 request to a server and
+ * print the response on the screen. Note that HTTP/1.1 over QUIC is
  * non-standard and will not typically be supported by real world servers. This
  * is for demonstration purposes only.
  */
@@ -228,8 +228,8 @@ int main(int argc, char *argv[])
     BIO *bio = NULL;
     int res = EXIT_FAILURE;
     int ret;
-    unsigned char alpn[] = { 8, 'h', 't', 't', 'p', '/', '1', '.', '0' };
-    const char *request_start = "GET / HTTP/1.0\r\nConnection: close\r\nHost: ";
+    unsigned char alpn[] = { 8, 'h', 't', 't', 'p', '/', '1', '.', '1' };
+    const char *request_start = "GET / HTTP/1.1\r\nConnection: close\r\nHost: ";
     const char *request_end = "\r\n\r\n";
     size_t written, readbytes = 0;
     char buf[160];
index 8d3170593df92d89c01a676e79885c34146ae9f5..fd922432255386c075989035a7d4ad0054848168 100644 (file)
@@ -126,8 +126,8 @@ static int write_a_request(SSL *stream, const char *request_start,
 }
 
 /*
- * Simple application to send basic HTTP/1.0 requests to a server and print the
- * response on the screen. Note that HTTP/1.0 over QUIC is not a real protocol
+ * Simple application to send basic HTTP/1.1 requests to a server and print the
+ * response on the screen. Note that HTTP/1.1 over QUIC is not a real protocol
  * and will not be supported by real world servers. This is for demonstration
  * purposes only.
  */
@@ -139,9 +139,9 @@ int main(int argc, char *argv[])
     BIO *bio = NULL;
     int res = EXIT_FAILURE;
     int ret;
-    unsigned char alpn[] = { 8, 'h', 't', 't', 'p', '/', '1', '.', '0' };
-    const char *request1_start = "GET /request1.html HTTP/1.0\r\nConnection: close\r\nHost: ";
-    const char *request2_start = "GET /request2.html HTTP/1.0\r\nConnection: close\r\nHost: ";
+    unsigned char alpn[] = { 8, 'h', 't', 't', 'p', '/', '1', '.', '1' };
+    const char *request1_start = "GET /request1.html HTTP/1.1\r\nConnection: close\r\nHost: ";
+    const char *request2_start = "GET /request2.html HTTP/1.1\r\nConnection: close\r\nHost: ";
     size_t readbytes;
     char buf[160];
     BIO_ADDR *peer_addr = NULL;
@@ -351,7 +351,7 @@ int main(int argc, char *argv[])
     }
 
     /*
-     * In our hypothetical HTTP/1.0 over QUIC protocol that we are using we
+     * In our hypothetical HTTP/1.1 over QUIC protocol that we are using we
      * assume that the server will respond with a server initiated stream
      * containing the data requested in our uni-directional stream. This doesn't
      * really make sense to do in a real protocol, but its just for
index 3ec6d885ae09ea668dacdc854283ec12ab2b2731..434516679b38ea824625a9ab5e934171201ef7a1 100644 (file)
@@ -268,7 +268,7 @@ err:
     return ok;
 }
 
-/* Minimal QUIC HTTP/1.0 server. */
+/* Minimal QUIC HTTP/1.1 server. */
 int main(int argc, char *argv[])
 {
     int res = EXIT_FAILURE;
index 3a5c0b63ce37500a1d69f2bb1e75164e29c2ed6b..eb954f9f79f129a763e498f29e1b411b06660477 100644 (file)
@@ -454,7 +454,7 @@ err:
     return ok;
 }
 
-/* Minimal QUIC HTTP/1.0 server. */
+/* Minimal QUIC HTTP/1.1 server. */
 int main(int argc, char *argv[])
 {
     int res = EXIT_FAILURE;
index 57119d8620c365848953ba86058938916d8f42c7..c94e09cc07932f02168cebec3c78e807c5f149c3 100644 (file)
@@ -94,7 +94,7 @@ static BIO *create_socket_bio(const char *hostname, const char *port, int family
 }
 
 /*
- * Simple application to send a basic HTTP/1.0 request to a server and
+ * Simple application to send a basic HTTP/1.1 request to a server and
  * print the response on the screen.
  */
 int main(int argc, char *argv[])
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
     BIO *bio = NULL;
     int res = EXIT_FAILURE;
     int ret;
-    const char *request_start = "GET / HTTP/1.0\r\nConnection: close\r\nHost: ";
+    const char *request_start = "GET / HTTP/1.1\r\nConnection: close\r\nHost: ";
     const char *request_end = "\r\n\r\n";
     size_t written, readbytes;
     char buf[160];
index aafd7dadb484600a0987f242fe58a517b26909f9..9c21a5df1e1888cbff4c1a027c2f354a27f6ab8b 100644 (file)
@@ -171,7 +171,7 @@ static int handle_io_failure(SSL *ssl, int res)
 }
 
 /*
- * Simple application to send a basic HTTP/1.0 request to a server and
+ * Simple application to send a basic HTTP/1.1 request to a server and
  * print the response on the screen.
  */
 int main(int argc, char *argv[])
@@ -181,7 +181,7 @@ int main(int argc, char *argv[])
     BIO *bio = NULL;
     int res = EXIT_FAILURE;
     int ret;
-    const char *request_start = "GET / HTTP/1.0\r\nConnection: close\r\nHost: ";
+    const char *request_start = "GET / HTTP/1.1\r\nConnection: close\r\nHost: ";
     const char *request_end = "\r\n\r\n";
     size_t written, readbytes = 0;
     char buf[160];
index 394580b2de12e698d23df4495eebe60b0cd22006..9d5bc62da53ac1bdd711c4448470f7362c7f9768 100644 (file)
@@ -16,7 +16,7 @@ ossl-guide-quic-client-block
 
 This page will present various source code samples demonstrating how to write
 a simple blocking QUIC client application which connects to a server, sends an
-HTTP/1.0 request to it, and reads back the response. Note that HTTP/1.0 over
+HTTP/1.1 request to it, and reads back the response. Note that HTTP/1.1 over
 QUIC is non-standard and will not be supported by real world servers. This is
 for demonstration purposes only.
 
@@ -205,7 +205,7 @@ simple client that we developed in L<ossl-guide-tls-client-block(7)> did not use
 it. However QUIC mandates that the TLS handshake used in establishing a QUIC
 connection must use ALPN.
 
-    unsigned char alpn[] = { 8, 'h', 't', 't', 'p', '/', '1', '.', '0' };
+    unsigned char alpn[] = { 8, 'h', 't', 't', 'p', '/', '1', '.', '1' };
 
     /* SSL_set_alpn_protos returns 0 for success! */
     if (SSL_set_alpn_protos(ssl, alpn, sizeof(alpn)) != 0) {
@@ -215,7 +215,7 @@ connection must use ALPN.
 
 The ALPN is specified using a length prefixed array of unsigned chars (it is not
 a NUL terminated string). Our original TLS blocking client demo was using
-HTTP/1.0. We will use the same for this example. Unlike most OpenSSL functions
+HTTP/1.1. We will use the same for this example. Unlike most OpenSSL functions
 L<SSL_set_alpn_protos(3)> returns zero for success and nonzero for failure.
 
 =head2 Setting the peer address
index 1493d1c2b2e8cfa031f7d9ec9726385780ef7c71..f2b8084bd5a1d0f2d6436d8f4c51d7d4c981d20a 100644 (file)
@@ -159,7 +159,7 @@ object it will return NULL.
 
 This section will present various source code samples demonstrating how to write
 a simple multi-stream QUIC client application which connects to a server, send
-some HTTP/1.0 requests to it, and read back the responses. Note that HTTP/1.0
+some HTTP/1.1 requests to it, and read back the responses. Note that HTTP/1.1
 over QUIC is non-standard and will not be supported by real world servers. This
 is for demonstration purposes only.
 
@@ -349,7 +349,7 @@ arrived and is available for us to accept. In the event of an error it will
 return B<NULL>.
 
     /*
-     * In our hypothetical HTTP/1.0 over QUIC protocol that we are using we
+     * In our hypothetical HTTP/1.1 over QUIC protocol that we are using we
      * assume that the server will respond with a server initiated stream
      * containing the data requested in our uni-directional stream. This doesn't
      * really make sense to do in a real protocol, but its just for
index d44c60613fbf8dd03d5c2be8344260be2a39af97..ec78a0ada8573d6a252833392545e6772552bbe2 100644 (file)
@@ -19,7 +19,7 @@ simple, non-concurrent, QUIC "echo" server application which accepts one client
 connection at a time, echoing input from the client back to the same client.
 Once the current client disconnects, the next client connection is accepted.
 
-The server only accepts HTTP/1.0 requests, which is non-standard and will not
+The server only accepts HTTP/1.1 requests, which is non-standard and will not
 be supported by real world servers.  This is for demonstration purposes only.
 
 Both the accepting socket and client connections are "blocking".  A more typical
@@ -130,14 +130,14 @@ select an ALPN the server considers acceptable.
     /* Setup ALPN negotiation callback to decide which ALPN is accepted. */
     SSL_CTX_set_alpn_select_cb(ctx, select_alpn, NULL);
 
-In this case, we only accept "http/1.0" and "hq-interop".
+In this case, we only accept "http/1.1" and "hq-interop".
 
     /*
-    * ALPN strings for TLS handshake. Only 'http/1.0' and 'hq-interop'
+    * ALPN strings for TLS handshake. Only 'http/1.1' and 'hq-interop'
     * are accepted.
     */
     static const unsigned char alpn_ossltest[] = {
-        8,  'h', 't', 't', 'p', '/', '1', '.', '0',
+        8,  'h', 't', 't', 'p', '/', '1', '.', '1',
         10, 'h', 'q', '-', 'i', 'n', 't', 'e', 'r', 'o', 'p',
     };
 
index d5f0b91dff7486c084c4ccae0dce90888bdf6688..2a5cfaa603a89d259504dbf76e5cebc9fb8a5db6 100644 (file)
@@ -19,14 +19,14 @@ simple, non-concurrent, QUIC "echo" server application which accepts one client
 connection at a time, echoing input from the client back to the same client.
 Once the current client disconnects, the next client connection is accepted.
 
-The server only accepts C<http/1.0> and C<hq-interop> ALPN's and doesn't actually
+The server only accepts C<http/1.1> and C<hq-interop> ALPN's and doesn't actually
 implement HTTP but only does a simple echo.  This is non-standard and will not
 be supported by real world servers.  This is for demonstration purposes only.
 
 There are various methods to test this server: B<quic-client-block.c> and
-B<quic-client-non-block.c> will send a basic HTTP/1.0 request, which the server
+B<quic-client-non-block.c> will send a basic HTTP/1.1 request, which the server
 will echo back.  You can also test this server by running
-C<openssl s_client -connect localhost:4443 -4 -quic -alpn http/1.0> and entering
+C<openssl s_client -connect localhost:4443 -4 -quic -alpn http/1.1> and entering
 text that will be echoed back by the server.
 
 Both the listening socket and connected socket are "nonblocking".  However,
@@ -140,14 +140,14 @@ select an ALPN the server considers acceptable.
     /* Setup ALPN negotiation callback to decide which ALPN is accepted. */
     SSL_CTX_set_alpn_select_cb(ctx, select_alpn, NULL);
 
-In this case, we only accept "http/1.0" and "hq-interop".
+In this case, we only accept "http/1.1" and "hq-interop".
 
     /*
-    * ALPN strings for TLS handshake. Only 'http/1.0' and 'hq-interop'
+    * ALPN strings for TLS handshake. Only 'http/1.1' and 'hq-interop'
     * are accepted.
     */
     static const unsigned char alpn_ossltest[] = {
-        8,  'h', 't', 't', 'p', '/', '1', '.', '0',
+        8,  'h', 't', 't', 'p', '/', '1', '.', '1',
         10, 'h', 'q', '-', 'i', 'n', 't', 'e', 'r', 'o', 'p',
     };
 
index dc731e6685962048397e0cf1a64bedd50d374373..e508eb23ecd688bf3c329c6b072902523d0d61a8 100644 (file)
@@ -15,7 +15,7 @@ ossl-guide-tls-client-block
 =head1 SIMPLE BLOCKING TLS CLIENT EXAMPLE
 
 This page will present various source code samples demonstrating how to write
-a simple TLS client application which connects to a server, sends an HTTP/1.0
+a simple TLS client application which connects to a server, sends an HTTP/1.1
 request to it, and reads back the response.
 
 We use a blocking socket for the purposes of this example. This means that
@@ -353,7 +353,7 @@ chunks. First we write the start of the request. Secondly we write the hostname
 we are sending the request to. Finally we send the end of the request.
 
     size_t written;
-    const char *request_start = "GET / HTTP/1.0\r\nConnection: close\r\nHost: ";
+    const char *request_start = "GET / HTTP/1.1\r\nConnection: close\r\nHost: ";
     const char *request_end = "\r\n\r\n";
 
     /* Write an HTTP GET request to the peer */