Handle Websocket Requests by CGI

193 views
Skip to first unread message

gbc

unread,
Nov 5, 2013, 1:42:19 AM11/5/13
to mongoos...@googlegroups.com
Hi,

I was playing around with the code a little bit and managed to compile working web server strip naked from conf file & GUI stuff. (code attached)

Now trying to merge websocket example code into server, come into the mind that using "handle_request" function probably is not a good idea to delegate websocket traffic to external CGI application.

What would be the best solution? Enhance the "handle_request" code or try to use "handle_cgi_request" or writing pipe related things from scratch ( probably worst idea ) ?

Prescription would be good...

Regards.
dtws.c

Sergey Lyubka

unread,
Nov 5, 2013, 7:28:09 AM11/5/13
to mongoose-users
I think no code change is required to make CGI handling websockets.
All HTTP headers are passed to CGI script with "HTTP_" prefix,
meaning that CGI can do websocket handshake itself.
Look at websocket.c example and replicate the functionality.


 

Prescription would be good...

Regards.

--
You received this message because you are subscribed to the Google Groups "mongoose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-user...@googlegroups.com.
To post to this group, send email to mongoos...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/groups/opt_out.

gbc

unread,
Nov 5, 2013, 1:15:51 PM11/5/13
to mongoos...@googlegroups.com
So should I re-implement mg_websocket_* functions in CGI?

The "websocket" example uses those functions... So making a websocket connection is not redirecting to cgi program...

Just interchanging websocket frame data using a CGI variable and leaving those masking, handshaking stuff to mongoose seemed more appropriate so I asked your opinion...

If that would be the case how to call CGI executable inside "event_handler" function? ( or maybe more appropriate method without implementing websocket code inside CGI)

Regards.
Reply all
Reply to author
Forward
0 new messages