Giter Club home page Giter Club logo

apache-websocket's People

Contributors

disconnect avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apache-websocket's Issues

Raw pass-through option

This is an extremely useful module. Thanks for sharing it.

I am using the "vncproxy" plugin from here: https://github.com/abligh/apache-websocket
This plugin is providing a WebSocket-to-plain-TCP proxy that effectively turns any back-end TCP server into a WebSocket enabled server. It works very well.

I have run into a situation where the back-end server is expecting a WebSocket connection, not a plain TCP connection. I understand that it would be possible to modify the plugin to re-wrap the TCP data back into WebSockets frames, but that seems pretty wasteful, particularly on the client leg of the journey where it would mean unpacking and then re-packing the data as base64.

How hard would it be to modify apache-websocket to add an option that basically just says "pass the headers and data intact without modification to the plugin". It seems like one possibility would be to extend the interface between mod-websocket and the plugin to include two functions:

  1. pre-process headers. Here the plugin could process the headers in some way. In the case of a websocket proxy that would mean transmitting them unmodified to the back-end server.
  2. pre-process raw data. Here the plugin could see the raw data, including framing, from the client. It could choose to transmit it unmodified to the back-end server. A return code could indicate to mod-websocket that the data had been dealt with and that no further processing (like base64 decoding) is required.

I suppose it's reasonable to ask - why not use mod_proxy? I think there are two reasons. First, mod_proxy does a lot of header modification, and second, mod_proxy does not spawn a thread for each connection so it can handle only a small number of simultaneous connections.

I know there is a project called mod_websocket on github, but it is non-functional and single-threaded. I think it's the wrong starting point for a raw websocket proxy.

Firefox compat

Hey !

I recently learn WebSocket and i made some test with my Apache HTTPD and Chromium.
Works well. So, first, i thank you for this module !

But when my friend with Firefox cames on my webserver to test WebSocket echo, Apache log this :
Oct 23 17:51:36 blastkiller-pc httpd[29998]: [error] [client 192.168.0.5] File does not exist: /home/www-data/www/websocket-echo

So i sniffed my network to see what happened and i found that Firefox sends this in header request :
Connection: keep-alive, Upgrade

I check source, in function mod_websocket_method_handler
!strcasecmp(connection, "Upgrade")
Because of this line, mod_websocket drop this header, so I change to :
strstr(connection, "Upgrade")
and it works.

I'm not a good programmer so i don't know if this is the best solution.
And i'm not a well english writer so sorry if i made some mistakes in my message !

Bye.

sending across connections

hello
a nice module, thank you
is it possible to receive on one connection & send to one or more connections?
thanks
Terry

Connection closed on Echo after a couple of seconds

Hi, I've been testing your apache-websocket library and it has been up and running very smoothly! Nice work!

Still I have a couple of questions: when testing the echo exemple I noticed that the connection is closed after a couple of seconds (seems like around 10 seconds). I've been trying with FF 10 and Chrome 16 on Windows.

I've also updated the Apache2 config and have disabled KeepAlive and set KeepAliveTimeout to 60, but none of these seems to help. I've also looked at the javascript and c code but couldn't find anything (or a overlooked it). I've enabled both websocket and websocket_draft76... (Apache is running on Ubuntu (Apache/2.2.20 (Ubuntu) PHP/5.3.6-13ubuntu3.1 with Suhosin-Patch configured) - could the Suhosin patch be part of the problem ?

Do you have any idea for to overcome this timeout or connection closing ?

Next I've been trying to play with the dumb-increment module but it just couldn't/wouldn't work. I've even put the test html file from libwebsockets and the apache (with some tuning to point to the /increment path) but didn't work. Do I have to use (read install and configure) the libwebsockets and enabled them in Apache to make this work ?

I'm looking to build my own plugin but I first would like to have both examples working :)

Thanks for any feedback !

Getting error :- Could not find initialization function in module

Hello everyone

I am trying to build and run the example echo on windows. I followed the steps given and built the mod_websocket_echo.so and after updating configuration in apache config. And starting apache getting "Could not find initialization function in module".
In httpd.conf i am getting this error in line
WebSocketHandler libexec/apache2/mod_websocket_echo.so echo_init for mod_websocket.so ifmodule block.

Please help me in resolving this issue.

Issues compiling...

Getting this linking error. I installed VS 2012. Have spent a couple hours googling but am not sure what I can do to resolve this.

c:\projects\apache-websocket-master>scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
link /nologo /dll /out:mod_websocket.so "/LIBPATH:C:\Program Files\Apache Software Foundation\Apache2.2\lib" libapr-1.lib libaprutil-1.lib libhttpd.lib mod
_websocket.obj
Creating library mod_websocket.lib and object mod_websocket.exp
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_thread_mutex_create referenced in function mod_websocket_method_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_thread_mutex_lock referenced in function mod_websocket_data_framing
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_thread_mutex_unlock referenced in function mod_websocket_data_framing
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_thread_mutex_destroy referenced in function mod_websocket_method_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_pool_create_ex referenced in function mod_websocket_data_framing
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_palloc referenced in function mod_websocket_create_dir_config
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_pool_cleanup_register referenced in function mod_websocket_conf_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_pool_cleanup_null referenced in function mod_websocket_conf_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_base64_encode_binary referenced in function mod_websocket_handshake
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_sha1_init referenced in function mod_websocket_handshake
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_sha1_update referenced in function mod_websocket_handshake
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_sha1_final referenced in function mod_websocket_handshake
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_pstrdup referenced in function mod_websocket_create_dir_config
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_strtok referenced in function mod_websocket_method_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_atoi64 referenced in function mod_websocket_conf_max_message_size
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_is_empty_array referenced in function mod_websocket_method_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_array_make referenced in function mod_websocket_method_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_array_push referenced in function mod_websocket_method_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_table_clear referenced in function mod_websocket_method_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_table_get referenced in function mod_websocket_header_get
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_table_setn referenced in function mod_websocket_handshake
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_socket_timeout_set referenced in function mod_websocket_method_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_brigade_create referenced in function mod_websocket_data_framing
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_brigade_destroy referenced in function mod_websocket_data_framing
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_brigade_flatten referenced in function mod_websocket_data_framing
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_brigade_write referenced in function mod_websocket_plugin_send
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_bucket_alloc_create referenced in function mod_websocket_data_framing
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_ap_get_token referenced in function mod_websocket_method_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_ap_server_root_relative referenced in function mod_websocket_conf_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_ap_hook_handler referenced in function mod_websocket_register_hooks
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_dso_load referenced in function mod_websocket_conf_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_dso_unload referenced in function mod_websocket_conf_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_apr_dso_sym referenced in function mod_websocket_conf_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_ap_get_brigade referenced in function mod_websocket_data_framing
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_ap_remove_input_filter referenced in function mod_websocket_method_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_ap_filter_flush referenced in function mod_websocket_plugin_send
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_ap_fflush referenced in function mod_websocket_plugin_send
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_ap_send_error_response referenced in function mod_websocket_method_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_ap_get_status_line referenced in function mod_websocket_method_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_ap_send_interim_response referenced in function mod_websocket_method_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_ap_lingering_close referenced in function mod_websocket_method_handler
mod_websocket.obj : error LNK2019: unresolved external symbol __imp_core_module referenced in function mod_websocket_method_handler
mod_websocket.so : fatal error LNK1120: 42 unresolved externals
scons: *** [mod_websocket.so] Error 1120
scons: building terminated because of errors.

Segmentation fault

Hi, when i try to use the websocket with high traffic then i get a segmentation fault.

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/usr/sbin/apache2 -k start'.
Program terminated with signal 11, Segmentation fault.
#0 0x00007f72d5207e02 in apr_bucket_free () from /usr/lib/libaprutil-1.so.0

(gdb)

I compiled and tested it again an "Apache/2.4.6" and "Apache/2.4.9"

Do you have any ideas hot to where the problem is?

Creating custom plugin problem

Hi Disconnect,

I'm trying to create a custom plugin but I've some trouble having it working. As a matter of fact, I have now stripped it down to being exactly the same as the echo plugin, but it still doesn't work! I've updated 'sconstruct' and it compiles fine. When restarting apache I don't have any error messages.
The new module is currently called 'mod_websocket_server'. I've also created a separate html file to test it.

Is it ok to have it loaded next to the 'echo' plugin ? And is there a possibility some debug information (on init, on connect, etc).

I'm a noob in creating plugins for apache modules, so excuse me if I overlookied the obvious.

Thanks in advance!
Benoit


include "websocket_plugin.h"

include "apr_memcache.h"

static size_t CALLBACK server_on_message(void *plugin_private, const WebSocketServer *server,
const int type, unsigned char *buffer, const size_t buffer_size)
{
return server->send(server, type, buffer, buffer_size);
}

static WebSocketPlugin s_plugin = {
sizeof(WebSocketPlugin),
WEBSOCKET_PLUGIN_VERSION_0,
NULL, /* destroy /
NULL, /
on_connect /
server_on_message,
NULL /
on_disconnect */
};

extern EXPORT WebSocketPlugin * CALLBACK server_init()
{
return &s_plugin;
}


SetHandler websocket-handler WebSocketHandler /usr/lib/apache2/modules/mod_websocket_echo.so echo_init SetHandler websocket-handler WebSocketHandler /usr/lib/apache2/modules/mod_websocket_dumb_increment.so dumb_increment_init SetHandler websocket-handler WebSocketHandler /usr/lib/apache2/modules/mod_websocket_server.so server_init

General error c1010070 while installing

I have apache server installed my home computer. I tried install this to get apache-websocket. While installing general error c1010070 occur. Does anyone know how to solve this issue?

c:\users...>scons
scons: Reading Sconscript files ...
scons: done reading Sconscript files.
scons: Building targets ...
link /nologo /dll /out:mod_websocket.so "/LIBPATH:C:\Program Files\Apache Software Foundation\Apache2.2\lib" libapr-1.lib libaprutil-1.lib libhttpd.lib mod_websocket.obj
Creating library mod_websocket.lib and object mod_websocket.exp
mt.exe -nologo -manifes mod_websocket.so.manifest -outputresource:mod_websocket.so;2

mod_websocket.so.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified.

scons: *** [mod_websocket.so] Error 31
scons: building terminated because of errors..

FreeBSD: No response from server for Safari websocket requests

FreeBSD 8.2-RELEASE amd64, apache-2.2.22_5

Hi,

I am having an issue with the apache-websocket server not responding to Safari websocket requests on FreeBSD.

The mod_websocket_draft76 module is built and and applied. Chrome and firefox both work correctly, but the draft76 module doesn't seem to be responding to Safari/iPad requests.

The same setup works correctly on a Linux system, with a custom handler and the dumb_increment and echo examples.

Has anyone had any success getting Safari websockets to work on FreeBSD?

Thanks.

header example:

Request URL:ws://###.###.###.###/echo
Request Headersview source
Connection:Upgrade
Host:###.###.###.###
Origin:http://###.###.###.###
Sec-WebSocket-Key1:1P OCl &416C 14/94 0'S;
Sec-WebSocket-Key2:3|ntX 39o&f/&7077I5J4?
Upgrade:WebSocket
(Key3):59:D3:C2:83:55:9F:A7:07

Not able to work with Apche 2.4 - 400 Bad request for Handshake request

Hi,

We're using this module since long with Apache 2.2 in our application. Now we want to support this with Apache 2.4. But, i get 400 bad request when connecting with Apache 2.4. Here is what my connection request looks like:
Apache 2.2

Websockets Event Test
...
GET /testapp/events/jobsfef21e7bef018bae49d50f241794373c7eb HTTP/1.1`
Upgrade: WebSocket
Connection: Upgrade
Host: localhost:
Origin: http://localhost
Sec-WebSocket-Key1: u2zi1r8S27*Rh148S !4d1
Sec-WebSocket-Key2: .24    !04_ 6 x68 q |4r96|

�&�j��8<
[INFO] WEB SOCKET.rb line -> HTTP/1.1 101 WebSocket Protocol Handshake
Events published...

And with Apache 2.4:

GET /testapp2/api/v4/events?receive[]=ones HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
Host: 10.210.166.92:
Origin: http://{IP_ADD}
Sec-WebSocket-Key1: 1@ _  2 3 107  6H 19   8GP
Sec-WebSocket-Key2: m2  O40  4z 455[ YUm4m 8P7d

C¶▼��/◄�
[INFO] WEB SOCKET.rb line -> HTTP/1.1 400 Bad Request
ws_client is NIL...

Handshake request doesn't seem to reach this apache plugin init method.

Want to check

  1. If we do need to compile module with Apache 2.4 to make it work? Or module compiled with Apache 2.2 will work?
  2. Any other config setting required with Apache 2.4?

Thanks,
pooja

Only getting 404s on Apache 2.4

Has anyone else tried using Apache 2.4? Apache Websocket compiles, but I can only ever get a 404 for the echo test. There is no mention of the websocket module in the Apache log set to debug log level. The only thing of relevance I see in the log is:

AH00128: File does not exist: /usr/local/apache2/htdocs/echo

Connection Closed

Noobish, my apologies,

Software: Ubuntu 11.04, Apache2 2.2.17, Firefox 12, Chromium 18.

Steps:

  1. "sudo scons install" from within your github "Download.zip" extracted folder/files (not "pulled" via github, is there a difference?)
  2. step 1 locates files in the /usr/lib/apache2/modules directory
  3. Symbolic links in the /etc/apache2/mods-enabled directory matching the mods-available directory (websocket.load & websocket_draft76.load
  4. "sudo scons install" from within your "examples" directory; loads files into /usr/lib/apache2/modules directory with no errors (mod_websocket_echo.* & mod_websocket_dumb_increment.* files)
  5. Restarting Apache:
    a). "sudo apache2ctl restart" says it loads successfully...but,
    b). "sudo /etc/init.d/apache2 restart" fails with: Permission denied: make_sock: could not bind to address 127.0.0.1:80
    no listening sockets available, shutting down
    Unable to open logs
    c). No log files to give more information.
  6. Launching client.html in either browser generates an immediate "Connection Closed" response.

Notes:
I am using your httpd.conf for ubuntu:

LoadModule websocket_module   /usr/lib/apache2/modules/mod_websocket.so
LoadModule websocket_draft76_module   /usr/lib/apache2/modules/mod_websocket_draft76.so

<IfModule mod_websocket.c>
  <Location /echo>
    SetHandler websocket-handler
    WebSocketHandler /usr/lib/apache2/modules/mod_websocket_echo.so echo_init
 </Location>
</IfModule>

<IfModule mod_websocket_draft76.c>
  <Location /echo>
    SetHandler websocket-handler
    WebSocketHandler /usr/lib/apache2/modules/mod_websocket_echo.so echo_init
    SupportDraft75 On
  </Location>
</IfModule>

The client.html is at var/www/client.html with : www-data (group) and 777 permissions, and I have also tried root : root with 755

The virtual directive for default is

<VirtualHost 127.0.0.1>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel debug

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        # Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

Can you advise on why I am only getting "Connection Closed" in the browser and the "Permission denied when restarting using the sudo /etc/init.d/apache2 restart command?

Module breaks PHP

No idea why, but I have verified this on two linux distributions. Apache PHP worked before module installation and after module removal. If you cannot reproduce this I can give more info.

404 error

Hi!

For a good while I have been trying to install apache-websocket, according to the instructions, but I only get a 404 when I try to go to localhost/echo. The Apache error log in debug mode attached below.

When I open file:///home/username/apache-websocket/examples/client.html in my web browser it only says received error.

root@samurai:/etc/apache2/mods-enabled# apache2 -v
Server version: Apache/2.2.14 (Ubuntu)
Server built:   Mar  5 2012 16:41:39

Thanks for any help,
Mikael


[Tue Jun 19 02:01:11 2012] [notice] caught SIGTERM, shutting down
[Tue Jun 19 02:01:12 2012] [warn] module websocket_draft76_module is already loaded, skipping
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/apache2/conf.d/mcrypt.ini on line 1 in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/ldap.so' - /usr/lib/php5/20090626+lfs/ldap.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/pdo_pgsql.so' - /usr/lib/php5/20090626+lfs/pdo_pgsql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/pgsql.so' - /usr/lib/php5/20090626+lfs/pgsql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[Tue Jun 19 02:01:12 2012] [notice] Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.15 with Suhosin-Patch proxy_html/3.0.1 configured -- resuming normal operations
[Tue Jun 19 02:01:12 2012] [info] Server built: Mar 5 2012 16:41:39
[Tue Jun 19 02:01:12 2012] [debug] prefork.c(1013): AcceptMutex: sysvsem (default: sysvsem)
[Tue Jun 19 02:01:12 2012] [debug] proxy_util.c(1806): proxy: grabbed scoreboard slot 0 in child 24203 for worker proxy:reverse
[Tue Jun 19 02:01:12 2012] [debug] proxy_util.c(1922): proxy: initialized single connection worker 0 in child 24203 for ()
[Tue Jun 19 02:01:12 2012] [debug] proxy_util.c(1806): proxy: grabbed scoreboard slot 0 in child 24204 for worker proxy:reverse
[Tue Jun 19 02:01:12 2012] [debug] proxy_util.c(1825): proxy: worker proxy:reverse already initialized
[Tue Jun 19 02:01:12 2012] [debug] proxy_util.c(1922): proxy: initialized single connection worker 0 in child 24204 for (
)
[Tue Jun 19 02:01:12 2012] [debug] proxy_util.c(1806): proxy: grabbed scoreboard slot 0 in child 24205 for worker proxy:reverse
[Tue Jun 19 02:01:12 2012] [debug] proxy_util.c(1825): proxy: worker proxy:reverse already initialized
[Tue Jun 19 02:01:12 2012] [debug] proxy_util.c(1922): proxy: initialized single connection worker 0 in child 24205 for ()
[Tue Jun 19 02:01:12 2012] [debug] proxy_util.c(1806): proxy: grabbed scoreboard slot 0 in child 24206 for worker proxy:reverse
[Tue Jun 19 02:01:12 2012] [debug] proxy_util.c(1825): proxy: worker proxy:reverse already initialized
[Tue Jun 19 02:01:12 2012] [debug] proxy_util.c(1922): proxy: initialized single connection worker 0 in child 24206 for (
)
[Tue Jun 19 02:01:12 2012] [debug] proxy_util.c(1806): proxy: grabbed scoreboard slot 0 in child 24207 for worker proxy:reverse
[Tue Jun 19 02:01:12 2012] [debug] proxy_util.c(1825): proxy: worker proxy:reverse already initialized
[Tue Jun 19 02:01:12 2012] [debug] proxy_util.c(1922): proxy: initialized single connection worker 0 in child 24207 for ()
[Tue Jun 19 02:02:30 2012] [error] [client 127.0.0.1] File does not exist: /var/www/echo
[Tue Jun 19 02:02:30 2012] [debug] proxy_util.c(1806): proxy: grabbed scoreboard slot 0 in child 24222 for worker proxy:reverse
[Tue Jun 19 02:02:30 2012] [debug] proxy_util.c(1825): proxy: worker proxy:reverse already initialized
[Tue Jun 19 02:02:30 2012] [debug] proxy_util.c(1922): proxy: initialized single connection worker 0 in child 24222 for (
)
root@samurai:/etc/apache2/mods-enabled#

Shell via web sockets/vt100

Hi there im working on a shell/vt100 via websock and so far things are looking good.

one thing that seems missing is a callback for ready as you cant send messages from on_connect it would make sense to have a RTS call back where the server needs to initiate
the communication or send setup to the client.

here is link to the initial work to get a shell to run in a pty for any user with a setuid wrapper
https://github.com/gregnietsky/sushi

mod_websocket.so crashes when writing message back to client

Hi

I am currently doing load test on mod_websocket.so. The testing involves having 25000 echo message request send across single websocket connection.

I find the crash at line in function ws_write

if (ap_fflush(of, state->obb) != APR_SUCCESS) .

The crash states access violation error. Seems something is not working when writing msg back to client.

Let me know why there is crash occuring even i am able to inspect msg i am sending it to this function.

SetHandler PHP File

Hi. Is there a way of directing the request to a PHP file on "SetHandler" directive? If yes, could you please detail the procedure?

Thanks in advance!

sub module reload

Hello - it's common while in debug or dev that you will build the sub module like echo often. Currently this requires you to restart the server or reload config? - it may be nice to have a feature that is you set a param or you set dev or debug param for sub module like the init function. Then while it makes it a little slower you could check the mod date of the sub module and if it's been updated since last load - reload it - this would speed up dev time on sub module.
Let me know what you think

Thanks
Jack

Apache fails to load module - how to debug

I wrote a handler talks to a usb i/o board (Heber x10i) to fetch some realtime data. After installing the module when I try to restart apache I get:

Could not open WebSocket handler module
Action 'configtest' failed.
The Apache error log may have more information.

I'm suspecting it has something todo with the boards shared libs but am bit unsure how best to debug. Nothing in the error log so if you could point me in a direction how I might find some clues I'd sure appreciate it.

18 hours later - Sorry slightly smarter now... ldd is reporting undefined symbols that are in .so's ldconfig has found so I'm pretty sure my problem is way down there. Please close

always,Not connected

I want to transplant this apache-websocket module into an embedded device. This device is not popular as ARM. So, it take a lot of time to complete the transplant. Now, I have finished it, and my apache works well in this embedded device. But I use the echo example to test the websocket, and it does not work. Whether the apache-websocket does not fix my device very well ,or my setting is going wrong? I've no idea about that. Please give me some help.

I used Mozilla Firefox 4.0 as browser, and there is no error log in the apache when I visit the client.html.
By the way, my httpd.conf is changed like this:
LoadModule websocket_module modules/mod_websocket.so
<Location /echo>
SetHandler websocket-handler
WebSocketHandler modules/mod_websocket_echo.so echo_init

Is there some problems happened to that?

I am rookie, and my English is horrible. I'm so sorry about that.

HTTP 404

Hello,

My server is responding with HTTP 404 when WebSocket requests are made. I'm running Apache HTTPD 2.2.17 on FreeBSD amd64. I am going off of the examples until this problem is solved so the relative sections of my httpd.conf file are as follows:

<IfModule websocket_module> <Location /echo> SetHandler websocket-handler WebSocketHandler libexec/apache22/mod_websocket_echo.so echo_init </Location> <Location /dumb-increment> SetHandler websocket-handler WebSocketHandler libexec/apache22/mod_websocket_dumb_increment.so dumb_increment_init </Location> </IfModule>

I am also using a vhost on a non-standard port. Any advice would be appreciated.

Thank you.

Proxying through SSL hangs at response code 101

Hi,

I've succesfully managed to get apache2 to understand websockets with the default example (*_echo.so)

http://foo/client.html (works, occasionally disconnect problem solved by increasing the body timeout like so:

RequestReadTimeout body=500,minrate=1

So then I tried to det everything running over SSL. I get a 403 error running the regular example, probably because the example code doesn't attempt to open a wss:// websocket. Meh, I know things work...

I then tried to proxy the excellent GateOne through the websocket. The setup is as below:
python gateone.py --diasble-ssl --url-prefix="/term/"
Gateone host: foo:port/term

ProxyPass /term 127.0.0.1:port
ProxyPassReverse /term http://127.0.0.1:port

When gateone initialises, it attempts to connect to a websocket at: wss://foo/term/ws
So, in my httpd.conf (protocols disabled to ensure testing compatibility):

<IfModule mod_websocket.c>
<Location /term/ws>
SetHandler websocket-handler
WebSocketHandler /usr/lib/apache2/modules/mod_websocket_tcp_proxy.so tcp_proxy_init
#  WebSocketTcpProxyBase64 on
WebSocketTcpProxyHost 127.0.0.1
WebSocketTcpProxyPort 444
#   WebSocketTcpProxyProtocol base64
RequestReadTimeout body=500,minrate=1

The problem is, I see in Chrome's activity that the websocket request (/term/ws) hangs at 101 (Switching Protocols).

Request URL:wss://foo/term/ws
Request Method:GET
Status Code:101 Switching Protocols

Sent headers:
Connection:Upgrade
Cookie:gateone_user=[snip]
Host:foo
Origin:https://foo
Sec-WebSocket-Key:4pNAoAlFCIbh/hjyaJAluA==
Sec-WebSocket-Version:13
Upgrade:websocket
(Key3):00:00:00:00:00:00:00:00

Response:
Connection:Upgrade
Sec-WebSocket-Accept:lQTZh4RECkdDfTJhlYPymy4zC1Y=
Upgrade:websocket
(Challenge Response):00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

Is there anything you can think of that could be causing this to hang? Do you know where I might be able to get some help please?

Thanks!

Django send via websocket

Hi, I use python Django framework on apache. The websocket works well, but is there a way to call the send method in django server? or maybe other ways to broadcast message to clients? Thanks.

Feature request : Proxy query to any tcp websocket daemon instead use another C plugin...

It would be very cool to have an apache websocket module able to redirect with any kind of tcp websocket daemon. We are programming in PHP and we already have working daemon. But for example we can't use wss (ssl) and we must open another port in our firewall that might result in a security breach...

It seems that this module bellow do it what we need with Light Http !
http://github.com/nori0428/mod_websocket/

Unfortunately apache2 is a requirement for us ...

Thank you

Apache MPM tuning for websockets

I have downloaded and played with apache-websocket and it--besides being very nice code--appears to be a good fit for our browser based application. We are currently doing some ugly stuff with Ajax HTTP requests that have to be closed and reopened every time we want the server to send something to the browser. Websockets seem to be a far superior solution. We envision each user session having a websocket open to the server for the life of the session, along with some HTTP requests (maybe someday we'll do everything on the websocket, but not yet).

My concern is that each Apache thread or process that becomes a websocket endpoint means one child thread or processes no longer servicing HTTP requests. It seems to me that that would have a significant impact on the tunable logic in the MPMs that ensure that there are enough handlers running at any given time.

Should or does the module do anything to alert Apache that handlers of websocket endpoints are no longer available for normal HTTP request processing? Has this discussion been had somewhere else that I might reference?

Thanks.

example module to connect to an arbitrary TCP port

I am trying to write an example module to connect to an arbitrary TCP port, send the websocket data there, and return data from this port to apache - i.e. send decoded data to the TCP port. This is basically Issue Request #1 save that I was planning to fix it myself.

I am having a little difficulty understanding the threading model this module uses.

Firstly, can I block in my on_message() handler? Can I, for instance, write the data received from the web socket to the TCP port in a manner where the TCP port may block? Or do I have to buffer everything up (possibly infinitely) for another thread to process this, in which case how do I do flow control to stop apache sending me more data?

Secondly, I need to read data back from the tcp port and pass it to server->send(). I cannot solely serve this within my on_message() handler as the on_message() handler may not be called if there is no data going in the other direction (i.e. if there is no data going from websocket to tcp port, I still need to be able to handle data that arrives on the tcp port and needs to go to the web socket). I am presuming I need to create some sort of sister thread for this? If so, is it safe to call server->send() from that thread? Can server->send() itself block? If not, how does apache ever get to tell me to 'stop sending data to me'?

I'm sure these have obvious answers, but being a little new to apache internals I am having difficulty figuring them out.

Configuration Parameters for Handler

I'm writing a handler and want to pass configuration parameters to it, tried the default ap_get_module_config stuff but that doesn't seem to work since the handler is not loaded as a module. Please advise !

Nevermind: Found a solution !

CentOS6 - Could not find initialization function in module - help?

I tried adding the section below to http.conf on CentOS6 after running:

sudo apxs -i -a -c mod_websocket.c
sudo apxs -i -a -c mod_websocket_draft76.c

sudo apachectl configtest errors with the line with echo_init and the error: Could not find initialization function in module

I trading changing it to all the various options show in the README file without luck. Any suggestions please?

Thank you,
AP

----- http.conf ------

LoadModule websocket_module modules/mod_websocket.so
LoadModule websocket_draft76_module modules/mod_websocket_draft76.so

SetHandler websocket-handler WebSocketHandler modules/mod_websocket.so echo_init SetHandler websocket-handler WebSocketHandler modules/mod_websocket_draft76.so echo_init SupportDraft75 On

----- http.conf ------

Safari / draft-hixie-76 fails with websocket URLs with parameters

If the websocket URL has a parameter, Safari will not connect.

This can be illustrated by generating a file client-query.html from client.html applying the following trivial diff

--- client.html 2012-02-15 16:23:33.963958252 +0000
+++ client-query.html   2012-03-21 17:19:15.299937232 +0000
@@ -12,7 +12,7 @@
       }

       function init() {
-        ws = new WebSocket(((window.location.protocol == "https:") ? "wss:" : "ws:") + "//" + window.location.host + "/echo");
+        ws = new WebSocket(((window.location.protocol == "https:") ? "wss:" : "ws:") + "//" + window.location.host + "/echo?foo=bar");
         ws.onopen = function(event) {
           document.getElementById("main").style.visibility = "visible";
           document.getElementById("connected").innerHTML = "Connected to WebSocket server";

After applying this diff, apache-websocket works perfectly with Chrome (connecting to client-query.html), but fails with safari.

The reason for this is that in the handshake response from the server, apache-websocket sends the Sec-Web-Socket location field without the full query string, i.e. it sends:

Sec-WebSocket-Location: ws://192.168.250.142/echo

and not

Sec-WebSocket-Location: ws://192.168.250.142/echo?foo=bar

This appears to be in contravention of the standard, at least in terms of the way Safari and (for instance) websockify.py implement it.

The standard itself appears to support this. From step 41 p26

 -> If the entry's name is "sec-websocket-location"
           If the value is not exactly equal to a string obtained from
           the steps to construct a WebSocket URL from /host/, /port/,
           /resource name/, and the /secure/ flag, then fail the
           WebSocket connection and abort these steps.

And from step 11 p37:

        |Sec-WebSocket-Location|
           The value must be /location/

where location is defined here

3.   Let /location/ be the string that results from constructing a
        WebSocket URL from /host/, /port/, /resource name/, and /secure
        flag/.

and resource name is

        /resource name/
           An identifier for the service provided by the server.  If the
           server provides multiple services, then the value should be
           derived from the resource name given in the client's
           handshake.

and

  9.   Let /resource name/ be the value of the <path> component (which
        might be empty) of /url/.
...
   11.  If /url/ has a <query> component, then append a single U+003F
        QUESTION MARK character (?) to /resource name/, followed by the
        value of the <query> component.

As the URL does have a query component, this should have been appended to the /resource name/, but apparently it has not been.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.