From b8f657dec5dc99df6652ccc36e95b976a72e802d Mon Sep 17 00:00:00 2001 From: Mr Dave Date: Mon, 14 Sep 2015 21:08:15 -0600 Subject: [PATCH] Patch netcam url with proxy --- CHANGELOG | 1 + netcam.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 948aa881..cc95cf88 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,5 @@ Summary of Changes + * Add patch for ports on proxy netcams from GVautier (issue 144906) * Add patch from JonGuess(issue 151452) for treatment of partial netcam images. * Consolidate the Sqlite3 options into the code standard. * Draft revised motion_guide.html with new options. diff --git a/netcam.c b/netcam.c index 77cce1a8..1be0d054 100644 --- a/netcam.c +++ b/netcam.c @@ -2186,10 +2186,14 @@ static int netcam_http_build_url(netcam_context_ptr netcam, struct url_t *url) * Allocate space for a working string to contain the path. * The extra 4 is for "://" and string terminator. */ - ptr = mymalloc(strlen(url->service) + strlen(url->host) - + strlen(url->path) + 4); - sprintf((char *)ptr, "http://%s%s", url->host, url->path); - + if (url->port != 0) { + ptr = mymalloc(strlen(url->service) + strlen(url->host) + 7 + strlen(url->path) + 4); + sprintf((char *)ptr, "http://%s:%d%s", url->host, url->port , url->path); + }else { + ptr = mymalloc(strlen(url->service) + strlen(url->host) + strlen(url->path) + 4); + sprintf((char *)ptr, "http://%s%s", url->host, url->path); + } + netcam->connect_keepalive = FALSE; /* Disable Keepalive if proxy */ free((void *)netcam->cnt->conf.netcam_keepalive); netcam->cnt->conf.netcam_keepalive = strdup("off");