httpparser

package
v0.0.0-...-a79c061 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2018 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version = "HTTP/1.1"
	Delim   = "\r\n"

	MethodGet    = "GET"
	MethodPost   = "POST"
	MethodPut    = "PUT"
	MethodDelete = "DELETE"

	StatusOK                  = "200 OK"
	StatusBadRequest          = "400 Bad Request"
	StatusNotFound            = "404 Not Found"
	StatusConflict            = "409 Conflict"
	StatusInternalServerError = "500 Internal Server Error"

	ContentTypeResHeader   = "Content-Type: "
	ContentLengthResHeader = "Content-Length: "
	ConnectionHeader       = "Connection: Close"

	JSONContentType = "application/json"
)

Variables

This section is empty.

Functions

func GetContentLength

func GetContentLength(s string) int

func GetMethod

func GetMethod(s string) string

func GetURI

func GetURI(s string) string

Types

type HttpFrame

type HttpFrame struct {
	Raw    string
	Header HttpHeader
	Body   []byte
}

func (HttpFrame) IsValid

func (hh HttpFrame) IsValid() bool

type HttpHeader

type HttpHeader struct {
	Status        string
	Method        string
	URI           string
	ContentType   string
	ContentLength int
}

func GetHeader

func GetHeader(s string) HttpHeader

type HttpResponse

type HttpResponse struct {
	Status        string
	ContentType   string
	ContentLength int
	Body          []byte
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL