Comments (2)
concurrent writes occur when t.handler
writes response just after c.Writer
is changed for t.response()
.
https://github.com/gin-contrib/timeout/blob/master/timeout.go#L88
Since writer is changed to the original one, lock does not work on this line.
from timeout.
How about copying context before replacing Writer? In this case, t.handler
cannot write to copied context's writer.
+ cc := c.Copy()
+ cc.Writer = w
+ t.response(cc)
- c.Writer = w
- t.response(c)
- c.Writer = tw
from timeout.
Related Issues (18)
- [Bug] panic: http: wrote more than the declared Content-Length HOT 7
- README.md - Add WithResponse option wrong example
- Question: How can i use this middleware to all handler? HOT 3
- Incorrect timeout HOT 1
- fatal error: concurrent map writes HOT 8
- HTTP Code 204 is not properly handled HOT 2
- Headers get overwritten if using multiple custom middlewares
- panic occured while processing redirect request HOT 3
- data race
- insert stack info to error when recover from panic HOT 1
- when i download excel, timeout middleware lead to response to failed
- HTTP Response Splitting vulnerability identified HOT 2
- Data race on c.Next() and c.Abort() HOT 1
- Bug: the result will be incorrect when call gin.Context.Writer.Status() in our custom gin middleware used after this(#46) HOT 2
- Doubts about lock/unlock operating range?
- Server core dump with `fatal error: concurrent map writes`
- Combined http results HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from timeout.