mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-20 06:28:59 +00:00
rtl8720dn: add examples/rtl8720dn/webserver
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
|
||||
"golang.org/x/net/http/httpguts"
|
||||
)
|
||||
|
||||
// msg is *Request or *Response.
|
||||
func readTransfer(msg *Request, r *bufio.Reader) (err error) {
|
||||
// TODO:
|
||||
return nil
|
||||
}
|
||||
|
||||
// Determine whether to hang up after sending a request and body, or
|
||||
// receiving a response and body
|
||||
// 'header' is the request headers
|
||||
func shouldClose(major, minor int, header Header, removeCloseHeader bool) bool {
|
||||
if major < 1 {
|
||||
return true
|
||||
}
|
||||
|
||||
conv := header["Connection"]
|
||||
hasClose := httpguts.HeaderValuesContainsToken(conv, "close")
|
||||
if major == 1 && minor == 0 {
|
||||
return hasClose || !httpguts.HeaderValuesContainsToken(conv, "keep-alive")
|
||||
}
|
||||
|
||||
if hasClose && removeCloseHeader {
|
||||
header.Del("Connection")
|
||||
}
|
||||
|
||||
return hasClose
|
||||
}
|
||||
Reference in New Issue
Block a user