mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 23:22:26 -05:00 
			
		
		
		
	[chore]: Bump golang.org/x/oauth2 from 0.10.0 to 0.11.0 (#2076)
This commit is contained in:
		
					parent
					
						
							
								cc69250bbe
							
						
					
				
			
			
				commit
				
					
						303a6a6b1d
					
				
			
		
					 6 changed files with 63 additions and 19 deletions
				
			
		
							
								
								
									
										35
									
								
								vendor/golang.org/x/net/http2/transport.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										35
									
								
								vendor/golang.org/x/net/http2/transport.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -19,6 +19,7 @@ import ( | |||
| 	"io/fs" | ||||
| 	"log" | ||||
| 	"math" | ||||
| 	"math/bits" | ||||
| 	mathrand "math/rand" | ||||
| 	"net" | ||||
| 	"net/http" | ||||
|  | @ -518,11 +519,14 @@ func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) { | |||
| func authorityAddr(scheme string, authority string) (addr string) { | ||||
| 	host, port, err := net.SplitHostPort(authority) | ||||
| 	if err != nil { // authority didn't have a port | ||||
| 		host = authority | ||||
| 		port = "" | ||||
| 	} | ||||
| 	if port == "" { // authority's port was empty | ||||
| 		port = "443" | ||||
| 		if scheme == "http" { | ||||
| 			port = "80" | ||||
| 		} | ||||
| 		host = authority | ||||
| 	} | ||||
| 	if a, err := idna.ToASCII(host); err == nil { | ||||
| 		host = a | ||||
|  | @ -1677,7 +1681,27 @@ func (cs *clientStream) frameScratchBufferLen(maxFrameSize int) int { | |||
| 	return int(n) // doesn't truncate; max is 512K | ||||
| } | ||||
| 
 | ||||
| var bufPool sync.Pool // of *[]byte | ||||
| // Seven bufPools manage different frame sizes. This helps to avoid scenarios where long-running | ||||
| // streaming requests using small frame sizes occupy large buffers initially allocated for prior | ||||
| // requests needing big buffers. The size ranges are as follows: | ||||
| // {0 KB, 16 KB], {16 KB, 32 KB], {32 KB, 64 KB], {64 KB, 128 KB], {128 KB, 256 KB], | ||||
| // {256 KB, 512 KB], {512 KB, infinity} | ||||
| // In practice, the maximum scratch buffer size should not exceed 512 KB due to | ||||
| // frameScratchBufferLen(maxFrameSize), thus the "infinity pool" should never be used. | ||||
| // It exists mainly as a safety measure, for potential future increases in max buffer size. | ||||
| var bufPools [7]sync.Pool // of *[]byte | ||||
| func bufPoolIndex(size int) int { | ||||
| 	if size <= 16384 { | ||||
| 		return 0 | ||||
| 	} | ||||
| 	size -= 1 | ||||
| 	bits := bits.Len(uint(size)) | ||||
| 	index := bits - 14 | ||||
| 	if index >= len(bufPools) { | ||||
| 		return len(bufPools) - 1 | ||||
| 	} | ||||
| 	return index | ||||
| } | ||||
| 
 | ||||
| func (cs *clientStream) writeRequestBody(req *http.Request) (err error) { | ||||
| 	cc := cs.cc | ||||
|  | @ -1695,12 +1719,13 @@ func (cs *clientStream) writeRequestBody(req *http.Request) (err error) { | |||
| 	// Scratch buffer for reading into & writing from. | ||||
| 	scratchLen := cs.frameScratchBufferLen(maxFrameSize) | ||||
| 	var buf []byte | ||||
| 	if bp, ok := bufPool.Get().(*[]byte); ok && len(*bp) >= scratchLen { | ||||
| 		defer bufPool.Put(bp) | ||||
| 	index := bufPoolIndex(scratchLen) | ||||
| 	if bp, ok := bufPools[index].Get().(*[]byte); ok && len(*bp) >= scratchLen { | ||||
| 		defer bufPools[index].Put(bp) | ||||
| 		buf = *bp | ||||
| 	} else { | ||||
| 		buf = make([]byte, scratchLen) | ||||
| 		defer bufPool.Put(&buf) | ||||
| 		defer bufPools[index].Put(&buf) | ||||
| 	} | ||||
| 
 | ||||
| 	var sawEOF bool | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue