summaryrefslogtreecommitdiffstats
path: root/x11vnc/sslhelper.c
diff options
context:
space:
mode:
authorrunge <runge>2008-05-08 01:23:45 +0000
committerrunge <runge>2008-05-08 01:23:45 +0000
commitabbdf92a704790374a12d6da5125b4e95595aaac (patch)
tree55fdb539e7b9d2e0447668f1dad77c96df22aeb1 /x11vnc/sslhelper.c
parentd8812f8c85fcd83412c6ad275d10ce1c43f22240 (diff)
downloadlibtdevnc-abbdf92a704790374a12d6da5125b4e95595aaac.tar.gz
libtdevnc-abbdf92a704790374a12d6da5125b4e95595aaac.zip
x11vnc: add UltraVNC repeater proxy support. fix to setp gui
mode. -threads is now strongly discouraged. Read PORT= in url. User can set nolisten for Xvfb in -create mode. clean up wait_for_client() to some degree.
Diffstat (limited to 'x11vnc/sslhelper.c')
-rw-r--r--x11vnc/sslhelper.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/x11vnc/sslhelper.c b/x11vnc/sslhelper.c
index 75d196e..a7466b2 100644
--- a/x11vnc/sslhelper.c
+++ b/x11vnc/sslhelper.c
@@ -1567,6 +1567,9 @@ void accept_openssl(int mode, int presock) {
if (screen->httpListenSock >= 0 && screen->httpPort > 0) {
have_httpd = 1;
}
+ if (screen->httpListenSock == -2) {
+ have_httpd = 1;
+ }
if (mode == OPENSSL_HTTPS && ! have_httpd) {
rfbLog("SSL: accept_openssl[%d]: no httpd socket for "
"-https mode\n", getpid());
@@ -1695,10 +1698,11 @@ void accept_openssl(int mode, int presock) {
/* send the failure tag: */
strcpy(tbuf, uniq);
- if (https_port_redir < 0) {
+ if (https_port_redir < 0 || (strstr(buf, "PORT=") || strstr(buf, "port="))) {
char *q = strstr(buf, "Host:");
- int fport = 443;
+ int fport = 443, match = 0;
char num[16];
+
if (q && strstr(q, "\n")) {
q += strlen("Host:") + 1;
while (*q != '\n') {
@@ -1706,12 +1710,25 @@ void accept_openssl(int mode, int presock) {
if (*q == ':' && sscanf(q, ":%d", &p) == 1) {
if (p > 0 && p < 65536) {
fport = p;
+ match = 1;
break;
}
}
q++;
}
}
+ if (!match || !https_port_redir) {
+ int p;
+ if (sscanf(buf, "PORT=%d,", &p) == 1) {
+ if (p > 0 && p < 65536) {
+ fport = p;
+ }
+ } else if (sscanf(buf, "port=%d,", &p) == 1) {
+ if (p > 0 && p < 65536) {
+ fport = p;
+ }
+ }
+ }
sprintf(num, "HP=%d,", fport);
strcat(tbuf, num);
}