Add Etag support (#151)

* Add Etag support

* small tweak
This commit is contained in:
Brahim Hadriche authored and GitHub committed 2023-09-23 18:22:23 -04:00
1 parent dab6dc5bc4
commit c5680f7b06
10 files changed
+222 -118

No files matched your search

@@ -24,10 +24,6 @@ namespace Http
private state = Http.HttpRequestState.INIT
private id = 0
' copied members
private range_begin = 0
private range_end = 0
private range_begin_given = false
private range_end_given = false
private ready_for_response = false
function new()
@@ -197,7 +193,6 @@ namespace Http
end function
function ProcessHeaders(connection as HttpConnection)
m.ParseRange()
m.ParseConnection(connection)
end function
@@ -212,28 +207,6 @@ namespace Http
end if
end function
' TODO:P2 this function does not take into account multiple ranges.
function ParseRange()
range = m.headers.range
if range <> invalid
endpoints = lcase(range).tokenize("=")
if endpoints.count() = 2 and endpoints.GetHead() = "bytes"
range = endpoints.GetTail().Trim()
hyphen = range.instr("-")
if hyphen > 0
m.range_begin = strtoi(range.left(hyphen))
m.range_begin_given = true
end if
last = range.len() - 1
if hyphen < last
m.range_end = strtoi(range.right(last - hyphen))
m.range_end_given = true
end if
end if
LogInfo("range request begin" + Stri(m.range_begin) + " end" + Stri(m.range_end))
end if
end function
function ParseConnection(connection as HttpConnection)
connectionStr = m.headers.connection
if connectionStr <> invalid