File: 0010-strip-port-numbers-in-vhost

package info (click to toggle)
mini-httpd 1.30-15
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,568 kB
  • sloc: ansic: 3,634; sh: 156; makefile: 109
file content (27 lines) | stat: -rw-r--r-- 678 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From: Alexandru Mihail <alexandru.mihail2897@gmail.com>
Date: Thu Sep 21 01:19:42 AM EEST 2023
Subject: strip-port-numbers-in-vhost
Bug-Debian: https://bugs.debian.org/491078
Forwarded: yes
---
 mini_httpd.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mini_httpd.c b/mini_httpd.c
index b9c5c27..29461b3 100644
--- a/mini_httpd.c
+++ b/mini_httpd.c
@@ -2445,7 +2445,13 @@ virtual_file( char* f )
 
     /* Use the request's hostname, or fall back on the IP address. */
     if ( host != (char*) 0 )
+	{
 	req_hostname = host;
+	char *portno;
+	portno = strpbrk(req_hostname, ":");
+	if (portno != (char *) 0)
+		*portno++ = '\0';
+	}
     else
 	{
 	usockaddr usa;