mirror of
https://github.com/lloeki/nanoserve.git
synced 2025-12-06 11:14:40 +01:00
Factor end of headers processing in
This commit is contained in:
parent
803d910a3e
commit
df5525854e
1 changed files with 5 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue