"Joseph A. Knapka" wrote:
>
> > > > > It would be nice if the server could serve the Java applet via
> > > > > HTTP on the RFB port, but unfortunately the RFB handshake
Here's a patch for WinVNC. I've also made a WinVNC 3.3.3r7 executable
containing this patch available at
http://home.earthlink.net/~jknapka/WinVNC.exe
Now you can point your browser at host:5900 and get connected.
-- Joe Knapka
diff -r vncsrc_orig/vnc_winsrc/winvnc/VSocket.cpp vncsrc/vnc_winsrc/winvnc/VSocket.cpp
448a449,464
> VSocket::ReadSelect(VCard to)
> {
> fd_set fds;
> FD_ZERO(&fds);
> FD_SET((unsigned long)sock,&fds);
> struct timeval tv;
> tv.tv_sec = to/1000;
> tv.tv_usec = to % 1000;
> int rc = select(sock+1,&fds,0,0,&tv);
> if (rc>0) return true;
> return false;
> }
>
> ////////////////////////////
>
> VBool
diff -r vncsrc_orig/vnc_winsrc/winvnc/VSocket.h vncsrc/vnc_winsrc/winvnc/VSocket.h
119a120,123
> // Check to see if the socket becomes readable within <to> msec.
> // Added to support HTTP-via-RFB.
> VBool ReadSelect(VCard to);
>
diff -r vncsrc_orig/vnc_winsrc/winvnc/vncHTTPConnect.cpp
vncsrc/vnc_winsrc/winvnc/vncHTTPConnect.cpp
67a68,79
> // Added for HTTP-via-RFB. Allows us to handle an HTTP transaction
> // without starting a separate thread.
> class vncHTTPConnectThreadHelper {
> public:
> // Routines to handle HTTP requests
> void Init(vncServer* svr) { m_server = svr; }
> void DoHTTP(VSocket *socket);
> char *ReadLine(VSocket *socket, char delimiter, int max);
> protected:
> vncServer *m_server;
> };
>
69c81
< class vncHTTPConnectThread : public omni_thread
---
> class vncHTTPConnectThread : public omni_thread, public vncHTTPConnectThreadHelper
79,80c91,92
< virtual void DoHTTP(VSocket *socket);
< virtual char *ReadLine(VSocket *socket, char delimiter, int max);
---
> //virtual void DoHTTP(VSocket *socket);
> //virtual char *ReadLine(VSocket *socket, char delimiter, int max);
85d96
< vncServer *m_server;
88a100,118
> // Added for HTTP-via-RFB. This function is called when a connection is
> // accepted on the RFB port. If the client sends an HTTP request we
> // (attempt to) handle it here and return TRUE. Otherwise we return
> // FALSE and the caller continues with the RFB handshake.
> VBool maybeHandleHTTPRequest(VSocket* sock,vncServer* svr)
> {
> if (!sock->ReadSelect(2000)) return false;
>
> // Client is sending data. Create a vncHTTPConnectThread to
> // handle it.
> vncHTTPConnectThreadHelper http;
> http.Init(svr);
> http.DoHTTP(sock);
> sock->Shutdown();
> sock->Close();
> delete sock;
> return true;
> }
>
98c128,129
< // Start the thread
---
> // Start the thread [unless we were created to handle an HTTP
> // transaction on the RFB port, in which case socket==0]
100c131
< start_undetached();
---
> if (socket) start_undetached();
134c165
< void vncHTTPConnectThread::DoHTTP(VSocket *socket)
---
> void vncHTTPConnectThreadHelper::DoHTTP(VSocket *socket)
293c324
< char *vncHTTPConnectThread::ReadLine(VSocket *socket, char delimiter, int max)
---
> char *vncHTTPConnectThreadHelper::ReadLine(VSocket *socket, char delimiter, int max)
diff -r vncsrc_orig/vnc_winsrc/winvnc/vncSockConnect.cpp
vncsrc/vnc_winsrc/winvnc/vncSockConnect.cpp
34a35,37
> // Added for HTTP-via-RFB
> VBool maybeHandleHTTPRequest(VSocket* sock,vncServer* svr);
>
81a85,93
>
> // If the client wants us to serve it the Java applet, do that;
> // otherwise, start the RFB handshake.
> if (maybeHandleHTTPRequest(new_socket,m_server)) {
> // HTTP request has been handled and new_socket closed. The
>client will
> // now reconnect to the RFB port and we will carry on.
> log.Print(LL_CLIENTS,VNCLOG("Woo hoo! Served Java applet via
>RFB!"));
> continue;
> }
---------------------------------------------------------------------
To unsubscribe, send a message with the line: unsubscribe vnc-list
to [EMAIL PROTECTED]
See also: http://www.uk.research.att.com/vnc/intouch.html
---------------------------------------------------------------------