Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
libvncserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
libvncserver
Commits
c3e27a15
Commit
c3e27a15
authored
Aug 22, 2002
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
a pseudo HTTP request for tunnelling (also via strict Web Proxy) was added.
parent
727b0257
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
180 additions
and
6 deletions
+180
-6
VncViewer.jar
classes/VncViewer.jar
+0
-0
javaviewer.pseudo_proxy.patch
classes/javaviewer.pseudo_proxy.patch
+141
-0
example.c
example.c
+1
-0
httpd.c
httpd.c
+36
-3
main.c
main.c
+1
-0
rfb.h
rfb.h
+1
-3
No files found.
classes/VncViewer.jar
View file @
c3e27a15
No preview for this file type
classes/javaviewer.pseudo_proxy.patch
0 → 100644
View file @
c3e27a15
diff -ru vnc_javasrc/OptionsFrame.java proxy_vnc_javasrc/OptionsFrame.java
--- vnc_javasrc/OptionsFrame.java Fri Jul 5 08:17:23 2002
+++ proxy_vnc_javasrc/OptionsFrame.java Thu Aug 22 23:24:44 2002
@@ -70,6 +70,12 @@
Label[] labels = new Label[names.length];
Choice[] choices = new Choice[names.length];
+
+ Label proxyHostLabel;
+ TextField proxyHostEdit;
+ Label proxyPortLabel;
+ TextField proxyPortEdit;
+
Button closeButton;
VncViewer viewer;
@@ -93,6 +99,9 @@
boolean shareDesktop;
boolean viewOnly;
+ String proxyHost;
+ int proxyPort;
+
//
// Constructor. Set up the labels and choices from the names and values
// arrays.
@@ -126,6 +135,32 @@
}
}
+ // TODO: find a way to set these to defaults from browser
+ proxyPort = viewer.readIntParameter("Use Proxy Port", -1);
+ if(proxyPort>-1) {
+ proxyHost = viewer.readParameter("Use Proxy Host", false);
+ if(proxyHost == null)
+ proxyHost = viewer.host;
+
+ proxyHostLabel = new Label("Proxy Host");
+ gbc.gridwidth = 1;
+ gridbag.setConstraints(proxyHostLabel,gbc);
+ add(proxyHostLabel);
+ proxyHostEdit = new TextField();
+ gbc.gridwidth = GridBagConstraints.REMAINDER;
+ gridbag.setConstraints(proxyHostEdit,gbc);
+ add(proxyHostEdit);
+
+ proxyPortLabel = new Label("Proxy Port");
+ gbc.gridwidth = 1;
+ gridbag.setConstraints(proxyPortLabel,gbc);
+ add(proxyPortLabel);
+ proxyPortEdit = new TextField();
+ gbc.gridwidth = GridBagConstraints.REMAINDER;
+ gridbag.setConstraints(proxyPortEdit,gbc);
+ add(proxyPortEdit);
+ }
+
closeButton = new Button("Close");
gbc.gridwidth = GridBagConstraints.REMAINDER;
gridbag.setConstraints(closeButton, gbc);
@@ -161,6 +196,11 @@
}
}
+ if(proxyPort>-1) {
+ proxyPortEdit.setText(Integer.toString(proxyPort));
+ proxyHostEdit.setText(proxyHost);
+ }
+
// Make the booleans and encodings array correspond to the state of the GUI
setEncodings();
@@ -361,8 +401,12 @@
//
public void actionPerformed(ActionEvent evt) {
- if (evt.getSource() == closeButton)
+ if (evt.getSource() == closeButton) {
setVisible(false);
+ proxyHost = proxyHostEdit.getText();
+ proxyPort = Integer.parseInt(proxyPortEdit.getText());
+ System.err.println("proxy is " + proxyHost + ":" + proxyPort);
+ }
}
//
diff -ru vnc_javasrc/RfbProto.java proxy_vnc_javasrc/RfbProto.java
--- vnc_javasrc/RfbProto.java Sun Aug 4 18:39:35 2002
+++ proxy_vnc_javasrc/RfbProto.java Thu Aug 22 22:53:53 2002
@@ -119,12 +119,51 @@
viewer = v;
host = h;
port = p;
- sock = new Socket(host, port);
+ if(viewer.options.proxyPort>-1)
+ sock = new Socket(viewer.options.proxyHost, viewer.options.proxyPort);
+ else
+ sock = new Socket(host, port);
is = new DataInputStream(new BufferedInputStream(sock.getInputStream(),
16384));
os = sock.getOutputStream();
+ if(viewer.options.proxyPort>-1)
+ negotiateProxy(host,port);
}
+ // this is inefficient as hell, but only used once per connection
+ String readLine() {
+ byte[] ba = new byte[1];
+ String s = new String("");
+
+ ba[0]=0;
+ try {
+ while(ba[0] != 0xa) {
+ ba[0] = (byte)is.readUnsignedByte();
+ s += new String(ba);
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ return s;
+ }
+
+ void negotiateProxy(String realHost,int realPort) throws IOException {
+ String line;
+
+ // this would be the correct way, but we want to trick strict proxies.
+ // line = "CONNECT " + realHost + ":" + realPort + " HTTP/1.1\r\nHost: " + realHost + ":" + realPort + "\r\n\r\n";
+ line = "GET " + realHost + ":" + realPort + "/proxied.connection HTTP/1.0\r\nPragma: No-Cache\r\nProxy-Connection: Keep-Alive\r\n\r\n";
+ os.write(line.getBytes());
+
+ line = readLine();
+ System.err.println("Proxy said: " + line);
+ if(!(line.substring(0,7)+line.substring(8,12)).equalsIgnoreCase("HTTP/1. 200")) {
+ IOException e = new IOException(line);
+ throw e;
+ }
+ while(!line.equals("\r\n") && !line.equals("\n"))
+ line = readLine();
+ }
void close() {
try {
example.c
View file @
c3e27a15
...
...
@@ -282,6 +282,7 @@ int main(int argc,char** argv)
rfbScreen
->
kbdAddEvent
=
dokey
;
rfbScreen
->
newClientHook
=
newclient
;
rfbScreen
->
httpDir
=
"./classes"
;
rfbScreen
->
httpEnableProxyConnect
=
TRUE
;
initBuffer
((
unsigned
char
*
)
rfbScreen
->
frameBuffer
);
rfbDrawString
(
rfbScreen
,
&
radonFont
,
20
,
100
,
"Hello, World!"
,
0xffffff
);
...
...
httpd.c
View file @
c3e27a15
...
...
@@ -22,6 +22,7 @@
*/
#include <stdio.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/types.h>
#ifdef WIN32
...
...
@@ -50,6 +51,10 @@
"<HEAD><TITLE>File Not Found</TITLE></HEAD>\n" \
"<BODY><H1>File Not Found</H1></BODY>\n"
#define INVALID_REQUEST_STR "HTTP/1.0 400 Invalid Request\n\n" \
"<HEAD><TITLE>Invalid Request</TITLE></HEAD>\n" \
"<BODY><H1>Invalid request</H1></BODY>\n"
#define OK_STR "HTTP/1.0 200 OK\nContent-Type: text/html\n\n"
static
void
httpProcessInput
();
...
...
@@ -253,6 +258,36 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
/* Process the request. */
if
(
rfbScreen
->
httpEnableProxyConnect
)
{
const
static
char
*
PROXY_OK_STR
=
"HTTP/1.0 200 OK
\r\n
Content-Type: octet-stream
\r\n
Pragma: no-cache
\r\n\r\n
"
;
if
(
!
strncmp
(
buf
,
"CONNECT "
,
8
))
{
if
(
atoi
(
strchr
(
buf
,
':'
)
+
1
)
!=
rfbScreen
->
rfbPort
)
{
rfbLog
(
"httpd: CONNECT format invalid.
\n
"
);
WriteExact
(
&
cl
,
INVALID_REQUEST_STR
,
strlen
(
INVALID_REQUEST_STR
));
httpCloseSock
(
rfbScreen
);
return
;
}
// proxy connection
rfbLog
(
"httpd: client asked for CONNECT
\n
"
);
WriteExact
(
&
cl
,
PROXY_OK_STR
,
strlen
(
PROXY_OK_STR
));
rfbNewClient
(
rfbScreen
,
rfbScreen
->
httpSock
);
// don't fclose(rfbScreen->httpFP), because this would kill the connection
rfbScreen
->
httpFP
=
NULL
;
rfbScreen
->
httpSock
=
-
1
;
return
;
}
if
(
!
strncmp
(
buf
,
"GET "
,
4
)
&&
!
strncmp
(
strchr
(
buf
,
'/'
),
"/proxied.connection HTTP/1."
,
27
))
{
// proxy connection
rfbLog
(
"httpd: client asked for /proxied.connection
\n
"
);
WriteExact
(
&
cl
,
PROXY_OK_STR
,
strlen
(
PROXY_OK_STR
));
rfbNewClient
(
rfbScreen
,
rfbScreen
->
httpSock
);
// don't fclose(rfbScreen->httpFP), because this would kill the connection
rfbScreen
->
httpFP
=
NULL
;
rfbScreen
->
httpSock
=
-
1
;
return
;
}
}
if
(
strncmp
(
buf
,
"GET "
,
4
))
{
rfbLog
(
"httpd: no GET line
\n
"
);
httpCloseSock
(
rfbScreen
);
...
...
@@ -400,10 +435,8 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
#endif
WriteExact
(
&
cl
,
"?"
,
1
);
}
else
if
(
compareAndSkip
(
&
ptr
,
"$PARAMS"
))
{
if
(
params
[
0
]
!=
'\0'
)
WriteExact
(
httpSock
,
params
,
strlen
(
params
));
WriteExact
(
&
cl
,
params
,
strlen
(
params
));
}
else
{
if
(
!
compareAndSkip
(
&
ptr
,
"$$"
))
ptr
++
;
...
...
main.c
View file @
c3e27a15
...
...
@@ -544,6 +544,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
rfbScreen
->
rfbListenSock
=-
1
;
rfbScreen
->
httpInitDone
=
FALSE
;
rfbScreen
->
httpEnableProxyConnect
=
FALSE
;
rfbScreen
->
httpPort
=
0
;
rfbScreen
->
httpDir
=
NULL
;
rfbScreen
->
httpListenSock
=-
1
;
...
...
rfb.h
View file @
c3e27a15
...
...
@@ -292,6 +292,7 @@ typedef struct _rfbScreenInfo
/* http stuff */
Bool
httpInitDone
;
Bool
httpEnableProxyConnect
;
int
httpPort
;
char
*
httpDir
;
SOCKET
httpListenSock
;
...
...
@@ -634,9 +635,6 @@ extern void rfbSetClientColourMaps(rfbScreenInfoPtr rfbScreen, int firstColour,
/* httpd.c */
extern
int
httpPort
;
extern
char
*
httpDir
;
extern
void
httpInitSockets
(
rfbScreenInfoPtr
rfbScreen
);
extern
void
httpCheckFds
(
rfbScreenInfoPtr
rfbScreen
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment