Updated or added timestamp to obsolete and fixme messages.

Fixed ecf file exclusion for .svn and .git .
Cosmetic changed.
This commit is contained in:
Jocelyn Fiat
2017-05-12 14:11:22 +02:00
parent 3d146d9be9
commit fb9af26d32
159 changed files with 15255 additions and 370 deletions

View File

@@ -2,8 +2,8 @@
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-16-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-16-0 http://www.eiffel.com/developers/xml/configuration-1-16-0.xsd" name="echo_websocket_server" uuid="C9B3DA5F-DF0D-4C0F-924A-130B5C1E6604">
<target name="common">
<file_rule>
<exclude>/.git$</exclude>
<exclude>/.svn$</exclude>
<exclude>/\.git$</exclude>
<exclude>/\.svn$</exclude>
<exclude>/CVS$</exclude>
<exclude>/EIFGENs$</exclude>
</file_rule>
@@ -30,7 +30,7 @@
<target name="echo_websocket_server_mt" extends="common">
<root class="APPLICATION" feature="make_and_launch"/>
<capability>
<concurrency use="thread"/>
<concurrency support="thread" use="thread"/>
</capability>
</target>
<target name="echo_websocket_server_mt_ssl" extends="echo_websocket_server_mt">

View File

@@ -0,0 +1,60 @@
#!/usr/bin/env python
import socket, threading, time, re, hashlib, base64
magicguid = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
port = 9999
def printHeaders(headers):
print "Headers received from WebSocket client"
for key in headers.keys():
print key, headers[key]
print
def doHandShake(conn, dataheaders):
headers = dict(re.findall(r"(?P<name>.*?): (?P<value>.*?)\r\n", dataheaders))
printHeaders(headers)
key = headers['Sec-WebSocket-Key']
print "key", key
key += magicguid
hashkey = hashlib.sha1()
hashkey.update(key)
key = base64.b64encode(hashkey.digest())
handshake = "HTTP/1.1 101 Switching Protocols\r\n"
handshake += "Upgrade: websocket\r\n"
handshake += "Connection: Upgrade\r\n"
handshake += "Sec-WebSocket-Accept: " + key + "\r\n"
# end of header empty line
handshake += "\r\n"
print
print handshake
conn.send(handshake)
def handle(conn):
time.sleep(1)
conn.send('\x81\x0BHello World')
time.sleep(1)
conn.send('\x81\x12How are you there?')
time.sleep(1)
conn.close()
s = socket.socket()
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(('127.0.0.1', port))
print "Server listening on port", port
s.listen(1)
while 1:
try:
conn, address = s.accept()
dataheaders = conn.recv(4096)
doHandShake(conn, dataheaders)
print "WebSocket open"
threading.Thread(target=handle, args=(conn,)).start()
except KeyboardInterrupt:
print
print "Closing now"
exit(0)

View File

@@ -3,8 +3,8 @@
<target name="websocket_server">
<root all_classes="true"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/.svn$</exclude>
<exclude>/\.git$</exclude>
<exclude>/\.svn$</exclude>
<exclude>/CVS$</exclude>
<exclude>/EIFGENs$</exclude>
</file_rule>