Documentation
¶
Index ¶
Constants ¶
View Source
const ( // status code and text StatusOK = 200 StatusOKText = "OK" StatusMovedPermanently = 301 StatusMovedPermanentlyText = "Moved permanently" StatusBadRequest = 400 StatusBadRequestText = "Bad request" StatusNotFound = 404 StatusNotFoundText = "Not found" StatusInternalServerError = 500 StatusInternalServerErrorText = "Internal Server Error" // receive buffer size RecvBufSize = 1024 // receive timeout RecvTimeout time.Duration = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func DirIndexHTML ¶
DirIndexHTML() lists the files and directories contained in the given directory, returns a generated html string.
Types ¶
type InvalidRequestError ¶
func (*InvalidRequestError) Error ¶
func (e *InvalidRequestError) Error() string
type Request ¶
type Response ¶
type Response struct {
Proto string
StatusCode int
StatusText string
Headers map[string]string
Body string
}
func ResponseInternalServerError ¶
500 Internal Server Error
func ResponseMovedPermanently ¶
301 Moved Permanently
type Server ¶
type Server struct {
// Addr specifies the TCP address for the server to listen on,
// in the form "host:port". It shall be passed to net.Listen()
// during ListenAndServe().
Addr string // e.g. ":0"
// VirtualHosts contains a mapping from host name to the docRoot path
// (i.e. the path to the directory to serve static files from) for
// all virtual hosts that this server supports
VirtualHosts map[string]string
}
func (*Server) ListenAndServe ¶
ListenAndServe listens on the TCP network address s.Addr and then handles requests on incoming connections.
Click to show internal directories.
Click to hide internal directories.