Skip to content

Commit

Permalink
http_server.c: fix IPv6 address of localhost (must be ::1)
Browse files Browse the repository at this point in the history
  • Loading branch information
DDvO committed Aug 24, 2023
1 parent 84a1492 commit ab7cef7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/lib/http_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ BIO *http_server_init(const char *prog, const char *port, int verb)
int port_num;
char name[40];

snprintf(name, sizeof(name), "[::]:%s", port); /* port may be "0" */
snprintf(name, sizeof(name), "[::1]:%s", port); /* port may be "0" */
if (verb >= 0 && !log_set_verbosity(prog, verb))
return NULL;
bufbio = BIO_new(BIO_f_buffer());
Expand Down
4 changes: 2 additions & 2 deletions doc/man1/openssl-cmp.pod.in
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ Reason numbers defined in RFC 5280 are:

The I<host> domain name or IP address and optionally I<port>
of the CMP server to connect to using HTTP(S).
IP address may be for v4 or v6, such as C<127.0.0.1> or C<[::]> for localhost.
IP address may be for v4 or v6, such as C<127.0.0.1> or C<[::1]> for localhost.

This option excludes I<-port> and I<-use_mock_srv>.
It is ignored if I<-rspin> is given with enough filename arguments.
Expand Down Expand Up @@ -1042,7 +1042,7 @@ This excludes the B<-server> and B<-port> options.
=item B<-port> I<number>

Act as HTTP-based CMP server mock-up listening on the given local port.
The client may address the server via, e.g., C<127.0.0.1> or C<[::]>.
The client may address the server via, e.g., C<127.0.0.1> or C<[::1]>.
This option excludes the B<-server> and B<-use_mock_srv> options.
The B<-rspin>, B<-rspout>, B<-reqin>, and B<-reqout> options
so far are not supported in this mode.
Expand Down
2 changes: 1 addition & 1 deletion doc/man1/openssl-ocsp.pod.in
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ For details, see the B<-host> and B<-path> options described next.
If the B<-host> option is present then the OCSP request is sent to the host
I<host> on port I<port>.
The I<host> may be a domain name or an IP (v4 or v6) address,
such as C<127.0.0.1> or C<[::]> for localhost.
such as C<127.0.0.1> or C<[::1]> for localhost.
The B<-path> option specifies the HTTP pathname to use or "/" by default.
This is equivalent to specifying B<-url> with scheme
http:// and the given I<host>, I<port>, and optional I<pathname>.
Expand Down
2 changes: 1 addition & 1 deletion test/recipes/80-test_cmp_http_data/test_connection.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ expected,description, -section,val, -server,val, -proxy,val, -no_proxy,val, -tls
,,,,,,,,,,,,,,,,,,,
1,default config, -section,,,,,,,,BLANK,,,,BLANK,,BLANK,,BLANK,
1,server domain name, -section,, -server,localhost:_SERVER_PORT,,,,,,,,,,,,,,
1,server IPv6 address, -section,, -server,[::]:_SERVER_PORT,,,,,,,,,,,,,,
1,server IPv6 address, -section,, -server,[::1]:_SERVER_PORT,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,
0,wrong server, -section,, -server,xn--rksmrgs-5wao1o.example.com:_SERVER_PORT,,,,,BLANK,,,, -msg_timeout,1,BLANK,,BLANK,
0,wrong server port, -section,, -server,_SERVER_HOST:99,,,,,BLANK,,,, -msg_timeout,1,BLANK,,BLANK,
Expand Down

0 comments on commit ab7cef7

Please sign in to comment.