ziheng
3116a2d7a1
use std http method constant instead of raw string ( #2782 )
2021-07-09 10:30:44 +08:00
Lanco
9c27053243
byte alignment ( #2774 )
2021-07-04 10:37:13 +08:00
Alessandro (Ale) Segala
dd8a27c0b6
Setting trusted platform using an enum-like ( #2739 )
2021-06-24 08:58:10 +08:00
Alessandro (Ale) Segala
6703dea51c
Get client IP when using Cloudflare ( #2723 )
...
Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-05-28 10:03:59 +08:00
yiranzai
b5ca989875
set engine.TrustedProxies For items that don't use gin.RUN ( #2692 )
...
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-05-25 13:47:35 +08:00
Manu MA
bfc8ca285e
feat(engine): add trustedproxies and remoteIP ( #2632 )
...
Co-authored-by: Søren L. Hansen <soren@linux2go.dk>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
Co-authored-by: Javier Provecho Fernandez <javiertitan@gmail.com>
2021-04-06 11:37:25 +08:00
Bo-Yi Wu
d17270dd90
Sync route tree to httprouter latest code ( #2368 )
...
* update tree
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* update countParams
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* fix testing
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* update
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* udpate
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* fix testing
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* refactor gin context
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* add fullPath
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* chore: refactor
* remove unused code
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* remove varsCount
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* refactor
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2020-05-10 13:22:25 +08:00
thinkerou
6ac7f194c4
chore: update some code style ( #2356 )
2020-05-05 13:55:57 +08:00
thinkerou
54175dbe72
chore: update the result of CR ( #2354 )
...
* chore: update the result of CR
* Update utils.go
* Update utils.go
* Update context.go
* Update context.go
2020-05-04 11:40:41 +08:00
Bo-Yi Wu
2c43278080
chore(performance): Change *sync.RWMutex to sync.RWMutex ( #2351 )
2020-05-03 20:39:34 +08:00
AcoNCodes
73ccfea3ba
Add mutex for protect Context.Keys map ( #1391 )
...
* Add mutex for protect Context.Keys map
* Fix tests
Co-authored-by: Nikolay Tolkachov <nik.tolkachov@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2020-03-17 00:52:02 +08:00
Ryan J. Yoder
67008be35f
Unix Socket Handling ( #2280 )
...
* do not set unix socket permissions. Cleanup unix socket.
* removed useless error checking
2020-03-16 22:36:15 +08:00
Andy Pan
982daeb1ec
Use zero-copy approach to convert types between string and byte… ( #2206 )
...
* Use zero-copy approach to convert types between string and byte slice
* Rename argument to a eligible one
Benchmark:
BenchmarkBytesConvBytesToStrRaw-4 21003800 70.9 ns/op 96 B/op 1 allocs/op
BenchmarkBytesConvBytesToStr-4 1000000000 0.333 ns/op 0 B/op 0 allocs/op
BenchmarkBytesConvStrToBytesRaw-4 18478059 59.3 ns/op 96 B/op 1 allocs/op
BenchmarkBytesConvStrToBytes-4 1000000000 0.373 ns/op 0 B/op 0 allocs/op
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2020-01-18 00:32:50 +08:00
thinkerou
d5f12ac6d7
use http method constant ( #2155 )
...
* use http method constant
* fix typo
2019-11-29 07:50:49 +08:00
Bo-Yi Wu
352d69c71f
chore(performance): Improve performance for adding RemoveExtraS… ( #2159 )
...
* chore: Add RemoveExtraSlash flag
* fix testing
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-11-29 00:02:02 +08:00
Ngalim Siregar
231ff00d1f
Refactor redirect request in gin.go ( #1970 )
...
* Refactor redirect request in gin.go
* Update http status code
2019-11-26 08:19:30 +08:00
ishanray
517eacb4f9
Update gin.go ( #2110 )
2019-10-31 11:13:39 +08:00
Dmitry Kutakov
393a63f3b0
Fix 'errcheck' linter warnings ( #2093 )
2019-10-27 13:58:59 +08:00
Manjusaka
79840bc1c6
support run HTTP server with specific net.Listener ( #2023 )
2019-09-30 09:12:22 +08:00
Christian Muehlhaeuser
461df9320a
Simplify code ( #2004 )
...
- Use buf.String instead of converison
- Remove redundant return
2019-07-27 09:06:37 +08:00
Roman Zaynetdinov
35e33d3638
Hold matched route full path in the Context ( #1826 )
...
* Return nodeValue from getValue method
* Hold route full path in the Context
* Add small example
2019-05-26 08:20:21 +08:00
Dan Markham
b6425689dc
Clean the Request Path early ( #1817 )
...
This will reduce the number of times we have todo a redirect.
and allow multiple slashes in path to be routed!
fixes #1644
2019-05-07 19:32:35 +08:00
Riverside
057f63b1bb
spell check ( #1796 )
...
* spell check
* variable path collides with imported package name
* spell check
2019-03-05 09:41:37 +08:00
Tudor Roman
ccb105dbcb
add prefix from X-Forwarded-Prefix in redirectTrailingSlash ( #1238 )
...
* add prefix from X-Forwarded-Prefix in redirectTrailingSlash
* added test
* fix path import
2019-02-27 19:56:29 +08:00
Mara Kim
4e86b17e73
Set socket to recieve writes ( #1134 )
...
* Set socket to recieve writes
* Update gin.go
2019-02-22 11:45:32 +08:00
Dmitry Kutakov
a768f064d5
fix many redirects ( #1760 ) ( #1764 )
...
* fix many redirects (#1760 )
* fix @thinkerou review
2019-02-18 09:35:08 +08:00
Dmitry Kutakov
b056a34bdc
fix errcheck warnings ( #1739 )
2019-01-18 09:32:53 +08:00
Yoshiki Nakagawa
66b47a8068
feat(server): Implements RunFd method ( #1609 )
2018-11-06 10:28:51 +08:00
Thomas Schaffer
c65e5efc9a
Expose HandlerFunc in RouteInfos ( #1272 )
2018-10-23 10:56:33 +08:00
James Pettyjohn
e9f187f60a
removed use of sync.pool from HandleContext and added test coverage ( #1565 )
...
As per #1230 there is an issue when using HandleContext where the context of the request is returned to the context sync.Pool before the parent request has finished, causing context to be used in a non-thread safe manner.
I've removed the bug by not entering the context back in the pool and leaving that to ServeHTTP.
There was no test coverage for this function so I've also added the test to cover it. As the bug only happens when there are concurrent requests, the tests issues hundreds of concurrent requests. Without the bug fixed the tests do consistently recreate the error.
2018-10-01 10:49:39 +08:00
田欧
b27b7026c7
chore: add a version file includes gin version ( #1549 )
...
* chore: add a version file includes gin version
* update version for dev version
2018-09-17 15:08:11 +08:00
田欧
6db092f778
chore: add some annotations ( #1550 )
...
ref #1075 should all annotations and can close #1075 .
2018-09-15 15:21:54 +08:00
Javier Provecho Fernandez
b869fe1415
docs: add changelog for v1.3.0, update authors and version const ( #1478 )
...
* docs: add changelog for v1.3.0, update authors and version const
* add link for every referenced pull request (#1481 )
* docs: add changelog for v1.3.0, update authors and version const
* add link for pr
2018-08-14 10:58:52 +02:00
田欧
e5bb4f62a2
chore: add return or remove else for reduce indent ( #1470 )
2018-08-12 21:17:57 +08:00
田欧
1c4cbfae59
chore: remove duplicate code ( #1418 )
2018-07-02 11:06:56 +08:00
田欧
6c6d97ba2e
remove hardcode instead of http status value ( #1411 )
2018-06-26 17:21:32 +08:00
chainhelen
07cbe116a0
Add and fix the explanation of `HandleContext` ( #1371 )
...
Reference this issue #1323
1. There isn't any eg about `HandleContext`
2. The `c.Request.Path` of `HandleContext` Comment is not right
Based on the above two points, I pull this request.
If you think it's unnecessary, I will close this.
Thx.
2018-05-30 09:19:04 +08:00
Weilin Shi
a712f77d7a
Fix some golint warnings in gin.go ( #1215 )
2017-12-29 17:10:28 +08:00
Boris Borshevsky
6f94fd05c9
Linting and optimizing struct memory signature. ( #1184 )
...
* fix cleanPath spell (#969 )
* linter and optimize structs
2017-11-29 10:50:14 +08:00
田欧
9a4ecc87d6
format some codes style ( #1165 )
2017-11-11 23:24:51 -06:00
田欧
1e88466d23
Update the comment of Version ( #1141 )
2017-10-25 21:25:25 -05:00
田欧
0cb7c44abc
Print warning log when user create one engine using gin.Default in debug mode ( #1121 )
...
* empty string check
* add log when use Default
* fix unit test error
* fix unit test error
2017-09-29 11:58:57 +08:00
田欧
3b300929e8
Empty string check ( #1101 )
2017-09-29 00:22:35 +08:00
田欧
f7376f7c7f
combine var and use tmp var ( #1108 )
2017-09-28 22:54:37 +08:00
Daniel M. Lambea
c9b344118f
Moved const 'defaultMemory' to attrib. Engine.MaxMultipartMemory instead. ( #1100 )
2017-09-07 11:45:16 +08:00
田欧
c25254f563
reduce go cyclo ( #1076 )
...
* reduce go cyclo
* use := var
2017-08-24 20:00:49 -05:00
田欧
a8fa424ae5
update comment ( #1057 )
2017-08-16 11:55:50 +08:00
田欧
25d20a4463
merge args if it have same type ( #1059 )
2017-08-14 12:21:05 +08:00
Eason Lin
4b54b86272
fix composite literal uses unkeyed fields warnings, #1050 ( #1051 )
2017-08-02 23:00:10 +08:00
田欧
7b508186dd
style: remove optional return ( #1036 )
2017-07-19 14:49:18 +02:00