Documentation
¶
Index ¶
- func GetRequest(ctx *appcontext.RequestContext) (*http.Request, error)
- type BufferedConn
- type Hijacker
- type ReadHandler
- type ResponseWriter
- func (w *ResponseWriter) CloseNotify() <-chan bool
- func (w *ResponseWriter) EnableFullDuplex() error
- func (w *ResponseWriter) EndResponse() error
- func (w *ResponseWriter) Flush()
- func (w *ResponseWriter) Header() http.Header
- func (w *ResponseWriter) HeaderSent() bool
- func (w *ResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
- func (w *ResponseWriter) Hijacked() bool
- func (w *ResponseWriter) ReadFrom(r io.Reader) (n int64, err error)
- func (w *ResponseWriter) Release()
- func (w *ResponseWriter) SetReadDeadline(deadline time.Time) error
- func (w *ResponseWriter) SetReadHandler(h ReadHandler)
- func (w *ResponseWriter) SetWriteDeadline(deadline time.Time) error
- func (w *ResponseWriter) Trailer() http.Header
- func (w *ResponseWriter) Unwrap() http.ResponseWriter
- func (w *ResponseWriter) Write(p []byte) (int, error)
- func (w *ResponseWriter) WriteHeader(statusCode int)
- func (w *ResponseWriter) WriteString(s string) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRequest ¶
func GetRequest(ctx *appcontext.RequestContext) (*http.Request, error)
GetRequest parses the HTTP request from the netpoll connection. GetRequest는 netpoll 연결에서 HTTP 요청을 파싱합니다.
Types ¶
type BufferedConn ¶
type BufferedConn struct {
netpoll.Connection
Reader *bufio.Reader
}
BufferedConn wraps netpoll.Connection and a bufio.Reader. It ensures that reads go through the bufio.Reader to avoid data loss if the library using the connection bypasses the bufio.ReadWriter. BufferedConn은 netpoll.Connection과 bufio.Reader를 래핑합니다. 연결을 사용하는 라이브러리가 bufio.ReadWriter를 우회하여 읽을 경우 데이터 손실을 방지하기 위해 읽기 작업이 bufio.Reader를 통해 이루어지도록 합니다.
type Hijacker ¶
type Hijacker interface {
Hijack() (net.Conn, *bufio.ReadWriter, error)
SetReadHandler(handler ReadHandler)
}
Hijacker is an interface that allows taking over the connection and setting a custom read handler. Hijacker는 연결 제어권을 가져와 사용자 정의 읽기 핸들러를 설정할 수 있는 인터페이스입니다.
type ReadHandler ¶
type ReadHandler func(conn net.Conn, rw *bufio.ReadWriter) error
ReadHandler is a function type for handling custom connection reads (e.g., WebSocket).
type ResponseWriter ¶
type ResponseWriter struct {
// contains filtered or unexported fields
}
ResponseWriter implements http.ResponseWriter and wraps netpoll connection. ResponseWriter는 http.ResponseWriter 인터페이스를 구현하며 netpoll 연결을 래핑합니다.
func NewResponseWriter ¶
func NewResponseWriter(ctx *appcontext.RequestContext, req *http.Request) *ResponseWriter
NewResponseWriter retrieves a ResponseWriter from the pool and initializes it. NewResponseWriter는 풀에서 ResponseWriter를 가져와 초기화합니다.
func (*ResponseWriter) CloseNotify ¶
func (w *ResponseWriter) CloseNotify() <-chan bool
CloseNotify implements http.CloseNotifier. It returns a channel that receives a value when the client connection has gone away. Deprecated: Use context.Context from http.Request instead. CloseNotify는 http.CloseNotifier를 구현합니다. 클라이언트 연결이 끊어지면 값을 수신하는 채널을 반환합니다. Deprecated: 대신 http.Request의 context.Context를 사용하세요.
func (*ResponseWriter) EnableFullDuplex ¶
func (w *ResponseWriter) EnableFullDuplex() error
EnableFullDuplex indicates that the request handler will read from the request body concurrently with writing the response body. Supported by http.ResponseController (Go 1.21+). EnableFullDuplex는 요청 핸들러가 응답 본문을 쓰는 것과 동시에 요청 본문에서 읽을 것임을 나타냅니다. http.ResponseController(Go 1.21+)에서 지원됩니다.
func (*ResponseWriter) EndResponse ¶
func (w *ResponseWriter) EndResponse() error
EndResponse serializes and writes the HTTP response to the connection. EndResponse는 HTTP 응답을 직렬화하여 연결에 씁니다.
func (*ResponseWriter) Flush ¶
func (w *ResponseWriter) Flush()
Flush sends any buffered data to the client. Flush는 버퍼링된 모든 데이터를 클라이언트로 전송합니다. This will flush the underlying bufio.Writer. 이는 기반의 bufio.Writer를 플러시합니다.
func (*ResponseWriter) Header ¶
func (w *ResponseWriter) Header() http.Header
func (*ResponseWriter) HeaderSent ¶
func (w *ResponseWriter) HeaderSent() bool
HeaderSent returns whether the headers have already been sent. HeaderSent는 헤더가 이미 전송되었는지 여부를 반환합니다.
func (*ResponseWriter) Hijack ¶
func (w *ResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
Hijack lets the caller take over the connection. Hijack은 호출자가 연결 제어권을 가져가도록 합니다.
func (*ResponseWriter) Hijacked ¶
func (w *ResponseWriter) Hijacked() bool
Hijacked returns whether the connection has been hijacked. Hijacked는 연결이 하이재킹되었는지 여부를 반환합니다.
func (*ResponseWriter) ReadFrom ¶
func (w *ResponseWriter) ReadFrom(r io.Reader) (n int64, err error)
ReadFrom implements io.ReaderFrom. ReadFrom은 io.ReaderFrom 인터페이스를 구현합니다. It uses copyBufPool to read data and writes directly to bufWriter. copyBufPool을 사용하여 데이터를 읽고 bufWriter에 직접 씀으로써 메모리 사용량과 복사를 최소화합니다.
func (*ResponseWriter) Release ¶
func (w *ResponseWriter) Release()
Release returns the ResponseWriter and its resources to their respective pools. Release는 ResponseWriter와 해당 리소스들을 각각의 풀로 반환합니다.
func (*ResponseWriter) SetReadDeadline ¶
func (w *ResponseWriter) SetReadDeadline(deadline time.Time) error
SetReadDeadline sets the read deadline on the underlying connection. Supported by http.ResponseController (Go 1.20+). SetReadDeadline은 기본 연결에 대한 읽기 마감 시간을 설정합니다. http.ResponseController(Go 1.20+)에서 지원됩니다.
func (*ResponseWriter) SetReadHandler ¶
func (w *ResponseWriter) SetReadHandler(h ReadHandler)
SetReadHandler sets the custom read handler for the connection. SetReadHandler는 연결에 대한 사용자 정의 읽기 핸들러를 설정합니다.
func (*ResponseWriter) SetWriteDeadline ¶
func (w *ResponseWriter) SetWriteDeadline(deadline time.Time) error
SetWriteDeadline sets the write deadline on the underlying connection. Supported by http.ResponseController (Go 1.20+). SetWriteDeadline은 기본 연결에 대한 쓰기 마감 시간을 설정합니다. http.ResponseController(Go 1.20+)에서 지원됩니다.
func (*ResponseWriter) Trailer ¶
func (w *ResponseWriter) Trailer() http.Header
Trailer returns the trailer map that will be sent by EndResponse. Trailer는 EndResponse에 의해 전송될 트레일러 맵을 반환합니다.
func (*ResponseWriter) Unwrap ¶
func (w *ResponseWriter) Unwrap() http.ResponseWriter
Unwrap returns the underlying ResponseWriter. Since this is the root writer, it returns nil. Unwrap은 기반 ResponseWriter를 반환합니다. 이 객체가 루트이므로 nil을 반환합니다.
func (*ResponseWriter) Write ¶
func (w *ResponseWriter) Write(p []byte) (int, error)
Write writes the data to the connection as part of an HTTP reply. Write는 HTTP 응답의 일부로 데이터를 연결에 씁니다.
func (*ResponseWriter) WriteHeader ¶
func (w *ResponseWriter) WriteHeader(statusCode int)
WriteHeader sends an HTTP response header with the provided status code. WriteHeader는 제공된 상태 코드로 HTTP 응답 헤더를 전송합니다.
func (*ResponseWriter) WriteString ¶
func (w *ResponseWriter) WriteString(s string) (int, error)
WriteString implements io.StringWriter. It optimizes writing strings without converting to byte slice. WriteString은 io.StringWriter를 구현합니다. 바이트 슬라이스로 변환하지 않고 문자열 쓰기를 최적화합니다.