实现HTTP部分功能

This commit is contained in:
刘祥超
2020-09-26 08:07:07 +08:00
parent 8aeebab4de
commit c34459db16
39 changed files with 1960 additions and 230 deletions

View File

@@ -0,0 +1,28 @@
package nodes
import (
"net/http"
)
func (this *HTTPRequest) writeNotFoundError() {
if this.doPage(http.StatusNotFound) {
return
}
this.processResponseHeaders(http.StatusNotFound)
msg := "404 page not found: '" + this.RawURI() + "'"
this.writer.WriteHeader(http.StatusNotFound)
_, _ = this.writer.Write([]byte(msg))
}
func (this *HTTPRequest) writeInternalServerError() {
statusCode := http.StatusInternalServerError
if this.doPage(statusCode) {
return
}
this.processResponseHeaders(statusCode)
this.writer.WriteHeader(statusCode)
_, _ = this.writer.Write([]byte(http.StatusText(statusCode)))
}