Involved Source Files Package internal contains HTTP internals shared by net/http and
net/http/httputil.
Package-Level Type Names (total 3, in which 1 is exported)
/* sort exporteds by: | */
FlushAfterChunkWriter signals from the caller of NewChunkedWriter
that each chunk should be followed by a flush. It is used by the
http.Transport code to keep the buffering behavior for headers and
trailers, but flush out chunks aggressively in the middle for
request bodies which may be generated slowly. See Issue 6574.Writer*bufio.WriterWriter.buf[]byteWriter.errerrorWriter.nintWriter.wrio.Writer Available returns how many bytes are unused in the buffer. AvailableBuffer returns an empty buffer with b.Available() capacity.
This buffer is intended to be appended to and
passed to an immediately succeeding Write call.
The buffer is only valid until the next write operation on b. Buffered returns the number of bytes that have been written into the current buffer. Flush writes any buffered data to the underlying io.Writer. ReadFrom implements io.ReaderFrom. If the underlying writer
supports the ReadFrom method, this calls the underlying ReadFrom.
If there is buffered data and an underlying ReadFrom, this fills
the buffer and writes it before calling ReadFrom. Reset discards any unflushed buffered data, clears any error, and
resets b to write its output to w.
Calling Reset on the zero value of Writer initializes the internal buffer
to the default size.
Calling w.Reset(w) (that is, resetting a Writer to itself) does nothing. Size returns the size of the underlying buffer in bytes. Write writes the contents of p into the buffer.
It returns the number of bytes written.
If nn < len(p), it also returns an error explaining
why the write is short. WriteByte writes a single byte. WriteRune writes a single Unicode code point, returning
the number of bytes written and any error. WriteString writes a string.
It returns the number of bytes written.
If the count is less than len(s), it also returns an error explaining
why the write is short.
FlushAfterChunkWriter : internal/bisect.Writer
FlushAfterChunkWriter : io.ByteWriter
FlushAfterChunkWriter : io.ReaderFrom
FlushAfterChunkWriter : io.StringWriter
FlushAfterChunkWriter : io.Writer
FlushAfterChunkWriter : net/http.http2stringWriter
FlushAfterChunkWriter : crypto/tls.transcriptHash
Writing to chunkedWriter translates to writing in HTTP chunked Transfer
Encoding wire format to the underlying Wire chunkedWriter.Wireio.Writer(*chunkedWriter) Close() error Write the contents of data as one chunk to Wire.
NOTE: Note that the corresponding chunk-writing procedure in Conn.Write has
a bug since it does not check for success of io.WriteString
*chunkedWriter : internal/bisect.Writer
*chunkedWriter : io.Closer
*chunkedWriter : io.WriteCloser
*chunkedWriter : io.Writer
*chunkedWriter : crypto/tls.transcriptHash
Package-Level Functions (total 7, in which 2 are exported)
NewChunkedReader returns a new chunkedReader that translates the data read from r
out of HTTP "chunked" format before returning it.
The chunkedReader returns io.EOF when the final 0-length chunk is read.
NewChunkedReader is not needed by normal applications. The http package
automatically decodes chunking when reading response bodies.
NewChunkedWriter returns a new chunkedWriter that translates writes into HTTP
"chunked" format before writing them to w. Closing the returned chunkedWriter
sends the final 0-length chunk that marks the end of the stream but does
not send the final CRLF that appears after trailers; trailers and the last
CRLF must be written separately.
NewChunkedWriter is not needed by normal applications. The http
package adds chunking automatically if handlers don't set a
Content-Length header. Using newChunkedWriter inside a handler
would result in double chunking or chunking with a Content-Length
length, both of which are wrong.
Read a line of bytes (up to \n) from b.
Give up if the line exceeds maxLineLength.
The returned bytes are owned by the bufio.Reader
so they are only valid until the next bufio read.
removeChunkExtension removes any chunk-extension from p.
For example,
"0" => "0"
"0;token" => "0"
"0;token=val" => "0"
`0;token="quoted string"` => "0"
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.