Commit Graph

235 Commits

Author SHA1 Message Date
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
田欧
199bbf2ae5 refactor(gin): use return not use else for reducing indent (#1031) 2017-07-17 20:11:53 -05:00
Eason Lin
75ed286c60 feat: add SecureJSON func to prevent json hijacking 2017-07-08 01:21:30 +08:00
田欧
e0fd6238d3 use comma ok and use single line (#984) 2017-07-06 09:49:54 -05:00
田欧
b985857899 update func comment (#981) 2017-07-05 20:28:16 -05:00
Eason Lin
71d3ae4f92 fix(comment): remove todo 2017-07-05 22:50:33 +08:00
田欧
d535fcd598 separate type define (#975) 2017-07-05 02:47:36 -05:00
Thomas Boerger
e38c36ee0d
Made funMaps for the templates configurable and hot-reloadable 2017-06-30 21:22:40 +02:00
田欧
6dac8c8a48 delete else keyword (#948) 2017-06-12 22:36:05 -05:00
sope
35f5df63e6 add custom Delims support (#860)
* Revert "Merge pull request #753 from gin-gonic/bug"

This reverts commit 556287ff08, reversing
changes made to 32cab500ec.

* Revert "Merge pull request #744 from aviddiviner/logger-fix"

This reverts commit c3bfd69303, reversing
changes made to 9177f01c28.

* add custom Delims support

* add some test for Delims

* remove the empty line for import native package

* remove unuseful comments
2017-05-29 03:03:49 -05:00
Javier Provecho Fernandez
c5d9c2f0fa bump version to 1.2 2017-04-07 22:18:36 +02:00
Sergey Egorov
b1872ec369 The url.RawPath used when engine.UseRawPath is set to true. (#810) 2017-02-28 18:29:41 +08:00
Franz Bettag
2ae8a25fc9 Added HandleContext to re-enter soft-rewritten Requests. (#709) 2017-02-10 22:44:55 +08:00
Bo-Yi Wu
764e138e32 Merge pull request #755 from gin-gonic/755-app-engine-client-ip
Fix #723
2016-12-06 08:14:11 -06:00
Javier Provecho Fernandez
98af44604c Update const framework version to 1.1.4 2016-12-06 14:38:14 +01:00
Javier Provecho Fernandez
7e58c80a7c Fix #723 2016-12-06 14:28:01 +01:00
Javier Provecho Fernandez
9e930b9bdd lint code 2016-04-15 01:16:46 +02:00
Manu Mtz.-Almeida
d64a1fb91c Cosmetic changes 2016-01-28 00:35:09 +01:00
Manu Mtz.-Almeida
e9531e5c76 Merge branch 'master' into develop 2016-01-26 20:08:28 +01:00
Manu Mtz.-Almeida
7afb3238a3 Improves Recovery middleware:
- request context
- red colouring
2016-01-26 18:35:56 +01:00
Kyle Mcgill
23c01faeb3 undefinitely -> indefinitely
It was bugging me :)
2015-11-04 21:03:57 +13: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
ce2201c392 router.Run() can be called without parameters. #405 2015-08-16 16:19:51 +02:00
Manu Mtz-Almeida
2b3aa51738 Template debugging 2015-08-03 17:28:12 +02:00
Manu Mtz-Almeida
fc5e355724 BasePath is not longer an exported field, but a method instead 2015-07-08 04:27:23 +02:00
error10
2b8ed80da0 RedirectTrailingSlash has no effect unless RedirectFixedPath is set
Which is not likely the desired behavior.

RedirectTrailingSlash setting is meant to cause a redirect, but the code is never called because the setting wasn't being checked. Instead RedirectFixedPath was being checked.
2015-07-04 00:05:53 -04: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
a20984c2bc Adds comments 2015-07-02 18:42:33 +02:00
Manu Mtz-Almeida
4cc2de6207 Refactors warning messages 2015-06-26 16:08:55 +02:00
Manu Mtz-Almeida
9268afb15d Cosmetic changes 2015-06-26 16:05:09 +02:00
Manu Mtz-Almeida
9e44079756 RoutesInterface includes Group() 2015-06-26 16:01:35 +02:00
Steeve Chailloux
4238c5b83d make routesInterface exported 2015-06-23 15:57:21 -05:00
Manu Mtz-Almeida
1a7ab6e4d5 Fixes gin.Routes() tests 2015-06-18 17:17:22 +02:00
Manu Mtz-Almeida
451f3b988b Merge branch 'routes-list' 2015-06-18 17:08:05 +02:00
Manu Mtz-Almeida
00b279c66b Adds SetHTMLTemplate() warning 2015-06-12 18:09:44 +02:00
Manu Mtz-Almeida
4998bc2b2e Fixes pipeline API 2015-06-11 01:02:38 +02:00
Manu Mtz-Almeida
58b5e15870 Adds ForwardedByClientIP option 2015-06-07 13:51:13 +02:00
Manu Mtz-Almeida
74fe36fa48 Routes() returns the function name of the main handler 2015-06-07 13:49:36 +02:00
Manu Mtz-Almeida
c7d2d82d01 gofmt 2015-06-07 04:26:30 +02:00
Manu Mtz-Almeida
45dd777693 List of routes 2015-06-07 04:20:39 +02:00
Manu Mtz-Almeida
0b043d0886 Fixes performance regression 2015-06-04 01:54:36 +02:00
Manu Mtz-Almeida
86824a640c Updates CHANGELOG 2015-05-31 04:33:47 +02:00
Manu Mtz-Almeida
b7a15d3554 Router optimizations
benchmark            old ns/op     new ns/op     delta
Benchmark404         249           237           -4.82%
Benchmark404Many     454           390           -14.10%
2015-05-30 15:55:19 +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
66e9feb622 Optimizes tree lookup 2015-05-29 21:03:28 +02:00
Manu Mtz-Almeida
e899d8a99e Code cleanup + documentation 2015-05-28 03:22:34 +02:00
Manu Mtz-Almeida
b96f68ce7b Fixes RunTLS() implementation
- thanks @Dal-Papa
2015-05-28 03:02:53 +02:00
Manu Mtz-Almeida
66fa43f9ae Preparing release Gin v1.0rc1 2015-05-22 16:55:16 +02:00
Manu Mtz-Almeida
5f76ba2022 Context.Engine renamed to Context.engine 2015-05-22 02:24:13 +02:00
Manu Mtz-Almeida
c2abae6840 debugPrintRoute() is called in the lowest layer of abstraction 2015-05-20 11:32:39 +02:00
Manu Mtz-Almeida
022304e7d9 Better API for RouteGroup.Handle() 2015-05-19 23:22:35 +02:00
Manu Mtz-Almeida
eb568d1a0c Removes debug variables 2015-05-19 00:48:19 +02:00
Manu Mtz-Almeida
cd6e95f0e4 Unix sockets support 2015-05-19 00:45:08 +02:00
Manu Mtz-Almeida
9ecb76ef6e Cosmetic changes 2015-05-18 20:50:46 +02:00
Manu Mtz-Almeida
947b53d4a2 New Render API 2015-05-18 15:45:24 +02:00
Manu Mtz-Almeida
3066c35754 Renames RouterGroup.absolutePath to .BasePath 2015-05-16 18:08:19 +02:00
Manu Mtz-Almeida
b690611c38 Better debug logging + unit tests 2015-05-09 03:34:43 +02:00
Manu Mtz-Almeida
eb3e9293ed Renames []HandleFunc to HandlersChain 2015-05-07 11:30:01 +02:00
Manu Mtz-Almeida
f212ae7728 Updates tree.go + fixes + unit tests 2015-05-05 16:37:33 +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
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
a4eadceb45 Merge branch 'develop' into performance
Conflicts:
	binding/form_mapping.go
	context_test.go
2015-04-07 19:59:43 +02:00
Manu Mtz-Almeida
ea962038e1 Cosmetic changes 2015-04-07 12:27:23 +02:00
Manu Mtz-Almeida
1f6304ca25 Cleaning up performance branch 2015-04-07 12:22:38 +02:00
Manu Mtz-Almeida
3faa81a464 Removes unit test in performance branch temporarily. 2015-03-31 21:53:38 +02:00
Manu Mtz-Almeida
2915fa0ffe Zero allocation router, first commit 2015-03-31 21:39:06 +02:00
Manu Mtz-Almeida
d4413b6e91 Refactors binding module 2015-03-31 17:51:10 +02:00
Manu Mtz-Almeida
4a37b0808b Refactors Context initialization 2015-03-31 17:39:30 +02:00