Server.Shutdown was causing data race errors. One issue was that it was
possible for sync.WaitGroup.Add() to be called while Shutdown was already
calling .Wait(). To fix this I have removed the WaitGroup and replaced
it with atomic counters and a semi busy wait loop.
Fixes#416
This fixes a bug where a previous read deadline timer would be reused
for a new connection preventing Client.ReadTimeout from working
properly.
See: https://github.com/valyala/fasthttp/pull/259
Renaming a file can fail when the two files are on different devices.
Just copy if rename fails for any reason. If rename fails because of
other reaons copy will either work or fail for the same reason as well
so we won't miss any errors after this.
fasthttp returns a 431 error when the request headers are too large.
Most other HTTP servers do not log an error when the request header
exceeds the limit. When serving HTTP requests directly to browsers,
it is normal to occasionally hit the limit due to broken browsers
or broken sites linking to your resource. These issues are generally
outside of your control in the same way the already ignored errors are.
TestServerErrSmallBuffer had a small race condition where the test would
checkout the output of the logger after the client connection had been
served but before the worker had written the result to the logger.
This new code is also much faster as it doesn't actually use TCP but
just some in memory buffers.
his PR adds an option to the Server called `NoDefaultServerHeader` that
allows a user to indicate that neither the Server's `Name` field nor
the `defaultServerName` should be included in the Server's responses
as a `Server` header by default.
Now when `ResponseHeader.AppendBytes` is found to have an empty `server`
field, it simply skips the `Server` header. Previously that method
would write the `defaultServerName` when no value was found. The only
code paths that took advantage of that were ones originating from
`writeErrorResponse`, which now handles setting the server name
directly.
Fixes: https://github.com/valyala/fasthttp/issues/221