referer to referrer

Gerasimos (Makis) Maropoulos 2020-06-11 04:16:35 +03:00
parent 6ad0e5ab5b
commit dd9142d529
No known key found for this signature in database
GPG Key ID: 5DBE766BD26A54E7
4 changed files with 21 additions and 20 deletions

@ -1,12 +1,13 @@
The HTTP referer(originally a misspelling of **referrer**) is an optional HTTP header field that identifies the address of the webpage (i.e. the URI or IRI) which is linked to the resource being requested. By checking the referrer, the new webpage can see where the request originated. The Referrer-Policy HTTP header controls how much referrer information (sent via the Referer header) should be included with requests.
Read more at [wikipedia](https://en.wikipedia.org/wiki/HTTP_referer) Read more at [developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy)
-------- --------
Iris uses the [Shopify's goreferrer](https://github.com/Shopify/goreferrer/pull/27) package to expose the `Context.GetReferrer()` method. Iris uses the [Shopify's goreferrer](https://github.com/Shopify/goreferrer/pull/27) package to expose the `Context.GetReferrer()` method.
The `GetReferrer` Context's method extracts and returns the information from the `"Referer"` header as specified in https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy or by the URL `query parameter "referer"`. The `GetReferrer` method extracts and returns the information from the `"Referer"` (or `"Referrer"`) header
and url query parameter as specified in https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy.
```go ```go
GetReferrer() Referrer GetReferrer() Referrer
@ -79,9 +80,9 @@ How to `curl`:
```sh ```sh
curl http://localhost:8080?\ curl http://localhost:8080?\
referer=https://twitter.com/Xinterio/status/1023566830974251008 referrer=https://twitter.com/Xinterio/status/1023566830974251008
curl http://localhost:8080?\ curl http://localhost:8080?\
referer=https://www.google.com/search?q=Top+6+golang+web+frameworks\ referrer=https://www.google.com/search?q=Top+6+golang+web+frameworks\
&oq=Top+6+golang+web+frameworks &oq=Top+6+golang+web+frameworks
``` ```

@ -25,7 +25,7 @@ This wiki is the main source of documentation for **developers** working with (o
* [[API Versioning]] * [[API Versioning]]
* [[Content Negotiation]] * [[Content Negotiation]]
* [[Response Recorder]] * [[Response Recorder]]
* [[HTTP Referer]] * [[HTTP Referrer]]
* [[Request Authentication]] * [[Request Authentication]]
* [[URL Query Parameters]] * [[URL Query Parameters]]
* [[Forms]] * [[Forms]]

8
MVC.md

@ -55,7 +55,7 @@ func (m *MyController) BeforeActivation(b mvc.BeforeActivation) {
// 2-> Path // 2-> Path
// 3-> The controller's function name to be parsed as handler // 3-> The controller's function name to be parsed as handler
// 4-> Any handlers that should run before the MyCustomHandler // 4-> Any handlers that should run before the MyCustomHandler
b.Handle("GET", "/something/{id:long}", "MyCustomHandler", anyMiddleware...) b.Handle("GET", "/something/{id:int64}", "MyCustomHandler", anyMiddleware...)
} }
// GET: http://localhost:8080/root // GET: http://localhost:8080/root
@ -63,7 +63,7 @@ func (m *MyController) Get() string {
return "Hey" return "Hey"
} }
// GET: http://localhost:8080/root/something/{id:long} // GET: http://localhost:8080/root/something/{id:int64}
func (m *MyController) MyCustomHandler(id int64) string { func (m *MyController) MyCustomHandler(id int64) string {
return "MyCustomHandler says Hey" return "MyCustomHandler says Hey"
} }
@ -104,8 +104,8 @@ If `mvc.New(app.Party("/user")).Handle(new(user.Controller))`
- `func(*Controller) PostLogin()` - `POST:/user/login` - `func(*Controller) PostLogin()` - `POST:/user/login`
- `func(*Controller) GetProfileFollowers()` - `GET:/user/profile/followers` - `func(*Controller) GetProfileFollowers()` - `GET:/user/profile/followers`
- `func(*Controller) PostProfileFollowers()` - `POST:/user/profile/followers` - `func(*Controller) PostProfileFollowers()` - `POST:/user/profile/followers`
- `func(*Controller) GetBy(id int64)` - `GET:/user/{param:long}` - `func(*Controller) GetBy(id int64)` - `GET:/user/{param:int64}`
- `func(*Controller) PostBy(id int64)` - `POST:/user/{param:long}` - `func(*Controller) PostBy(id int64)` - `POST:/user/{param:int64}`
If `mvc.New(app.Party("/profile")).Handle(new(profile.Controller))` If `mvc.New(app.Party("/profile")).Handle(new(profile.Controller))`

@ -3,7 +3,7 @@
* [[Benchmarks]] * [[Benchmarks]]
* [[Support]] * [[Support]]
* [[Installing Iris|Installation]] * [[Installing Iris|Installation]]
* [[Getting Started]] * [[Getting Started|getting-started]]
* [[Host]] * [[Host]]
* [[Automatic Public Domain with TLS|Automatic-public-address]] * [[Automatic Public Domain with TLS|Automatic-public-address]]
* [[Configuration]] * [[Configuration]]
@ -16,17 +16,17 @@
* [[Wrap the Router|Routing-wrap-the-router]] * [[Wrap the Router|Routing-wrap-the-router]]
* [[Override Context|Routing-override-context]] * [[Override Context|Routing-override-context]]
* [[Context Methods|Routing-context-methods]] * [[Context Methods|Routing-context-methods]]
* [[HTTP Method Override]] * [[HTTP Method Override|HTTP-method-override]]
* [[API Versioning]] * [[API Versioning|api-versioning]]
* [[Content Negotiation]] * [[Content Negotiation|content-negotiation]]
* [[Response Recorder]] * [[Response Recorder|response-recorder]]
* [[HTTP Referer]] * [[HTTP Referrer|HTTP-referrer]]
* [[Request Authentication]] * [[Request Authentication|Request-authentication]]
* [[URL Query Parameters]] * [[URL Query Parameters|url-query-parameters]]
* [[Forms]] * [[Forms]]
* [[Model Validation]] * [[Model Validation|model-validation]]
* [[Cache]] * [[Cache]]
* [[File Server]] * [[File Server|file-server]]
* [[View]] * [[View]]
* [[Cookies]] * [[Cookies]]
* [[Sessions]] * [[Sessions]]