Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
提交
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions alpn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (

tls "github.com/bogdanfinn/utls"

. "github.com/bogdanfinn/fhttp"
"github.com/bogdanfinn/fhttp/httptest"
. "github.com/kernel/fhttp"
"github.com/kernel/fhttp/httptest"
)

func TestNextProtoUpgrade(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cgi/child.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

tls "github.com/bogdanfinn/utls"

http "github.com/bogdanfinn/fhttp"
http "github.com/kernel/fhttp"
)

// Request returns the HTTP request as represented in the current
Expand Down
2 changes: 1 addition & 1 deletion cgi/child_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"strings"
"testing"

http "github.com/bogdanfinn/fhttp"
http "github.com/kernel/fhttp"
)

func TestRequest(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cgi/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"strconv"
"strings"

http "github.com/bogdanfinn/fhttp"
http "github.com/kernel/fhttp"

"golang.org/x/net/http/httpguts"
)
Expand Down
4 changes: 2 additions & 2 deletions cgi/host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"testing"
"time"

http "github.com/bogdanfinn/fhttp"
"github.com/bogdanfinn/fhttp/httptest"
http "github.com/kernel/fhttp"
"github.com/kernel/fhttp/httptest"
)

func newRequest(httpreq string) *http.Request {
Expand Down
6 changes: 3 additions & 3 deletions cgi/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
"testing"
"time"

http "github.com/bogdanfinn/fhttp"
"github.com/bogdanfinn/fhttp/httptest"
"github.com/bogdanfinn/fhttp/internal/testenv"
http "github.com/kernel/fhttp"
"github.com/kernel/fhttp/httptest"
"github.com/kernel/fhttp/internal/testenv"
)

// This test is a CGI host (testing host.go) that runs its own binary
Expand Down
6 changes: 3 additions & 3 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import (

tls "github.com/bogdanfinn/utls"

. "github.com/bogdanfinn/fhttp"
"github.com/bogdanfinn/fhttp/cookiejar"
"github.com/bogdanfinn/fhttp/httptest"
. "github.com/kernel/fhttp"
"github.com/kernel/fhttp/cookiejar"
"github.com/kernel/fhttp/httptest"
)

var robotsTxtHandler = HandlerFunc(func(w ResponseWriter, r *Request) {
Expand Down
6 changes: 3 additions & 3 deletions clientserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import (

tls "github.com/bogdanfinn/utls"

. "github.com/bogdanfinn/fhttp"
"github.com/bogdanfinn/fhttp/httptest"
"github.com/bogdanfinn/fhttp/httputil"
. "github.com/kernel/fhttp"
"github.com/kernel/fhttp/httptest"
"github.com/kernel/fhttp/httputil"
)

type clientServerTest struct {
Expand Down
2 changes: 1 addition & 1 deletion cookiejar/dummy_publicsuffix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package cookiejar_test

import "github.com/bogdanfinn/fhttp/cookiejar"
import "github.com/kernel/fhttp/cookiejar"

type dummypsl struct {
List cookiejar.PublicSuffixList
Expand Down
6 changes: 3 additions & 3 deletions cookiejar/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"log"
"net/url"

http "github.com/bogdanfinn/fhttp"
"github.com/bogdanfinn/fhttp/cookiejar"
"github.com/bogdanfinn/fhttp/httptest"
http "github.com/kernel/fhttp"
"github.com/kernel/fhttp/cookiejar"
"github.com/kernel/fhttp/httptest"
)

func Example新建() {
Expand Down
2 changes: 1 addition & 1 deletion cookiejar/jar.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"sync"
"time"

http "github.com/bogdanfinn/fhttp"
http "github.com/kernel/fhttp"
)

// PublicSuffixList provides the public suffix of a domain. For example:
Expand Down
2 changes: 1 addition & 1 deletion cookiejar/jar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"testing"
"time"

http "github.com/bogdanfinn/fhttp"
http "github.com/kernel/fhttp"
)

// tNow is the synthetic current time used as now during testing.
Expand Down
4 changes: 2 additions & 2 deletions example_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (

tls "github.com/bogdanfinn/utls"

http "github.com/bogdanfinn/fhttp"
"github.com/bogdanfinn/fhttp/http2"
http "github.com/kernel/fhttp"
"github.com/kernel/fhttp/http2"
)

// Basic http test with Header Order + enable push
Expand Down
2 changes: 1 addition & 1 deletion example_filesystem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"log"
"strings"

http "github.com/bogdanfinn/fhttp"
http "github.com/kernel/fhttp"
)

// containsDotFile reports whether name contains a path element starting with a period.
Expand Down
2 changes: 1 addition & 1 deletion example_handle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"log"
"sync"

http "github.com/bogdanfinn/fhttp"
http "github.com/kernel/fhttp"
)

type countHandler struct {
Expand Down
2 changes: 1 addition & 1 deletion example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"os"
"os/signal"

http "github.com/bogdanfinn/fhttp"
http "github.com/kernel/fhttp"
)

func ExampleHijacker() {
Expand Down
4 changes: 2 additions & 2 deletions fcgi/child.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"sync"
"time"

http "github.com/bogdanfinn/fhttp"
"github.com/bogdanfinn/fhttp/cgi"
http "github.com/kernel/fhttp"
"github.com/kernel/fhttp/cgi"
)

// request holds the state for an in-progress request. As soon as it's complete,
Expand Down
2 changes: 1 addition & 1 deletion fcgi/fcgi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"strings"
"testing"

http "github.com/bogdanfinn/fhttp"
http "github.com/kernel/fhttp"
)

var sizeTests = []struct {
Expand Down
4 changes: 2 additions & 2 deletions fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
"testing"
"time"

. "github.com/bogdanfinn/fhttp"
"github.com/bogdanfinn/fhttp/httptest"
. "github.com/kernel/fhttp"
"github.com/kernel/fhttp/httptest"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/bogdanfinn/fhttp
module github.com/kernel/fhttp

go 1.24.1

Expand Down
6 changes: 3 additions & 3 deletions h2_bundle.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion header.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"sync"
"time"

"github.com/bogdanfinn/fhttp/httptrace"
"github.com/kernel/fhttp/httptrace"
)

// A Header represents the Key-value pairs in an HTTP header.
Expand Down
2 changes: 1 addition & 1 deletion header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"testing"
"time"

"github.com/bogdanfinn/fhttp/internal/race"
"github.com/kernel/fhttp/internal/race"
)

var headerWriteTests = []struct {
Expand Down
2 changes: 1 addition & 1 deletion http.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:generate bundle -o=h2_bundle.go -prefix=http2 -tags=!nethttpomithttp2 github.com/bogdanfinn/fhttp/http2
//go:generate bundle -o=h2_bundle.go -prefix=http2 -tags=!nethttpomithttp2 github.com/kernel/fhttp/http2

package http

Expand Down
2 changes: 1 addition & 1 deletion http2/client_conn_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

tls "github.com/bogdanfinn/utls"

http "github.com/bogdanfinn/fhttp"
http "github.com/kernel/fhttp"
)

// ClientConnPool manages a pool of HTTP/2 client connections.
Expand Down
8 changes: 4 additions & 4 deletions http2/fhttp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import (
"strings"
"testing"

"github.com/bogdanfinn/fhttp/cookiejar"
"github.com/bogdanfinn/fhttp/httptest"
"github.com/kernel/fhttp/cookiejar"
"github.com/kernel/fhttp/httptest"
tls "github.com/bogdanfinn/utls"
"golang.org/x/net/publicsuffix"

http "github.com/bogdanfinn/fhttp"
"github.com/bogdanfinn/fhttp/http2"
http "github.com/kernel/fhttp"
"github.com/kernel/fhttp/http2"
)

// Tests if connection settings are written correctly
Expand Down
68 changes: 68 additions & 0 deletions http2/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,71 @@ func (f *flow) add(n int32) bool {
}
return false
}

// inflowMinRefresh is the minimum number of bytes we'll send for a
// flow control window update.
const inflowMinRefresh = 4 << 10

// inflow accounts for an inbound flow control window.
// It tracks both the latest window sent to the peer (used for enforcement)
// and the accumulated unsent window.
type inflow struct {
avail int32
unsent int32
}

// init sets the initial window.
func (f *inflow) init(n int32) {
f.avail = n
}

// add adds n bytes to the window, with a maximum window size of max,
// indicating that the peer can now send us more data.
// For example, the user read from a {Request,Response} body and consumed
// some of the buffered data, so the peer can now send more.
// It returns the number of bytes to send in a WINDOW_UPDATE frame to the peer.
// Window updates are accumulated and sent when the unsent capacity
// is at least inflowMinRefresh or will at least double the peer's available window.
func (f *inflow) add(n int) (connAdd int32) {
if n < 0 {
panic("negative update")
}
unsent := int64(f.unsent) + int64(n)
// "A sender MUST NOT allow a flow-control window to exceed 2^31-1 octets."
// RFC 7540 Section 6.9.1.
const maxWindow = 1<<31 - 1
if unsent+int64(f.avail) > maxWindow {
panic("flow control update exceeds maximum window size")
}
f.unsent = int32(unsent)
if f.unsent < inflowMinRefresh && f.unsent < f.avail {
// If there aren't at least inflowMinRefresh bytes of window to send,
// and this update won't at least double the window, buffer the update for later.
return 0
}
f.avail += f.unsent
f.unsent = 0
return int32(unsent)
}

// take attempts to take n bytes from the peer's flow control window.
// It reports whether the window has available capacity.
func (f *inflow) take(n uint32) bool {
if n > uint32(f.avail) {
return false
}
f.avail -= int32(n)
return true
}

// takeInflows attempts to take n bytes from two inflows,
// typically connection-level and stream-level flows.
// It reports whether both windows have available capacity.
func takeInflows(f1, f2 *inflow, n uint32) bool {
if n > uint32(f1.avail) || n > uint32(f2.avail) {
return false
}
f1.avail -= int32(n)
f2.avail -= int32(n)
return true
}
2 changes: 1 addition & 1 deletion http2/frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"strings"
"sync"

"github.com/bogdanfinn/fhttp/http2/hpack"
"github.com/kernel/fhttp/http2/hpack"
"golang.org/x/net/http/httpguts"
)

Expand Down
2 changes: 1 addition & 1 deletion http2/frame_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"testing"
"unsafe"

"github.com/bogdanfinn/fhttp/http2/hpack"
"github.com/kernel/fhttp/http2/hpack"
)

func testFramer() (*Framer, *bytes.Buffer) {
Expand Down
2 changes: 1 addition & 1 deletion http2/go111.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package http2
import (
"net/textproto"

"github.com/bogdanfinn/fhttp/httptrace"
"github.com/kernel/fhttp/httptrace"
)

func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool {
Expand Down
6 changes: 3 additions & 3 deletions http2/h2c/h2c.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
"os"
"strings"

http "github.com/bogdanfinn/fhttp"
"github.com/bogdanfinn/fhttp/http2"
"github.com/bogdanfinn/fhttp/http2/hpack"
http "github.com/kernel/fhttp"
"github.com/kernel/fhttp/http2"
"github.com/kernel/fhttp/http2/hpack"
"golang.org/x/net/http/httpguts"
)

Expand Down
4 changes: 2 additions & 2 deletions http2/h2c/h2c_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"log"
"testing"

http "github.com/bogdanfinn/fhttp"
"github.com/bogdanfinn/fhttp/http2"
http "github.com/kernel/fhttp"
"github.com/kernel/fhttp/http2"
)

func Test设置AckSwallowWriter(t *testing.T) {
Expand Down
Loading