8000 Don't include default port in upstream url to proxy by ejose19 · Pull Request #498 · tinyproxy/tinyproxy · GitHub
[go: up one dir, main page]

Skip to content

Don't include default port in upstream url to proxy #498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Don't include default port in upstream url to proxy
  • Loading branch information
ejose19 committed Jun 16, 2023
commit 79b52bd7835515da333bdf609f8d6da6e3564b6c
23 changes: 19 additions & 4 deletions src/reqs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1464,17 +1464,32 @@ connect_to_upstream (struct conn_s *connptr, struct request_s *request)
return -1;
}

snprintf (combined_string, len, "%s:%d", request->host,
request->port);
/*
* if(HTTPS on port 443) don't include the port number
*/
if (request->port == HTTP_PORT_SSL) {
snprintf (combined_string, len, "%s", request->host);
} else {
snprintf (combined_string, len, "%s:%d", request->host,
request->port);
}
} else {
len = strlen (request->host) + strlen (request->path) + 14;
combined_string = (char *) safemalloc (len);
if (!combined_string) {
return -1;
}

snprintf (combined_string, len, "http://%s:%d%s", request->host,
request->port, request->path);
/*
* if(HTTP on port 80) don't include the port number
*/
if (request->port == HTTP_PORT) {
snprintf (combined_string, len, "http://%s%s", request->host,
request->path);
} else {
snprintf (combined_string, len, "http://%s:%d%s", request->host,
request->port, request->path);
}
}

if (request->path)
Expand Down
0