85 Commits

Author SHA1 Message Date
Philipp Meinen
6bf060f179 Context.ClientIP(): only return the host's ip address
http.Request.RemoteAddr contains the client's ip address and port number.
The reverse proxy headers X-Real-Ip and X-Forwarded-For usually only contain a client's ip address.
This change ensures that the ClientIP method behaves the same in both situations.

The additional logic results in one more allocation.
BenchmarkLoggerMiddleware is affected and goes from 14 to 15 allocations.
2015-08-21 21:16:06 +02:00
Manu Mtz-Almeida
e8bc8f48e9 Merge branch 'master' into develop
Conflicts:
	README.md
	gin.go
	routergroup.go
2015-08-16 18:38:13 +02:00
Manu Mtz-Almeida
5f2f8d9cb4 Better documentation 2015-07-05 03:26:30 +02:00
Javier Provecho Fernandez
7c0c427b2d Fix #252 typo (middlewares -> middleware) 2015-07-03 20:12:01 +02:00
Manu Mtz-Almeida
8f3047814e Comments + IRoutes + IRouter + unexported AbortIndex 2015-07-02 20:24:54 +02:00
Manu Mtz-Almeida
16b08c41c9 Merge branch 'fix_is_aborted_method' of https://github.com/adwinsky/gin 2015-07-02 18:42:41 +02:00
Manu Mtz-Almeida
a20984c2bc Adds comments 2015-07-02 18:42:33 +02:00
Adam Dratwinski
74f5051cb5 Fix IsAborted() method 2015-07-02 13:37:11 +02:00
Manu Mtz-Almeida
95c08d5f84 Adds HandlerName() 2015-06-25 19:44:52 +02:00
Manu Mtz-Almeida
58b5e15870 Adds ForwardedByClientIP option 2015-06-07 13:51:13 +02:00
Manu Mtz-Almeida
70325deb98 c.ClientIP() performance improvement
benchmark                 old ns/op     new ns/op     delta
BenchmarkManyHandlers     4956          4463          -9.95%

benchmark                 old allocs     new allocs     delta
BenchmarkManyHandlers     16             13             -18.75%

benchmark                 old bytes     new bytes     delta
BenchmarkManyHandlers     256           216           -15.62%
2015-06-04 13:15:22 +02:00
Manu Mtz-Almeida
822b995687 c.JSON performance improvement
benchmark                 old ns/op     new ns/op     delta
BenchmarkOneRouteJSON     1143          1053          -7.87%

benchmark                 old allocs     new allocs     delta
BenchmarkOneRouteJSON     4              3              -25.00%

benchmark                 old bytes     new bytes     delta
BenchmarkOneRouteJSON     72            56            -22.22%
2015-06-04 13:08:29 +02:00
Manu Mtz-Almeida
56683d33b1 c.String() performance improvements
```
benchmark                   old ns/op     new ns/op     delta
BenchmarkOneRouteString     448           310           -30.80%

benchmark                   old allocs     new allocs     delta
BenchmarkOneRouteString     1              0              -100.00%

benchmark                   old bytes     new bytes     delta
BenchmarkOneRouteString     48            0             -100.00%
```
2015-06-04 12:53:42 +02:00
Manu Mtz-Almeida
1f56e50083 Using Render() instead of Write() 2015-06-04 05:25:21 +02:00
Manu Mtz-Almeida
1228b03914 Fixing some unit tests 2015-05-31 18:35:28 +02:00
Manu Mtz-Almeida
e60087f223 Fixed documentation error 2015-05-31 17:31:26 +02:00
Manu Mtz-Almeida
835f66fdc9 404 not found performance improvements
benchmark            old ns/op     new ns/op     delta
Benchmark404         737           249           -66.21%
Benchmark404Many     2330          454           -80.52%

benchmark            old allocs     new allocs     delta
Benchmark404         3              0              -100.00%
Benchmark404Many     10             0              -100.00%

benchmark            old bytes     new bytes     delta
Benchmark404         115           68            -40.87%
Benchmark404Many     235           57            -75.74%
2015-05-30 14:45:13 +02:00
Manu Mtz-Almeida
48633f7001 Better documentation 2015-05-29 21:03:41 +02:00
Manu Mtz-Almeida
e899d8a99e Code cleanup + documentation 2015-05-28 03:22:34 +02:00
Manu Mtz-Almeida
af8e099dfd Fixes multipart integration 2015-05-26 16:31:05 +02:00
Manu Mtz-Almeida
500d745123 PostForm() handles multipart post 2015-05-26 16:16:57 +02:00
Manu Mtz-Almeida
195ea88a28 Cosmetic changes 2015-05-26 12:35:05 +02:00
Manu Mtz-Almeida
d209329891 Updates documentation 2015-05-26 12:13:51 +02:00
Manu Mtz-Almeida
865ea804c9 Renames new API for query/postform and params. 2015-05-26 12:08:33 +02:00
Manu Mtz-Almeida
0a9030f9d7 ClientIP() must trim the white spaces 2015-05-24 15:35:08 +02:00
Manu Mtz-Almeida
9163ee543d Merge branch 'develop' 2015-05-22 17:00:07 +02:00
Manu Mtz-Almeida
37b6f6c179 Fixing new errors API 2015-05-22 16:39:15 +02:00
Manu Mtz-Almeida
b7205a6ec2 Fixes new errors API. 2015-05-22 03:43:39 +02:00
Manu Mtz-Almeida
e94247f9ad New errors API!! 2015-05-22 03:25:21 +02:00
Manu Mtz-Almeida
5f76ba2022 Context.Engine renamed to Context.engine 2015-05-22 02:24:13 +02:00
Manu Mtz-Almeida
66251d1741 Simplifies c.File() 2015-05-21 15:49:10 +02:00
Manu Mtz-Almeida
f9952b0545 Experimenting with golang.org/x/net/context 2015-05-18 21:26:29 +02:00
Manu Mtz-Almeida
c467186d20 Renames Negotiate.HTMLPath to Negotiate.HTMLName 2015-05-18 20:52:26 +02:00
Manu Mtz-Almeida
6313545df7 Drops c.Return() API 2015-05-18 20:51:52 +02:00
Manu Mtz-Almeida
21b5154fd7 New rendering pipeline 2015-05-18 16:09:15 +02:00
Manu Mtz-Almeida
947b53d4a2 New Render API 2015-05-18 15:45:24 +02:00
Manu Mtz-Almeida
470b7e1010 Adds support for Server-Sent Events 2015-05-12 18:33:41 +02:00
Manu Mtz-Almeida
99694bb716 Fixes errors 2015-05-12 15:22:13 +02:00
Manu Mtz-Almeida
421793bfba Experiments: HTTP streaming render 2015-05-12 15:17:46 +02:00
Manu Mtz-Almeida
3df5dfdb7f Faster IndentedJSON + unit tests 2015-05-11 01:04:08 +02:00
Manu Mtz-Almeida
d6771dc4a5 Cosmetic changes 2015-05-09 03:35:31 +02:00
Manu Mtz-Almeida
2d8f0a4801 Performance improvements when rendering
- Fast path for JSON, XML and plain text rendering
2015-05-07 12:44:52 +02:00
Manu Mtz-Almeida
eb3e9293ed Renames []HandleFunc to HandlersChain 2015-05-07 11:30:01 +02:00
Manu Mtz-Almeida
79131ac84d Tail call optimization 2015-05-07 11:28:25 +02:00
Manu Mtz-Almeida
495e6e116e Adds IndentedJSON 2015-05-06 22:31:01 +02:00
Manu Mtz-Almeida
f414648384 - More unit tests
- Improves HTML debug render
- InputHolder removed
- More debug logs
2015-05-05 15:06:38 +02:00
Sridhar Ratnakumar
ffd35c365e Fix typo/grammar in function comment 2015-04-25 21:27:04 -07:00
Manu Mtz-Almeida
0a192fb0fa Tons of unit tests 2015-04-09 12:15:02 +02:00
Manu Mtz-Almeida
4d315f474b More unit tests 2015-04-08 14:24:49 +02:00
Manu Mtz-Almeida
8b26264574 Merge branch 'develop' into performance
Conflicts:
	context.go
	context_test.go
	gin_test.go
	recovery_test.go
	utils.go
2015-04-08 13:37:25 +02:00