2020-09-26 08:07:07 +08:00
|
|
|
package nodes
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"net/http"
|
|
|
|
|
)
|
|
|
|
|
|
2020-09-26 11:22:21 +08:00
|
|
|
func (this *HTTPRequest) write404() {
|
2020-09-26 08:07:07 +08:00
|
|
|
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))
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-27 15:26:06 +08:00
|
|
|
func (this *HTTPRequest) write500(err error) {
|
|
|
|
|
if err != nil {
|
|
|
|
|
this.addError(err)
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-26 08:07:07 +08:00
|
|
|
statusCode := http.StatusInternalServerError
|
|
|
|
|
if this.doPage(statusCode) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.processResponseHeaders(statusCode)
|
|
|
|
|
this.writer.WriteHeader(statusCode)
|
|
|
|
|
_, _ = this.writer.Write([]byte(http.StatusText(statusCode)))
|
|
|
|
|
}
|