Documentation ¶
Index ¶
Constants ¶
const ( INFO_CONTINUE = 100 INFO_SWITCHING_PROTOCOL = 101 INFO_PROCESSING = 102 SUCCESS_OK = 200 SUCCESS_CREATED = 201 SUCCESS_ACCEPTED = 202 SUCCESS_NON_AUTHORITATIVE = 203 SUCCESS_NO_CONTENT = 204 SUCCESS_RESET_CONTENT = 205 SUCCESS_PARTIAL_CONTENT = 206 SUCCESS_MULTI_STATUS = 207 REDIRECTION_MULTIPLE_CHOICES = 300 REDIRECTION_MOVED_PERMANENTLY = 301 REDIRECTION_MOVED_TEMPORARILY = 302 REDIRECTION_SEE_OTHER = 303 REDIRECTION_NOT_MODIFIED = 304 REDIRECTION_USE_PROXY = 305 REDIRECTION_TEMPORARY_REDIRECT = 307 CLIENT_ERROR_BAD_REQUEST = 400 CLIENT_ERROR_UNAUTHORIZED = 401 CLIENT_ERROR_PAYMENT_REQUIRED = 402 CLIENT_ERROR_FORBIDDEN = 403 CLIENT_ERROR_NOT_FOUND = 404 CLIENT_ERROR_METHOD_NOT_ALLOWED = 405 CLIENT_ERROR_NOT_ACCEPTABLE = 406 CLIENT_ERROR_PROXY_AUTHENTIFICATION_REQUIRED = 407 CLIENT_ERROR_REQUEST_TIMEOUT = 408 CLIENT_ERROR_CONFLICT = 409 CLIENT_ERROR_GONE = 410 CLIENT_ERROR_LENGTH_REQUIRED = 411 CLIENT_ERROR_PRECONDITION_FAILED = 412 CLIENT_ERROR_REQUEST_ENTITY_TOO_LARGE = 413 CLIENT_ERROR_REQUEST_URI_TOO_LONG = 414 CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE = 415 CLIENT_ERROR_REQUESTED_RANGE_NOT_SATISFIABLE = 416 CLIENT_ERROR_EXPECTATION_FAILED = 417 CLIENT_ERROR_UNPROCESSABLE_ENTITY = 422 CLIENT_ERROR_LOCKED = 423 CLIENT_ERROR_FAILED_DEPENDENCY = 424 SERVER_ERROR_INTERNAL = 500 SERVER_ERROR_NOT_IMPLEMENTED = 501 SERVER_ERROR_BAD_GATEWAY = 502 SERVER_ERROR_SERVICE_UNAVAILABLE = 503 SERVER_ERROR_GATEWAY_TIMEOUT = 504 SERVER_ERROR_HTTP_VERSION_NOT_SUPPORTED = 505 SERVER_ERROR_INSUFFICIENT_STORAGE = 507 )
const NewLine = "\r\n"
Variables ¶
var ( HTTP_1_0 = Version{Major: 1, Minor: 0} HTTP_1_1 = Version{Major: 1, Minor: 1} )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { WriteRequest(*Request) error ReadResponse(forceReadAll bool) (*Response, error) }
Client represents a single connection to a http server. Client obeys KeepAlive conditions for HTTP but connection pooling is expected to be handled at a higher layer.
func NewClient ¶
func NewClient(rw io.ReadWriter) Client
NewClient returns a Client implementation which uses rw to communicate.
type Request ¶
type Request struct { RawBytes []byte AutomaticContentLength bool AutomaticHost bool Method string Path string Query []string Version Headers []Header Body io.Reader }
Request represents a complete HTTP request.
func (*Request) ContentLength ¶
ContentLength returns the length of the body. If the body length is not known ContentLength will return -1.
type Response ¶
Response represents an RFC2616 response.
func (*Response) CloseRequested ¶
CloseRequested returns if Reason includes a Connection: close header.
func (*Response) ContentLength ¶
ContentLength returns the length of the body. If the body length is not known ContentLength will return -1.
func (*Response) TransferEncoding ¶
TransferEncoding returns the transfer encoding this message was transmitted with. If not is specified by the sender, "identity" is assumed.
type Status ¶
Status represents an HTTP status code.