mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-05 09:30:26 +08:00
29 lines
618 B
Go
29 lines
618 B
Go
|
|
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)))
|
||
|
|
}
|