8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/hyla/websocket.rb', line 8
def dispatch(data)
parser = Http::Parser.new
parser << data
if parser.http_method != 'GET' || parser.upgrade?
super elsif parser.request_path == '/livereload.js'
_serve_file(_livereload_js_file)
elsif File.exist?(parser.request_path[1..-1])
_serve_file(parser.request_path[1..-1]) else
send_data("HTTP/1.1 404 Not Found\r\nContent-Type: text/plain\r\nContent-Length: 13\r\n\r\n404 Not Found")
close_connection_after_writing
end
end
|