Factor end of headers processing in

This commit is contained in:
Loic Nageleisen 2017-09-19 13:59:29 +02:00
parent 803d910a3e
commit df5525854e

View file

@ -65,9 +65,9 @@ module NanoServe
buf = +''
loop do
line = conn.readline
break if line.chomp == ''
req << line
buf << line if logger.debug?
break if req.headers?
end
logger.debug "request:\n" + buf.gsub(/^/, ' ')
@ -104,6 +104,10 @@ module NanoServe
end
end
def headers?
@sep
end
REQ_RE = %r{(?<method>[A-Z]+)\s+(?<path>\S+)\s+(?<version>HTTP/\d+.\d+)$}
def parse_request(str)