Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http

Related tags


fasthttp Build Status GoDoc Go Report Sourcegraph

FastHTTP – Fastest and reliable HTTP implementation in Go

Fast HTTP implementation for Go.

Currently fasthttp is successfully used by VertaMedia in a production serving up to 200K rps from more than 1.5M concurrent keep-alive connections per physical server.

TechEmpower Benchmark round 19 results

Server Benchmarks

Client Benchmarks



Examples from docs

Code examples

Awesome fasthttp tools

Switching from net/http to fasthttp

Fasthttp best practices

Tricks with byte buffers

Related projects


HTTP server performance comparison with net/http

In short, fasthttp server is up to 10 times faster than net/http. Below are benchmark results.


net/http server:

$ GOMAXPROCS=1 go test -bench=NetHTTPServerGet -benchmem -benchtime=10s
BenchmarkNetHTTPServerGet1ReqPerConn                	 1000000	     12052 ns/op	    2297 B/op	      29 allocs/op
BenchmarkNetHTTPServerGet2ReqPerConn                	 1000000	     12278 ns/op	    2327 B/op	      24 allocs/op
BenchmarkNetHTTPServerGet10ReqPerConn               	 2000000	      8903 ns/op	    2112 B/op	      19 allocs/op
BenchmarkNetHTTPServerGet10KReqPerConn              	 2000000	      8451 ns/op	    2058 B/op	      18 allocs/op
BenchmarkNetHTTPServerGet1ReqPerConn10KClients      	  500000	     26733 ns/op	    3229 B/op	      29 allocs/op
BenchmarkNetHTTPServerGet2ReqPerConn10KClients      	 1000000	     23351 ns/op	    3211 B/op	      24 allocs/op
BenchmarkNetHTTPServerGet10ReqPerConn10KClients     	 1000000	     13390 ns/op	    2483 B/op	      19 allocs/op
BenchmarkNetHTTPServerGet100ReqPerConn10KClients    	 1000000	     13484 ns/op	    2171 B/op	      18 allocs/op

fasthttp server:

$ GOMAXPROCS=1 go test -bench=kServerGet -benchmem -benchtime=10s
BenchmarkServerGet1ReqPerConn                       	10000000	      1559 ns/op	       0 B/op	       0 allocs/op
BenchmarkServerGet2ReqPerConn                       	10000000	      1248 ns/op	       0 B/op	       0 allocs/op
BenchmarkServerGet10ReqPerConn                      	20000000	       797 ns/op	       0 B/op	       0 allocs/op
BenchmarkServerGet10KReqPerConn                     	20000000	       716 ns/op	       0 B/op	       0 allocs/op
BenchmarkServerGet1ReqPerConn10KClients             	10000000	      1974 ns/op	       0 B/op	       0 allocs/op
BenchmarkServerGet2ReqPerConn10KClients             	10000000	      1352 ns/op	       0 B/op	       0 allocs/op
BenchmarkServerGet10ReqPerConn10KClients            	20000000	       789 ns/op	       2 B/op	       0 allocs/op
BenchmarkServerGet100ReqPerConn10KClients           	20000000	       604 ns/op	       0 B/op	       0 allocs/op


net/http server:

$ GOMAXPROCS=4 go test -bench=NetHTTPServerGet -benchmem -benchtime=10s
BenchmarkNetHTTPServerGet1ReqPerConn-4                  	 3000000	      4529 ns/op	    2389 B/op	      29 allocs/op
BenchmarkNetHTTPServerGet2ReqPerConn-4                  	 5000000	      3896 ns/op	    2418 B/op	      24 allocs/op
BenchmarkNetHTTPServerGet10ReqPerConn-4                 	 5000000	      3145 ns/op	    2160 B/op	      19 allocs/op
BenchmarkNetHTTPServerGet10KReqPerConn-4                	 5000000	      3054 ns/op	    2065 B/op	      18 allocs/op
BenchmarkNetHTTPServerGet1ReqPerConn10KClients-4        	 1000000	     10321 ns/op	    3710 B/op	      30 allocs/op
BenchmarkNetHTTPServerGet2ReqPerConn10KClients-4        	 2000000	      7556 ns/op	    3296 B/op	      24 allocs/op
BenchmarkNetHTTPServerGet10ReqPerConn10KClients-4       	 5000000	      3905 ns/op	    2349 B/op	      19 allocs/op
BenchmarkNetHTTPServerGet100ReqPerConn10KClients-4      	 5000000	      3435 ns/op	    2130 B/op	      18 allocs/op

fasthttp server:

$ GOMAXPROCS=4 go test -bench=kServerGet -benchmem -benchtime=10s
BenchmarkServerGet1ReqPerConn-4                         	10000000	      1141 ns/op	       0 B/op	       0 allocs/op
BenchmarkServerGet2ReqPerConn-4                         	20000000	       707 ns/op	       0 B/op	       0 allocs/op
BenchmarkServerGet10ReqPerConn-4                        	30000000	       341 ns/op	       0 B/op	       0 allocs/op
BenchmarkServerGet10KReqPerConn-4                       	50000000	       310 ns/op	       0 B/op	       0 allocs/op
BenchmarkServerGet1ReqPerConn10KClients-4               	10000000	      1119 ns/op	       0 B/op	       0 allocs/op
BenchmarkServerGet2ReqPerConn10KClients-4               	20000000	       644 ns/op	       0 B/op	       0 allocs/op
BenchmarkServerGet10ReqPerConn10KClients-4              	30000000	       346 ns/op	       0 B/op	       0 allocs/op
BenchmarkServerGet100ReqPerConn10KClients-4             	50000000	       282 ns/op	       0 B/op	       0 allocs/op

HTTP client comparison with net/http

In short, fasthttp client is up to 10 times faster than net/http. Below are benchmark results.


net/http client:

$ GOMAXPROCS=1 go test -bench='HTTPClient(Do|GetEndToEnd)' -benchmem -benchtime=10s
BenchmarkNetHTTPClientDoFastServer                  	 1000000	     12567 ns/op	    2616 B/op	      35 allocs/op
BenchmarkNetHTTPClientGetEndToEnd1TCP               	  200000	     67030 ns/op	    5028 B/op	      56 allocs/op
BenchmarkNetHTTPClientGetEndToEnd10TCP              	  300000	     51098 ns/op	    5031 B/op	      56 allocs/op
BenchmarkNetHTTPClientGetEndToEnd100TCP             	  300000	     45096 ns/op	    5026 B/op	      55 allocs/op
BenchmarkNetHTTPClientGetEndToEnd1Inmemory          	  500000	     24779 ns/op	    5035 B/op	      57 allocs/op
BenchmarkNetHTTPClientGetEndToEnd10Inmemory         	 1000000	     26425 ns/op	    5035 B/op	      57 allocs/op
BenchmarkNetHTTPClientGetEndToEnd100Inmemory        	  500000	     28515 ns/op	    5045 B/op	      57 allocs/op
BenchmarkNetHTTPClientGetEndToEnd1000Inmemory       	  500000	     39511 ns/op	    5096 B/op	      56 allocs/op

fasthttp client:

$ GOMAXPROCS=1 go test -bench='kClient(Do|GetEndToEnd)' -benchmem -benchtime=10s
BenchmarkClientDoFastServer                         	20000000	       865 ns/op	       0 B/op	       0 allocs/op
BenchmarkClientGetEndToEnd1TCP                      	 1000000	     18711 ns/op	       0 B/op	       0 allocs/op
BenchmarkClientGetEndToEnd10TCP                     	 1000000	     14664 ns/op	       0 B/op	       0 allocs/op
BenchmarkClientGetEndToEnd100TCP                    	 1000000	     14043 ns/op	       1 B/op	       0 allocs/op
BenchmarkClientGetEndToEnd1Inmemory                 	 5000000	      3965 ns/op	       0 B/op	       0 allocs/op
BenchmarkClientGetEndToEnd10Inmemory                	 3000000	      4060 ns/op	       0 B/op	       0 allocs/op
BenchmarkClientGetEndToEnd100Inmemory               	 5000000	      3396 ns/op	       0 B/op	       0 allocs/op
BenchmarkClientGetEndToEnd1000Inmemory              	 5000000	      3306 ns/op	       2 B/op	       0 allocs/op


net/http client:

$ GOMAXPROCS=4 go test -bench='HTTPClient(Do|GetEndToEnd)' -benchmem -benchtime=10s
BenchmarkNetHTTPClientDoFastServer-4                    	 2000000	      8774 ns/op	    2619 B/op	      35 allocs/op
BenchmarkNetHTTPClientGetEndToEnd1TCP-4                 	  500000	     22951 ns/op	    5047 B/op	      56 allocs/op
BenchmarkNetHTTPClientGetEndToEnd10TCP-4                	 1000000	     19182 ns/op	    5037 B/op	      55 allocs/op
BenchmarkNetHTTPClientGetEndToEnd100TCP-4               	 1000000	     16535 ns/op	    5031 B/op	      55 allocs/op
BenchmarkNetHTTPClientGetEndToEnd1Inmemory-4            	 1000000	     14495 ns/op	    5038 B/op	      56 allocs/op
BenchmarkNetHTTPClientGetEndToEnd10Inmemory-4           	 1000000	     10237 ns/op	    5034 B/op	      56 allocs/op
BenchmarkNetHTTPClientGetEndToEnd100Inmemory-4          	 1000000	     10125 ns/op	    5045 B/op	      56 allocs/op
BenchmarkNetHTTPClientGetEndToEnd1000Inmemory-4         	 1000000	     11132 ns/op	    5136 B/op	      56 allocs/op

fasthttp client:

$ GOMAXPROCS=4 go test -bench='kClient(Do|GetEndToEnd)' -benchmem -benchtime=10s
BenchmarkClientDoFastServer-4                           	50000000	       397 ns/op	       0 B/op	       0 allocs/op
BenchmarkClientGetEndToEnd1TCP-4                        	 2000000	      7388 ns/op	       0 B/op	       0 allocs/op
BenchmarkClientGetEndToEnd10TCP-4                       	 2000000	      6689 ns/op	       0 B/op	       0 allocs/op
BenchmarkClientGetEndToEnd100TCP-4                      	 3000000	      4927 ns/op	       1 B/op	       0 allocs/op
BenchmarkClientGetEndToEnd1Inmemory-4                   	10000000	      1604 ns/op	       0 B/op	       0 allocs/op
BenchmarkClientGetEndToEnd10Inmemory-4                  	10000000	      1458 ns/op	       0 B/op	       0 allocs/op
BenchmarkClientGetEndToEnd100Inmemory-4                 	10000000	      1329 ns/op	       0 B/op	       0 allocs/op
BenchmarkClientGetEndToEnd1000Inmemory-4                	10000000	      1316 ns/op	       5 B/op	       0 allocs/op


go get -u

Switching from net/http to fasthttp

Unfortunately, fasthttp doesn't provide API identical to net/http. See the FAQ for details. There is net/http -> fasthttp handler converter, but it is better to write fasthttp request handlers by hand in order to use all of the fasthttp advantages (especially high performance :) ).

Important points:

  • Fasthttp works with RequestHandler functions instead of objects implementing Handler interface. Fortunately, it is easy to pass bound struct methods to fasthttp:

    type MyHandler struct {
    	foobar string
    // request handler in net/http style, i.e. method bound to MyHandler struct.
    func (h *MyHandler) HandleFastHTTP(ctx *fasthttp.RequestCtx) {
    	// notice that we may access MyHandler properties here - see h.foobar.
    	fmt.Fprintf(ctx, "Hello, world! Requested path is %q. Foobar is %q",
    		ctx.Path(), h.foobar)
    // request handler in fasthttp style, i.e. just plain function.
    func fastHTTPHandler(ctx *fasthttp.RequestCtx) {
    	fmt.Fprintf(ctx, "Hi there! RequestURI is %q", ctx.RequestURI())
    // pass bound struct method to fasthttp
    myHandler := &MyHandler{
    	foobar: "foobar",
    fasthttp.ListenAndServe(":8080", myHandler.HandleFastHTTP)
    // pass plain function to fasthttp
    fasthttp.ListenAndServe(":8081", fastHTTPHandler)
  • The RequestHandler accepts only one argument - RequestCtx. It contains all the functionality required for http request processing and response writing. Below is an example of a simple request handler conversion from net/http to fasthttp.

    // net/http request handler
    requestHandler := func(w http.ResponseWriter, r *http.Request) {
    	switch r.URL.Path {
    	case "/foo":
    		fooHandler(w, r)
    	case "/bar":
    		barHandler(w, r)
    		http.Error(w, "Unsupported path", http.StatusNotFound)
    // the corresponding fasthttp request handler
    requestHandler := func(ctx *fasthttp.RequestCtx) {
    	switch string(ctx.Path()) {
    	case "/foo":
    	case "/bar":
    		ctx.Error("Unsupported path", fasthttp.StatusNotFound)
  • Fasthttp allows setting response headers and writing response body in an arbitrary order. There is no 'headers first, then body' restriction like in net/http. The following code is valid for fasthttp:

    requestHandler := func(ctx *fasthttp.RequestCtx) {
    	// set some headers and status code first
    	// then write the first part of body
    	fmt.Fprintf(ctx, "this is the first part of body\n")
    	// then set more headers
    	ctx.Response.Header.Set("Foo-Bar", "baz")
    	// then write more body
    	fmt.Fprintf(ctx, "this is the second part of body\n")
    	// then override already written body
    	ctx.SetBody([]byte("this is completely new body contents"))
    	// then update status code
    	// basically, anything may be updated many times before
    	// returning from RequestHandler.
    	// Unlike net/http fasthttp doesn't put response to the wire until
    	// returning from RequestHandler.
  • Fasthttp doesn't provide ServeMux, but there are more powerful third-party routers and web frameworks with fasthttp support:

    Net/http code with simple ServeMux is trivially converted to fasthttp code:

    // net/http code
    m := &http.ServeMux{}
    m.HandleFunc("/foo", fooHandlerFunc)
    m.HandleFunc("/bar", barHandlerFunc)
    m.Handle("/baz", bazHandler)
    http.ListenAndServe(":80", m)
    // the corresponding fasthttp code
    m := func(ctx *fasthttp.RequestCtx) {
    	switch string(ctx.Path()) {
    	case "/foo":
    	case "/bar":
    	case "/baz":
    		ctx.Error("not found", fasthttp.StatusNotFound)
    fasthttp.ListenAndServe(":80", m)
  • net/http -> fasthttp conversion table:

    • All the pseudocode below assumes w, r and ctx have these types:
      var (
      	w http.ResponseWriter
      	r *http.Request
      	ctx *fasthttp.RequestCtx
  • VERY IMPORTANT! Fasthttp disallows holding references to RequestCtx or to its' members after returning from RequestHandler. Otherwise data races are inevitable. Carefully inspect all the net/http request handlers converted to fasthttp whether they retain references to RequestCtx or to its' members after returning. RequestCtx provides the following band aids for this case:

    • Wrap RequestHandler into TimeoutHandler.
    • Call TimeoutError before returning from RequestHandler if there are references to RequestCtx or to its' members. See the example for more details.

Use this brilliant tool - race detector - for detecting and eliminating data races in your program. If you detected data race related to fasthttp in your program, then there is high probability you forgot calling TimeoutError before returning from RequestHandler.

Performance optimization tips for multi-core systems

  • Use reuseport listener.
  • Run a separate server instance per CPU core with GOMAXPROCS=1.
  • Pin each server instance to a separate CPU core using taskset.
  • Ensure the interrupts of multiqueue network card are evenly distributed between CPU cores. See this article for details.
  • Use Go 1.13 as it provides some considerable performance improvements.

Fasthttp best practices

  • Do not allocate objects and []byte buffers - just reuse them as much as possible. Fasthttp API design encourages this.
  • sync.Pool is your best friend.
  • Profile your program in production. go tool pprof --alloc_objects your-program mem.pprof usually gives better insights for optimization opportunities than go tool pprof your-program cpu.pprof.
  • Write tests and benchmarks for hot paths.
  • Avoid conversion between []byte and string, since this may result in memory allocation+copy. Fasthttp API provides functions for both []byte and string - use these functions instead of converting manually between []byte and string. There are some exceptions - see this wiki page for more details.
  • Verify your tests and production code under race detector on a regular basis.
  • Prefer quicktemplate instead of html/template in your webserver.

Tricks with []byte buffers

The following tricks are used by fasthttp. Use them in your code too.

  • Standard Go functions accept nil buffers
var (
	// both buffers are uninitialized
	dst []byte
	src []byte
dst = append(dst, src...)  // is legal if dst is nil and/or src is nil
copy(dst, src)  // is legal if dst is nil and/or src is nil
(string(src) == "")  // is true if src is nil
(len(src) == 0)  // is true if src is nil
src = src[:0]  // works like a charm with nil src

// this for loop doesn't panic if src is nil
for i, ch := range src {
	doSomething(i, ch)

So throw away nil checks for []byte buffers from you code. For example,

srcLen := 0
if src != nil {
	srcLen = len(src)


srcLen := len(src)
  • String may be appended to []byte buffer with append
dst = append(dst, "foobar"...)
  • []byte buffer may be extended to its' capacity.
buf := make([]byte, 100)
a := buf[:10]  // len(a) == 10, cap(a) == 100.
b := a[:100]  // is valid, since cap(a) == 100.
  • All fasthttp functions accept nil []byte buffer
statusCode, body, err := fasthttp.Get(nil, "")
uintBuf := fasthttp.AppendUint(nil, 1234)

Related projects

  • fasthttp - various useful helpers for projects based on fasthttp.
  • fasthttp-routing - fast and powerful routing package for fasthttp servers.
  • router - a high performance fasthttp request router that scales well.
  • fastws - Bloatless WebSocket package made for fasthttp to handle Read/Write operations concurrently.
  • gramework - a web framework made by one of fasthttp maintainers
  • lu - a high performance go middleware web framework which is based on fasthttp.
  • websocket - Gorilla-based websocket implementation for fasthttp.
  • fasthttpsession - a fast and powerful session package for fasthttp servers.
  • atreugo - High performance and extensible micro web framework with zero memory allocations in hot paths.
  • kratgo - Simple, lightweight and ultra-fast HTTP Cache to speed up your websites.
  • kit-plugins - go-kit transport implementation for fasthttp.
  • Fiber - An Expressjs inspired web framework running on Fasthttp
  • Gearbox - ⚙️ gearbox is a web framework written in Go with a focus on high performance and memory optimization


  • Why creating yet another http package instead of optimizing net/http?

    Because net/http API limits many optimization opportunities. For example:

    • net/http Request object lifetime isn't limited by request handler execution time. So the server must create a new request object per each request instead of reusing existing objects like fasthttp does.
    • net/http headers are stored in a map[string][]string. So the server must parse all the headers, convert them from []byte to string and put them into the map before calling user-provided request handler. This all requires unnecessary memory allocations avoided by fasthttp.
    • net/http client API requires creating a new response object per each request.
  • Why fasthttp API is incompatible with net/http?

    Because net/http API limits many optimization opportunities. See the answer above for more details. Also certain net/http API parts are suboptimal for use:

  • Why fasthttp doesn't support HTTP/2.0 and WebSockets?

    HTTP/2.0 support is in progress. WebSockets has been done already. Third parties also may use RequestCtx.Hijack for implementing these goodies.

  • Are there known net/http advantages comparing to fasthttp?


    • net/http supports HTTP/2.0 starting from go1.6.
    • net/http API is stable, while fasthttp API constantly evolves.
    • net/http handles more HTTP corner cases.
    • net/http should contain less bugs, since it is used and tested by much wider audience.
    • net/http works on Go older than 1.5.
  • Why fasthttp API prefers returning []byte instead of string?

    Because []byte to string conversion isn't free - it requires memory allocation and copy. Feel free wrapping returned []byte result into string() if you prefer working with strings instead of byte slices. But be aware that this has non-zero overhead.

  • Which GO versions are supported by fasthttp?

    Go1.5+. Older versions won't be supported, since their standard package miss useful functions.

    NOTE: Go 1.9.7 is the oldest tested version. We recommend you to update as soon as you can. As of 1.11.3 we will drop 1.9.x support.

  • Please provide real benchmark data and server information

    See this issue.

  • Are there plans to add request routing to fasthttp?

    There are no plans to add request routing into fasthttp. Use third-party routers and web frameworks with fasthttp support:

    See also this issue for more info.

  • I detected data race in fasthttp!

    Cool! File a bug. But before doing this check the following in your code:

  • I didn't find an answer for my question here

    Try exploring these questions.

  • Fasthttp behind Aws load balancer. Keepalive conn are causing trouble

    Fasthttp behind Aws load balancer. Keepalive conn are causing trouble


    We're using a light/fast fasthttp server as a proxy in our services infrastructure. However, we've been experiencing some issues when we use an amazon Load Balancer. Sometimes (and this is randomly) the ALB returns 502 because the request can't find the fasthttp service. Note that ALB uses keepalive connections by default and that can't be changed.

    After a while doing some research, we were suspicious that fasthttp was closing the keepalive connections at some point, and the ALB couldn't re-use it, so it would return a 502.

    If we set the Server.DisableKeepAlive = true everything works as expected (with a lot more of load of course)

    We reduced our implementation to the minimum to test:

    s := &fasthttp.Server{
    		Handler:     OurHandler,
    		Concurrency: fasthttp.DefaultConcurrency,
    	s.DisableKeepalive = true // If this is false, we see the error randomly.
    	log.Fatal(s.ListenAndServe(":" + strconv.Itoa(port)))

    The handler basically does this:

            // h is an instance of *fasthttp.HostClient configured with some parameters
    	if err := h.proxy.Do(req, resp); err != nil {
    		log.Error("error when proxying the request: ", err)

    Is there any chance someone has experienced this? I'm not sure how we should proceed with the keepalive connections in the fasthttp.Server, as we are using pretty much all the default parameters.

    Thanks in advance!

    bug help wanted pending/submitter-response 
    opened by Rulox 42
  • CORS: allow every origin with credentials

    CORS: allow every origin with credentials

    I have a simple question. I want to set "Access-Control-Allow-Credentials" to "true" and "Access-Control-Allow-Origin" to the current request origin, so every origin is allowed to access my API. Which method should I use on the RequestCtx to retrieve the current request origin which is eligible to show up in the CORS header? I tried different ones like ctx.RemoteAddr.String() or ctx.Request.URI().Host() but none of them worked.

    I want that because I want to achieve a JWT authentication using the Authorization header, which is only received if I allow credentials.


    opened by lus 40
  • Reponse body io.Reader

    Reponse body io.Reader

    Hey guys. How to set custom response body writer? I've tried to use SetBodyStream, but i don't see any body readers from response which i need to pass in io.Reader. P.S I'm trying to implement throttler.

    enhancement wontfix 
    opened by qJkee 40
  • Are there frameworks based on fasthttp?

    Are there frameworks based on fasthttp?

    I mainly need a good router but a complete framework will be nice.

    opened by thedrow 29
  • the master branch's code is ok ?

    the master branch's code is ok ?

    1、today i go get new fasthttp code, i found when the browse send a request, somtimes it recevie a error message "Error when parsing request"

    2、why use os.Command().Output() int my handler, the bin will output "child exited" ?

    opened by goith 26
  • Too many timeouts when working with high concurrency

    Too many timeouts when working with high concurrency

    I use fasthttp client in an application that collects information about millions of sites on the network. To do this really quickly and in parallel, I create a bunch of goroutines in which I execute c.httpClient.DoTimeout (...) requests

    If I run no more than ~ 100 threads per core, then I successfully receive answers for all requests. If I run more than 100 threads per core, then part of the requests will be interrupted by timeout and I will get errors

    The problem is definitely not in the sites themselves.

    I think there are some restrictions on the number of open connections or something like that, but I don’t know where to dig.

    I will be very glad to any prompts.

    opened by scanpatch 26
  • Graceful Shutdown

    Graceful Shutdown

    Hi @valyala

    In Go 1.8, net/http is having graceful shutdown feature. Server.Shutdown It would be nice if it is implemented in fasthttp too.

    enhancement help wanted 
    opened by arafath-mk 25
  • Error 7 at 1-3 Open Connections

    Error 7 at 1-3 Open Connections

    Hi there,

    I'm currently at a loss as to what is bottle necking. As soon as I hit fasthttp with +1000 reqs/s (same origin), it starts to fail. Curl is throwing: curl: (7) Couldn't connect to server.

    I'm using fasthttp with fasthttp-router and their default configurations. Seeing that Open Connections is always below 5 from 262144 I don't see what could be causing this and have my doubts of it being caused by the app.

    Could this be a limit from the OS it self, are there any unix settings we need to change? In terms of connections we are using net.core.somaxconn = 16384

    Thanks for you help

    opened by Slind14 24
  • Response.ContentLength Not correct

    Response.ContentLength Not correct


    if len(string(resp.Body())) > 0 {
    	logs.DebugLog( "i got %d %s", resp.Header.ContentLength(), resp.String() )

    #read log: [[DEBUG]]11:18:38 task.go:105: i got 90 HTTP/1.1 206 Partial Content Date: Mon, 25 May 2020 08:18:38 GMT Content-Type: text/plain; charset=utf-8 Content-Length: 89

    What??? resp.Header.ContentLength()=90, resp.String() thinks different

    (I found this paradox out when wrote code:

    If resp.Header.ContentLength() > 0 {
    logs.StatusLog(resp.Body() )

    and got many empty row on log ! Reading body is not match performance on empty response :-) )

    *Go 1.14 * v1.9.0

    opened by ruslanBik4 20
  • Reverse Proxy?

    Reverse Proxy?

    The golang httputil package has a ReverseProxy that will serve from an http.Request.

    Is there any comporable revrese proxy for fasthttp that will serve from a fasthttp.Request?

    enhancement question 
    opened by caleblloyd 19
  • Strange timeout issue with fasthttp

    Strange timeout issue with fasthttp

    Hi, I'm using fasthttp to send POST requests to a SAAS REST service and I get a timeout error long before the timeout I have set for the DoTimeout command.

    The code I'm using looks like this:

    timeStarted := time.Now()
    err = upstreamClient.DoTimeout(req, resp, time.Duration(upstreamTimeoutMilliseconds) * time.Millisecond)
    timeTaken := time.Since(timeStarted)
    if err == nil || errors.Is(err, syscall.EPIPE) {
    	statusCode := resp.StatusCode()
    	status := resp.String()
             //Handle the status code and such...
    } else {
    	log.Printf(" ERROR: cannot send logs batch (after %v): %v", timeTaken, err)

    In the log I see lots of lines like this:

     ERROR: cannot send logs batch (after 3.32μs): timeout
     ERROR: cannot send logs batch (after 65.379067ms): timeout
     ERROR: cannot send logs batch (after 6.008866ms): timeout
     ERROR: cannot send logs batch (after 36.436383ms): timeout

    The value of the variable 'upstreamTimeoutMilliseconds' is set to 120000. How is it possible that the "DoTimeout" function returns with a timeout error BEFORE that amount of time with a timeout error?

    Interestingly enough, I have a code that wraps this call and if it failed, for example with a timeout, it retries the same call up to 5 times before giving up. From the logs it seems that this timeout issue happens ALL THE TIME AT FIRST REQUEST and succeeds in the second attempt.

    opened by iyuvalk 3
  • Crashing when serving hijacked connections from a SSH listener

    Crashing when serving hijacked connections from a SSH listener


    First of all, thanks for this amazing library!

    We have a bit of a niche use case where our program SSH's (using Go's crypto/ssh) into a remote host and then does two things:

    1. Port forwards remote->local to a Fasthttp server using a SSH listener, where the request handler hijacks the connection.
    2. Sends requests local->remote on a specific port on the remote machine through a SSH conn created using sshClient.Dial.
    3. Run a second fasthttp server in the same program that accepts connections from a normal local listener (not through SSH).

    It seems that if the connection is being served using a SSH listener and ends up being hijacked fasthttp panics. I have mostly traced it down to the net.Conn implementation used by crypto/ssh, as they do NOT implement Set Read/Write Deadline functions required by the Conn interface.

    They implement empty functions (to satisfy the interface) that simply return an error:

    It seems these end up being called in server.go (as far as I saw so far), produce an error and crash. The lines that are crashing seem to be here:

    It would be great if this can be handled somehow, or if you have another recommendation in this case. As a dirty workaround, we are currently vendoring the dependencies and commenting out those lines in server.go, which stops crashes but am not sure if it has negative effects, especially on the normal server.

    Any help is appreciated 🙏🏻

    opened by bloeys 3
  • HostClient.DisableHeaderNamesNormalizing does not apply to requests.

    HostClient.DisableHeaderNamesNormalizing does not apply to requests.

    As the title says: HostClient.DisableHeaderNamesNormalizing does not apply to the requests. If someone wants to disable the headers normalization then you need to call this function on every request.

    See this

    help wanted 
    opened by dgrr 1
  • Consider using copy-less []byte/string conversion

    Consider using copy-less []byte/string conversion

    Many of the optimizations in fasthttp are based on using byte arrays instead of strings. That is wise!

    However, there is an assumption that translating these into strings (or back) requires a copy and should thus be discouraged.

    With some caveats, this is not true. There are in fact reliable ways to avoid copying. Please see the code I use, here. I urge you to consider these or similar functions to handle conversion, and perhaps to benchmark the memory use and total throughput accordingly.

    (The major caveat is the use of "unsafe". Some projects decide, as a matter of principle, to not use it. However, for the same reason fasthttp doesn't try to copy Go's http library, I believe that "unsafe" would be acceptable here.)

    For completion, here are some references to code and discussion on this topic:

    help wanted 
    opened by tliron 8
  • Provide host client pool and Reset method to reuse HostClient instance

    Provide host client pool and Reset method to reuse HostClient instance

    Implement this

    maybe it's better to provide a Reset() method to allow reusing HostClient? 🤔

    @erikdubbelboer @kirillDanshin Please take a look.

    opened by kiyonlin 7
  • Ability to serve embed.FS files

    Ability to serve embed.FS files

    Will there be a native fasthttp way (like .ServeFile) to share filesystems of embedded files, support for which came in go 1.16?

    help wanted 
    opened by night-codes 3
  • feat: keep req/resp Body syntax correctly

    feat: keep req/resp Body syntax correctly

    Hi, i think error handles in Request::Body() and Response::Body() is not a good idea.
    they should be returns with another error type , the user could check error before handle the body.

    we could provides BodyE() and Body():

    1. BodyE() returns ([]byte, error) , the caller can validate error by him/her self.
    2. Body() // wrap BodyE(), if error occurs, only returns nil slice

    usage scene:

    body, err := request.BodyE()
    if err != nil {
        // early  return
        // log error
        return err
    err = json.Unmarshal(body, &model)
    // ...

    the current usage: with error in body usage scene:

    body, err := request.Body()
    // err in body, it's not json format
    err = json.Unmarshal(body, &model) // not unexpected, and it's a waste operation.
    // ...
    pending/development pending/submitter-response 
    opened by kaka19ace 4
  • opentelemetry / tracing support - q&a

    opentelemetry / tracing support - q&a

    Hi, we want to enable open telemetry in fasthttp. Actually we started to write a helper library, somehow we can support tracing for the requests written like below:

    func getUserFasthttp(ctx context.Context, id string) string {
    	req := fasthttp.AcquireRequest()
    	res := fasthttp.AcquireResponse()
    	defer fasthttp.ReleaseRequest(req)
    	defer fasthttp.ReleaseResponse(res)
    	span := tracing.StartSpan(ctx, req, "test")
    	err := fasthttp.Do(req, res)
    	tracing.EndSpan(span, res.StatusCode(), err)
    	if err != nil {
    	return "test"

    but, if developers choose to use fasthttp.Get/Post approach, we could not add telemetry data:

    func getUserFasthttpWithGet(ctx context.Context, id string) string {
    	span := tracing.StartSpan(ctx, nil, "test")
    	var responseBody []byte
    	status, _, err := fasthttp.Get(responseBody, "http://test/hello")
    	tracing.EndSpan(span, status, err)
    	if err != nil {
    	return "test"

    Because we could not access to the internal Request/Response struct.

    We thought that we can add another method to fasthttp source code with tracing support, or, we can add hooks to thoose methods in below:

    client.go line 826
    func clientGetURL(dst []byte, url string, c clientDoer) (statusCode int, body []byte, err error) {
    	req := AcquireRequest()
            // here we can run hooks
    	statusCode, body, err = doRequestFollowRedirectsBuffer(req, dst, url, c)
    	return statusCode, body, err
    client.go line 926
    func doRequestFollowRedirectsBuffer(req *Request, dst []byte, url string, c clientDoer) (statusCode int, body []byte, err error) {
    	resp := AcquireResponse()
    	bodyBuf := resp.bodyBuffer()
    	resp.keepBodyBuffer = true
    	oldBody := bodyBuf.B
    	bodyBuf.B = dst
    	statusCode, _, err = doRequestFollowRedirects(req, resp, url, defaultMaxRedirectsCount, c)
            // here we can run hooks
    	body = bodyBuf.B
    	bodyBuf.B = oldBody
    	resp.keepBodyBuffer = false
    	return statusCode, body, err

    The hook() functions might be used in several ways for example, telemetry support, request/resp logging, header manipulation etc...

    What are your thoughts?

    help wanted pending/development 
    opened by mstrYoda 5
  • initial gnet non-blocking io support

    initial gnet non-blocking io support

    I created an initial implementation of fasthttp using gnet to handle the non-blocking IO. Seems to work well. Still haven't benchmarked it though. The changes don't touch any of the existing workings of fasthttp since a new GnetConn instance is used to adapt the serveConn(net.Conn) method to gnet. So it shouldn't affect any existing servers which don't want to use Gnet. Separate ListenAndServeGnet function was created.

    I don't know whether or not it handles closing connections properly or timeouts. I did see connections seem to eventually close.

    Interested in what people think. 😄

    opened by calbot 2
  • Any protection against fault tolerance for fasthttp?

    Any protection against fault tolerance for fasthttp?

    Something along the lines of this:

    Is there any possibility to incorporate fasthttp into the code above or we can do one for our own use with a newer version of fasthttp? What kind of fault tolerance features can be done with fasthttp other than timeout settings and max connection etc? anyone tested under extreme loads (overcapacity type)?

    opened by gitmko0 3
  • v1.28.0(Jun 30, 2021)

    • 1504a84 Increase TestHostClientMaxConnWaitTimeoutSuccess timeout (Erik Dubbelboer)
    • f6560be Flush buffered responses if we have to wait for the next request (#1050) (Erik Dubbelboer)
    Source code(tar.gz)
    Source code(zip)
  • v1.27.0(Jun 21, 2021)

    • 874c8ca Increase timeouts for Windows github actions (Erik Dubbelboer)
    • 924a63f Increase TestServerTLSReadTimeout timeout (Erik Dubbelboer)
    • 410bde6 Fix race condition in TestPipelineClientIssue832 (Erik Dubbelboer)
    • 9f2c636 Lower go test time (Erik Dubbelboer)
    • 4ed933a fix: set content-length properly when StreanRequestBody was enabled (#1049) (Meng)
    • cec9953 Add IdleTimeout to Shutdown documentation (Erik Dubbelboer)
    • c12a061 TCPDialer :: DNSCacheDuration option (#1046) (Ertuğrul Emre Ertekin)
    • 87fc958 Run go test on github actions (#1047) (Erik Dubbelboer)
    • be13b50 Defined Transport for the client (#1045) (Darío)
    • b8b065b Don't unwrap io.LimitedReader (Erik Dubbelboer)
    Source code(tar.gz)
    Source code(zip)
  • v1.26.0(Jun 1, 2021)

    • 6233fbc Fix header .Add functions (#1036) (Erik Dubbelboer)
    • 5bb5cfc Remove unused peekRawHeader (Erik Dubbelboer)
    • 7d13e18 Add Request.TLS and try to avoid a new alloc if Request.Header is already allocated (#1034) (Sergio Andrés Virviescas Santana)
    • b433ecf Make sure to reset the userValues always and at the exact time (#1027) (Sergio Andrés Virviescas Santana)
    • a18c632 Fix cookie panic (Erik Dubbelboer)
    • f3e4118 Don't recommend Go 1.13 (Erik Dubbelboer)
    Source code(tar.gz)
    Source code(zip)
  • v1.25.0(May 20, 2021)

    • fa3e5d8 Run test with go 1.16.X (#1028) (Sergio Andrés Virviescas Santana)
    • ffa0cab Use proper content-type when it is not present (#1023) (MoreFreeze)
    • 04cde74 feature: add ConvertRequest func (#1024) (Nícolas Barbosa)
    • 5898006 Upgrade dependencies and tidy (#1029) (Sergio Andrés Virviescas Santana)
    • 097fa05 Fix ignoreBody still set content length (#1022) (MoreFreeze)
    • b2f111b Fix(adaptor): Fixed an issue where the adapter did not convert all (#1021) (Juan Chan)
    • 19fcd40 Fix chunked streaming (#1015) (Roman Khimov)
    Source code(tar.gz)
    Source code(zip)
  • v1.24.0(Apr 28, 2021)

  • v1.23.0(Mar 29, 2021)

    • 2a6f7db Adding support for securing error logs (#1001) (Daniel Firsht)
    • e61c9d5 Improve Client/HostClient pooling when many HostClient structs created and removed during program execution (#1000) (Mikhail Faraponov)
    • a583006 Use bytes.IndexByte instead of bytes.Index for single byte lookup (#999) (Mike Faraponov)
    • 860c345 Fix unexpected panic when calling Do of a PipelineClient (#997) (blanet)
    • 0cd7349 ImmediateHeaderFlush when no body (#995) (Vladimir Shteinman)
    • 02e0722 Add PipelineClient name (#994) (kiyon)
    • 1a7995b format err info (#989) (peakle)
    • f40ea7e Improve socks proxy (#990) (kiyon)
    • 34fa9a6 Add DisableHeaderNamesNormalizing to PipelineClient (#991) (kiyon)
    Source code(tar.gz)
    Source code(zip)
  • v1.22.0(Mar 1, 2021)

    • 4637395 Update deps (Erik Dubbelboer)
    • c3cd5e1 Export HostClient.connsCount (#981) (kiyon)
    • a4b0703 Implemented DisablePathNormalizing in PipelineClient (#977) (Seva Maltsev)
    • 0880335 Update compress.go (#978) (Mike Faraponov)
    • e7294d2 Update client.go (#979) (Mike Faraponov)
    • 62dfc52 Fix Client ms cleaner (#975) (kiyon)
    Source code(tar.gz)
    Source code(zip)
  • v1.21.0(Feb 17, 2021)

    • 3cd0862 Streaming fixes (#970) (Erik Dubbelboer)
    • 1b61ca2 Added Protocol() as a replacement of hardcoded strHTTP11 (#969) (Darío)
    • 52a8ab6 fix s2b go vet warning (#967) (ZhangYunHao)
    Source code(tar.gz)
    Source code(zip)
  • v1.20.0(Feb 8, 2021)

    • a88030b fix gracefilly shutdown bug, issue #958 (#960) (AlphaBaby)
    • 1494fdc Fix clientGetURLDeadline (Erik Dubbelboer)
    • 0956208 Add request body streaming. Fixes #622 (#911) (Kirill Danshin)
    • fbe6a2d Add fasthttp.GenerateTestCertificate and use in tests (Erik Dubbelboer)
    • 838d3ab Allow concurrent ServeTLS (Erik Dubbelboer)
    • 3cec26d Allow stopping FS handler cleanup gorountine (#942) (Erik Dubbelboer)
    • ed1cedd Fix race condition in Client.DoTimeout (Erik Dubbelboer)
    • 5661df8 Improve documentation about DelClientCookie which related with #951. (#956) (kiyon)
    • b4b40e9 Do not start connsCleaner on SetConnectionClosed requests. (#950) (Mike Faraponov)
    • 70e00dc Ignore empty Transfer-Encoding headers (Erik Dubbelboer)
    Source code(tar.gz)
    Source code(zip)
  • v1.19.0(Jan 4, 2021)

    • 6234776 Use QueryString while constructing RequestURI instead of QueryArgs if parsedQueryArgs is set to false (#937) (anshul-jain-aws)
    • 245e7ec CloseIdleConnections should also close TLS connections (Erik Dubbelboer)
    • bd35133 Always set Keepalive options (Erik Dubbelboer)
    • 4e63057 Make argsKV more predictable (Erik Dubbelboer)
    Source code(tar.gz)
    Source code(zip)
  • v1.18.0(Dec 9, 2020)

    • d0dfbd4 fix issue #875 (#909) (Kirill Danshin)
    • ec4aa43 (header) do case insensitive lookup of cookie header value (#925) (Daniel Kürner)
    • f710c2d Fixing deletion of headers/queryargs having multiple values. (#918) (anshul-jain-aws)
    • cb0aaaa Improve round2 performance (#914) (kiyon)
    • c2542e5 add nil check for LocalAddr (#907) (Shohi Wang)
    • 30aa43e Adding Power support(ppc64le) with continuous integration/testing to the project for architecture independent (#903) (asellappen)
    • df87e70 Fix race condition in TestCloseIdleConnections (Erik Dubbelboer)
    Source code(tar.gz)
    Source code(zip)
  • v1.17.0(Nov 5, 2020)

    • 74bd13a Add ppc64le support (Erik Dubbelboer)
    • 00973e5 Don't use %w (Erik Dubbelboer)
    • d7752d2 fixed default schema for for req url (#897) (Maxim Korolyov)
    • ce7b94f Add Request.SetBodyRaw (Erik Dubbelboer)
    • d71fc6c Ignore * files from tests (Erik Dubbelboer)
    • 9697ccb Added httpproxy v2 (#889) (Maxim Korolyov)
    • 9ed328c remove unnecessary type conversion (#890) (Mohammad Alian)
    • 4eac1ae Added proxy from env support (#885) (Maxim Korolyov)
    • 56775f4 tryDial timeout (#881) (Vitali Pikulik)
    • 805af0e Brotli support in FS handler. (#880) (hex0x00)
    • ae8b65f Add Client.CloseIdleConnections() (Erik Dubbelboer)
    • aa3f96c Git commit fix URI parse for urls like (#866) (Vitali Pikulik)
    Source code(tar.gz)
    Source code(zip)
  • v1.16.0(Aug 17, 2020)

    • 434c48b Travis doesn't seem to support tip anymore (Erik Dubbelboer)
    • 12aba62 Change CI to use Go 1.15 (Erik Dubbelboer)
    • 01acd76 Allow TimeoutHandler connections to be kept alive (#864) (Erik Dubbelboer)
    • a995d43 Add EnableNormalizing to RequestHeader and ResponseHeader (Erik Dubbelboer)
    • cc8ba4b Add a api DisableNoDefaultContentType to disable add default content type. (#859) (sky)
    • 2509c12 improve statusLine and StatusMessage by using slice instead of map (#855) (kiyon)
    • a7c7ef2 Fix comment typo (So-chiru)
    • 34a61fe Update linting (#851) (Erik Dubbelboer)
    Source code(tar.gz)
    Source code(zip)
  • v1.15.1(Jul 15, 2020)

  • v1.15.0(Jul 14, 2020)

    • 607743c Ignore gosec warning in example (Erik Dubbelboer)
    • f97a382 Add letsencrypt example (Erik Dubbelboer)
    • e6ed19f update link to router package (#842) (Serge Romanov)
    • ef51a7e Fix fasthttpadaptor Content-Type detection (Erik Dubbelboer)
    • ac4cc17 Completely remove fuzzit (Erik Dubbelboer)
    • 38affcb Added Gearbox (#823) (Nagy Salem)
    • 9dd7979 Restart PipelineClient worker on error (#834) (Erik Dubbelboer)
    • 380f00b Fixed bug which prevents cached FS files from being updated (Erik Dubbelboer)
    • 2f28edb Fixed recompressing of stale files (Erik Dubbelboer)
    • 1671faf Prefork does work on windows (Erik Dubbelboer)
    • cc9db3a Try TravisCI Windows (#828) (Erik Dubbelboer)
    • ac51d59 Make the ErrNothingRead to be exposed. (#827) (sky)
    • 853abb3 🐞 panic in fs.go #824 (#825) (RW)
    • 33b3cb2 Support Windows SO_REUSEADDR (#822) (Andy Pan)
    • 29e6d09 Update TechEmpower benchmark from 18 to 19 round (#821) (Andy Pan)
    Source code(tar.gz)
    Source code(zip)
  • v1.14.0(Jun 2, 2020)

    • 9468c66 URI.Parse now returns an error (Erik Dubbelboer)
    • 439185e Run cross compilation and race detector on the latest release only (Erik Dubbelboer)
    • bcaa594 Remove unused raw header code (Erik Dubbelboer)
    • 77dcda3 Add custom retry decider for fail http requests (Vural Kap)
    Source code(tar.gz)
    Source code(zip)
  • v1.13.1(May 25, 2020)

  • v1.13.0(May 25, 2020)

    This release of fasthttp contains 3 backwards incompatible changes.

    1. A HostClient can now only be used for a single protocol. If the HostClient is redirected to a different protocol it will return an error. Use Client instead if you need this functionality (dacd035).
    2. ServeFile now return a redirect for directories without trailing slash instead of serving the directory listing (5bd1b0c)
    3. ASCII control character are not allowed in URLs anymore (079f39b)


    • 339ad36 Add Brotli support (Erik Dubbelboer)
    • dacd035 HostClient can't switch between protocols (Erik Dubbelboer)
    • 5bd1b0c Make FS return a redirect for directories without trailing slash (#802) (Moritz Marquardt)
    • 05d4602 Fix race condition in test (Erik Dubbelboer)
    • 9507d7c Don't wrap conn with a TLS Client if it's already a TLS Conn (Erik Dubbelboer)
    • dc6b9db Copy to the req.Header.userAgent from the defaultUserAgent (#796) (Julian Junxiang Zhou)
    • 3294097 allow the expect 100 continue workflow to deny requests (#787) (Mike MacDermaid)
    • 446e1a6 Fix .travis.yml (Erik Dubbelboer)
    • 079f39b Don't allow ASCII control character in URLs (#790) (Erik Dubbelboer)
    • 3e27d8e Fix integer overflow handling in parseUintBuf() (#789) (Ivan Mironov)
    • 571315f Only base64 the proxy auth once (Erik Dubbelboer)
    • 503e363 Remove unnecessary check (Erik Dubbelboer)
    Source code(tar.gz)
    Source code(zip)
  • v1.12.0(Apr 21, 2020)

    • 54df169 Add fasthttpproxy.FasthttpHTTPDialer (Erik Dubbelboer)
    • 96a8ad6 Upgrade dependencies (Erik Dubbelboer)
    • 5ce12a8 oss-security got new email (Kirill Danshin)
    Source code(tar.gz)
    Source code(zip)
  • v1.11.0(Apr 18, 2020)

    This version fixes server concurrency counter for cases, when you use ListenAndServe, and not ServeConn manually.

    For example, in previous versions if your server is started by ListenAndServe, you will have GetCurrentConcurrency() returning constant zero. This version is fixing this. You can find corresponding PR here.

    This is considered a minor update, to allow users some time to update, if they relied on previous behavior.

    Feel free to report any bugs here. Thank you.

    Source code(tar.gz)
    Source code(zip)
  • v1.10.0(Apr 16, 2020)

    • db18810 Add configuration to not pre-parse multipart form data (#778) (Markmerc)
    • 402e095 Fixed case when no hijacker is added but no-response is true (#772) (Darío)
    • ea20759 Add third-party framework to README (#774) (Vic Shóstak)
    • a1cfe58 Added fastws (alphabetically) to related projects (#770) (Darío)
    • 70b1d3b feat: make client to wait when no free connections (#764) (Daniel Qian)
    • 0ba26f7 Don't retry requests with a BodyStream (Erik Dubbelboer)
    • 75c6008 client: Implement DoRedirects (#765) (Tomás Senart)
    • 38aa88a Make the prefork mode more robust (#755) (Andy Pan)
    • 0b93308 Resolve the security issue of GoSec (#762) (Andy Pan)
    • b71c8c5 Add support for NoDefaultDate option that excludes the sending of the Date header (#758) (phuslu)
    • 11e8301 Add LocalAddr to TCPDialer (Erik Dubbelboer)
    • 695f713 feat: workflow to verify security using GoSec (#747) (RENAN.BASTOS)
    • b9d2e96 Run tests on 1.14 (Erik Dubbelboer)
    • 76b74e3 Don't send the fragment/hash/# part of a URL to the server (Erik Dubbelboer)
    • aa96a47 Add prefork utility (#741) (Sergio Andrés Virviescas Santana)
    • 021c821 Fix NetHTTPServerGet benchmarks (Erik Dubbelboer)
    • b8803fe increase correctness of open conn count (#738) (Forest Gagnon)
    Source code(tar.gz)
    Source code(zip)
  • v1.9.0(Feb 4, 2020)

    • 69d5c37 Client should return ErrTimeout on timeout (#736) (Erik Dubbelboer)
    • 38e068a Fix XHR Typo (#735) (Fenny)
    • b0102c9 Support calling Serve multiple times on a Server (#731) (Erik Dubbelboer)
    Source code(tar.gz)
    Source code(zip)
  • v1.8.0(Jan 12, 2020)

    • 03813ae Fix TCPDialer is not setting ZoneID (Erik Dubbelboer)
    • 59b28fe Resolve code issues from (#725) (Andy Pan)
    • 8d8443d Forward context in fasthttpadaptor (#720) (Lovro Mažgon)
    • 16c53d6 Set StatusRequestTimeout when net timeout error occurred (#713) (谷月轩)
    Source code(tar.gz)
    Source code(zip)
  • v1.7.1(Dec 30, 2019)

    • 958ed36 Allow no response to be send when a connection is hijacked (#712) (Erik Dubbelboer)
    • 0724b3e Update LICENSE formatting (Erik Dubbelboer)
    Source code(tar.gz)
    Source code(zip)
  • v1.7.0(Dec 18, 2019)

    • 415e5fc Fix panic in header parser (Erik Dubbelboer)
    • fd55658 Improve multiline header parsing (#708) (Erik Dubbelboer)
    • 6a8a72a add extra checking of header buffer, to support multi line header value (#123) (#688) (tedli)
    • a266a92 Only show master branch on travis-ci (Erik Dubbelboer)
    • 6cccaeb Fix parsing relative URLs starting with // (#702) (Erik Dubbelboer)
    • 39dd104 Allow a body for GET requests (#703) (Erik Dubbelboer)
    • bc5b479 Custom LookupIPAddr function (#699) (Nikolay Markov)
    • 32de06d Don't start a goroutine when not needed (Erik Dubbelboer)
    • 32793db Run golangci-lint using a Github Action (Erik Dubbelboer)
    • 5f66658 Add Client.MaxConnDuration (Erik Dubbelboer)
    • 3fb2eba Ability to pass custom DNS resolver to TCPDialer (#689) (Nikolay Markov)
    • 70223a1 Recover from panic in body write (#687) (Vladimir Shteinman)
    • 87c4546 Add a badge for showing projects that use fasthttp (#685) (Andy Pan)
    Source code(tar.gz)
    Source code(zip)
  • v1.6.0(Oct 28, 2019)

    • 4489df8 Update "TechEmpower Benchmark" from round 12 to round 18 (#683) (Andy Pan)
    • 9f11af2 Make several optimizations to worker pool (#680) (Andy Pan)
    • f82a646 Requests with incomplete bodies no longer cause log noise (#682) (Kevin Burns)
    • 9bc6da1 fix: when multipartform no data,FormValue do not panic (#677) (alexDango)
    • 707b1c1 Format errors (#679) (ZhangYunHao)
    • 18c619f fasthttputil: add errInmemoryListenerClosed (#678) (ZhangYunHao)
    • bf98e3b Use least total connections instead of round robin for lbclient (#673) (Erik Dubbelboer)
    • ec2e396 Don't run TestClientNilResp in parallel (Erik Dubbelboer)
    • d428e1b Fix race condition in tests, fix URI bug (Erik Dubbelboer)
    • c3d82ca Speed up testing by running tests in parallel (Erik Dubbelboer)
    • 352ec7c Use Fatal instead of Fatalf when no formatting used (Erik Dubbelboer)
    • 9dbe5fc Don't allow spaces in request header keys (Erik Dubbelboer)
    • 4ebe993 Document PipeConns not being safe for concurrent use (Erik Dubbelboer)
    • 044d35e fix 664 (#674) (rogercarter1)
    • ffcdb75 Allow client to disable path normalization (#672) (Ian Leue)
    • af531ad Move comment to now show up on godoc (Erik Dubbelboer)
    • 28af1f1 Fix previous commit (Erik Dubbelboer)
    • 5038ebc Refactoring to reuse response status codes (#666) (Vendin)
    • b1ca43f Use 'go generate' in bytesconv.go (#663) (ZhangYunHao)
    • 97d51fb go fmt ./... (Erik Dubbelboer)
    • e6a8bcf Add go version to go.mod, test with 1.13.1 (Erik Dubbelboer)
    • 1d6a7e0 The Authorization header should include the Basic keyword (Erik Dubbelboer)
    • dc9b54d Precompute default regexp (#662) (Oleg Kovalov)
    • be93fbd Add lowerhex (ZYunH)
    • 79bd450 Use 0xf instead of 15 (ZYunH)
    • 91138ee Replace int2hexbyte with uppercase (ZYunH)
    • 9bc19f8 Replace hexCharUpeer with upperhex (#657) (ZYunH)
    • d644da4 Update (Kirill Danshin)
    • ae42116 Improve appendQuotedPath and AppendQuotedArg (#654) (ZYunH)
    • ee84500 Added option to disable path normalization (#649) (Daniel Firsht)
    • c6037ab Update fuzzit (Erik Dubbelboer)
    Source code(tar.gz)
    Source code(zip)
  • v1.5.0(Sep 14, 2019)

    • 8b0b919 Fix FasthttpSocksDialer documentation (Erik Dubbelboer)
    • b29d896 Fix fuzzit for Go 1.13 (Erik Dubbelboer)
    • ec83abe Also test with the new Go 1.13 (Erik Dubbelboer)
    • 7e6a4c8 Update dependencies (Erik Dubbelboer)
    • e5e21db Reuse the socks5 dialer (Erik Dubbelboer)
    • 8713335 Fix data race in fasthttputil.pipeConn (#645) (Kazushi Kitaya)
    • 4fa45fa Propagating custom SkipBody value to allow explicitly skip body reading for responses (#647) (Nikolay Markov)
    • 8ce231e Add stub/wrapper for reuseport.Listen on Windows platforms (#638) (andrewheberle)
    • 1241ed7 Add fuzzit support (#634) (Erik Dubbelboer)
    • d4833f6 Use ipv6-compliant methodology for joining host port (#640) (Ian Leue)
    • c5413ff A faster s2b function (#637) (ZYunH)
    • ce02b85 Add ability to set timeout for handshake (#631) (Mike Faraponov)
    • 2edabf3 Add support for user:pass in URLs (#614) (Erik Dubbelboer)
    • 85217e0 Correctly handle NoDefaultContentType without setting an Content-Type value (#628) (Ciprian Dorin Craciun)
    • b97bc32 Update README (#621) (Sergio Andrés Virviescas Santana)
    • 55ea350 Update (#610) (wencan)
    • ccaae97 Support {readTimeout,maxBodySize,writeTimeout} per request based on the headers. (#598) (Marcelo Pires)
    • a0248ed Fix read timeout with nothing read (Erik Dubbelboer)
    Source code(tar.gz)
    Source code(zip)
  • v1.4.0(Jul 9, 2019)

    • 1bd0404 Removing redundant else statement from HeaderCookie (#596) (Dair Aidarkhanov)
    • 9ba4cef Support SameSite value "None" cookie attribute (#581) (Rem)
    • 9494955 ADD TimeoutWithCodeHandler support (#589) (losingle)
    • d3715c3 :zap: Used Headers constants instead raw strings (Maxim Lebedev)
    • a4505cb :sparkles: Added headers keys constants (Maxim Lebedev)
    • f14dea7 Option for immediate header flush (#575) (Erik Dubbelboer)
    • 20ea781 Add warning to RequestCtx.Error (Erik Dubbelboer)
    • 1ee3b84 Fix Client.DoTimeout race condition (Erik Dubbelboer)
    • c754e0f Create (Kirill Danshin)
    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(May 19, 2019)

    • 3bfa86f Timing fixes (Erik Dubbelboer)
    • ed16dc0 Fix go test -bench (Erik Dubbelboer)
    • ea427d2 Fix nil Response support in Do* methods (Erik Dubbelboer)
    • 517df88 added option to keep hijacked connection open (#550) (Kirill Danshin)
    • 2d52ea9 enable 1.12 support (Kirill Danshin)
    • 64c234a reset request before ctx release; fixes #548 (Kirill Danshin)
    • 733a650 Support huge read-only []byte response bodies (#477) (Ciprian Dorin Craciun)
    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Feb 17, 2019)

    • ed3793a add tests for copyto (#545) (xuecai)
    • 6453619 Remove methods that had been deprecated in 2015 (Erik Dubbelboer)
    • 0558e34 fix context Err() issue (#544) (Tiago Peczenyj)
    • 7ace827 Add Kratgo to related projects (#543) (Sergio Andrés Virviescas Santana)
    • 10b98c2 add conn's address info in Response (#537) (xuecai)
    • 61039c9 Add zero allocation guarantee tests (Erik Dubbelboer)
    • 02b7301 Fix TechEmpower performance degradation (Erik Dubbelboer)
    • e722d81 Fix HostClient.MaxConns (Erik Dubbelboer)
    • 8b58c26 Fix ReduceMemoryUsage (Erik Dubbelboer)
    • 6647cb2 Remove duplicate check (Erik Dubbelboer)
    • fa7a110 An atomic approach for HostClient.MaxConns (#531) (Okunev Yu Dmitry)
    • 71e7652 SkipBody is propagated to Response copy (#532) (Nikolay Markov)
    • 4554824 Add TCPDialer (Erik Dubbelboer)
    • 627d63d change timer to public api #525 (#527) (xuecai)
    • aaec9b0 Make InmemoryListener.Dial return when the connection is accepted (Erik Dubbelboer)
    • 51532b9 Shutdown close channel returned by RequestCtx.Done (Erik Dubbelboer)
    • 9574c37 Various changes regarding code readibility (#523) (Shulhan)
    • 2f22f20 all: fix typo on comments (Shulhan)
    • 4c53f11 all: pre-allocated slice with possible known size (Shulhan)
    • 5de7a83 Add warning to DoTimeout (Erik Dubbelboer)
    • c3ff460 Detect 308 as redirect status code (Erik Dubbelboer)
    Source code(tar.gz)
    Source code(zip)
Aliaksandr Valialkin
Working on @VictoriaMetrics
Aliaksandr Valialkin
Reed-Solomon Erasure Coding in Go

Reed-Solomon Reed-Solomon Erasure Coding in Go, with speeds exceeding 1GB/s/cpu core implemented in pure Go. This is a Go port of the JavaReedSolomon

Klaus Post 1.3k Jul 22, 2021
A Stable & Secure Tunnel based on KCP with N:M multiplexing and FEC. Available for ARM, MIPS, 386 and AMD64。KCPプロトコルに基づく安全なトンネル。KCP 프로토콜을 기반으로 하는 보안 터널입니다。

Disclaimer: kcptun maintains a single website — Any websites other than are not endorsed by xtaci. Re

xtaci 12.5k Jul 27, 2021
IPFS implementation in Go

go-ipfs What is IPFS? IPFS is a global, versioned, peer-to-peer filesystem. It combines good ideas from previous systems such as Git, BitTorrent, Kade

IPFS 11.7k Jul 23, 2021
YoMo 18 Jul 19, 2021
Netpoll is a high-performance non-blocking I/O networking framework, which focused on RPC scenarios, developed by ByteDance.

Netpoll is a high-performance non-blocking I/O networking framework, which focused on RPC scenarios, developed by ByteDance. RPC is usually heavy on processing logic and therefore cannot handle I/O serially. But Go's standard library net designed blocking I/O API, so that the RPC framework can only follow the One Conn One Goroutine design.

CloudWeGo 669 Jul 27, 2021
A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.

frp README | 中文文档 What is frp? frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the Internet. As of now, it s

null 47k Jul 22, 2021
High performance async-io(proactor) networking for Golang。golangのための高性能非同期io(proactor)ネットワーキング

gaio Introduction 中文介绍 For a typical golang network program, you would first conn := lis.Accept() to get a connection and go func(net.Conn) to start a

xtaci 370 Jul 20, 2021
🚀 gnet is a high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go./ gnet 是一个高性能、轻量级、非阻塞的事件驱动 Go 网络框架。

English | ???? 中文 ?? Introduction gnet is an event-driven networking framework that is fast and lightweight. It makes direct epoll and kqueue syscalls

Andy Pan 4.9k Jul 24, 2021
A library for working with IP addresses and networks in Go

IPLib I really enjoy Python's ipaddress library and Ruby's ipaddr, I think you can write a lot of neat software if some of the little problems around

Chad Robinson 46 Jul 17, 2021
Send network packets over a TCP or UDP connection.

Packet is the main class representing a single network message. It has a byte code indicating the type of the message and a []byte type payload.

Aero 56 Apr 6, 2021
A Crypto-Secure, Production-Grade Reliable-UDP Library for golang with FEC

Introduction kcp-go is a Production-Grade Reliable-UDP library for golang. This library intents to provide a smooth, resilient, ordered, error-checked

xtaci 3k Jul 21, 2021
Fast RFC 5389 STUN implementation in go

STUN Package stun implements Session Traversal Utilities for NAT (STUN) [RFC5389] protocol and client with no external dependencies and zero allocatio

null 467 Jul 17, 2021
Fast RFC 5389 STUN implementation in go

STUN Package stun implements Session Traversal Utilities for NAT (STUN) [RFC5389] protocol and client with no external dependencies and zero allocatio

null 467 Jul 17, 2021