4.14 updates

This commit is contained in:
Hage Yaapa
2016-06-14 01:05:38 +05:30
parent ec896830ce
commit d5a19842e5
11 changed files with 131 additions and 22 deletions

View File

@@ -1,16 +1,8 @@
<ul>
<li>
<p><time datetime="2015-05-15 19:00">May 5, 2015</time> Ut enim ad minim veniam</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
<p class="announcement-title"><time datetime="2016-06-16 19:00">June 16, 2016</time> Express 4.14.0 released</p>
<p markdown="1">
Express 4.14.0 is a bunch of bug fixes, performance improvements, and minor feature additions. For details refer to the [4.14.0 changelog](/{{ page.lang }}/changelog/4x.html#4.14.0).
</p>
</li>
<li>
<p><time datetime="2015-05-15 19:00">May 5, 2015</time> Excepteur sint occaecat cupidatat non proident</p>
<p>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</li>
</ul>

View File

@@ -122,6 +122,8 @@
</li>
<li><a href="#req.param">req.param()</a>
</li>
<li><a href="#req.range">req.range()</a>
</li>
</ul>
</li>
<li id="res-api"><a href="#res">Response</a>

View File

@@ -0,0 +1,29 @@
<h3 id='req.range'>req.range(size[, options])</h3>
`Range` header parser.
The `size` parameter is the maximum size of the resource.
The `options` parameter is an object that can have the following properties.
| Property | Type | Description |
|-------------|-------------------------------------------------------------------------|
| `combine` | Boolean | Specify if overlapping & adjacent ranges should be combined, defaults to `false`. When `true`, ranges will be combined and returned as if they were specified that way in the header.
An array of ranges will be returned or negative numbers indicating an error parsing.
* `-2` signals a malformed header string
* `-1` signals an unsatisfiable range
```js
// parse header from request
var range = req.range(1000)
// the type of the range
if (range.type === 'bytes') {
// the ranges
range.forEach(function (r) {
// do something with r.start and r.end
})
}
```

View File

@@ -145,3 +145,8 @@ or [pez](https://www.npmjs.com/package/pez).
<section markdown="1">
{% include api/en/4x/req-param.md %}
</section>
<section markdown="1">
{% include api/en/4x/req-range.md %}
</section>

View File

@@ -11,8 +11,8 @@ res.location('back');
A `path` value of "back" has a special meaning, it refers to the URL specified in the `Referer` header of the request. If the `Referer` header was not specified, it refers to "/".
<div class='doc-box doc-warn' markdown="1">
Express passes the specified URL string as-is to the browser in the `Location` header,
without any validation or manipulation, except in case of `back`.
After encoding the URL, if not encoded already, Express passes the specified URL to the browser in the `Location` header,
without any validation.
Browsers take the responsibility of deriving the intended URL from the current URL
or the referring URL, and the URL specified in the `Location` header; and redirect the user accordingly.

View File

@@ -1,7 +1,7 @@
<h3 id='res.sendFile'>res.sendFile(path [, options] [, fn])</h3>
<div class="doc-box doc-info" markdown="1">
`res.sendFile()` is supported by Express v4.8.0 onwards
`res.sendFile()` is supported by Express v4.8.0 onwards.
</div>
Transfers the file at the given `path`. Sets the `Content-Type` response HTTP header field
@@ -19,6 +19,8 @@ The following table provides details on the `options` parameter.
| `lastModified` | Sets the `Last-Modified` header to the last modified date of the file on the OS. Set `false` to disable it.| Enabled | 4.9.0+ |
| `headers` | Object containing HTTP headers to serve with the file.| | |
| `dotfiles` | Option for serving dotfiles. Possible values are "allow", "deny", "ignore".| "ignore" | &nbsp; |
| `acceptRanges` | Enable or disable accepting ranged requests. | `true` | 4.14+ |
| `cacheControl` | Enable or disable setting `Cache-Control` response header.| `true` | 4.14+ |
</div>

View File

@@ -129,7 +129,16 @@
</li>
<li>
<a href="/{{ page.lang }}/resources/contributing.html">Contributing to Express</a>
</li>
</li>
</ul>
</li>
</ul>
</li>
<li>
<ul id="changelog-menu" class="menu">
<li><a href="/{{ page.lang }}/changelog/4x.html"{% if page.menu == 'changelog' %} class="active"{% endif %}>Changelog</a>
<ul>
<li><a href="/{{ page.lang }}/changelog/4x.html">4.x</a></li>
</ul>
</li>
</ul>

View File

@@ -72,7 +72,7 @@ strong, th {
}
#announcements {
margin: 3px 5%;
margin: 3px 5% 32px;
max-width: 1005px;
padding: 0 16px;
background: #fdfae6;
@@ -96,6 +96,7 @@ strong, th {
#announcements time {
font-weight: normal;
margin-right: 12px;
}
#announcements p:first-child {
@@ -105,6 +106,7 @@ strong, th {
background-position: 0 3px;
background-repeat: no-repeat;
background-size: 14px 14px;
margin-bottom: 11px;
}
#install-command {
@@ -258,6 +260,10 @@ a {
font-size: 12px;
}
#doc-langs p {
margin: 3px 0;
}
header {
position: fixed;
top: 0;

64
en/changelog/4x.md Normal file
View File

@@ -0,0 +1,64 @@
---
layout: page
title: Express 4.x changelog
menu: changelog
lang: en
---
## 4.14.0
{: id="4.14.0"}
<small>Release date: 2016-06-16</small>
The 4.14.0 minor release is a bunch of bug fixes, performance improvements, and minor feature additions. The most salient points are listed below.
<ul>
<li markdown="1" class="changelog-item">
This version onwards, Express supports Node.js 6.x.
</li>
<li markdown="1" class="changelog-item">
`res.sendFile` now accepts two new options, `acceptRanges` and `cacheControl`.
You can use `acceptRanges`, which defauts to `true`, to enable or disable accepting ranged requests. Disabling it will not send `Accept-Ranges` and ignore the contents of the `Range` request header.
`cacheControl`, which defaults to `true`, can be used to enable or disable setting `Cache-Control` response header. Disabling it will ignore the `maxAge` option.
`res.sendFile` has also been updated to handle `Range` header and redirections better.
</li>
<li markdown="1" class="changelog-item">
`res.location` and `res.redirect` will now URL encode the URL, if it is not already.
</li>
<li markdown="1" class="changelog-item">
You will notice great improvement in the performance of `res.json` and `res.jsonp` in most cases.
</li>
<li markdown="1" class="changelog-item">
Apart from a number of improvements in the cookie module, it now adds a `sameSite` option to let you specify the [SameSite cookie attribute](https://tools.ietf.org/html/draft-west-first-party-cookies-07).
Note that, the `SameSite` cookie attribute is an attribute that has not yet been fully standardized, and may change in the future. This also means many clients may ignore this attribute until they understand it.
The possible value for the `sameSite` option are:
- `true`, which sets the `SameSite` attribute to `Strict` for strict same site enforcement.
- `false`, which does not set the `SameSite` attribute.
- `'lax'`, which sets the `SameSite` attribute to `Lax` for lax same site enforcement.
- `'strict'`, which sets the `SameSite` attribute to `Strict` for strict same site enforcement.
</li>
<li markdown="1" class="changelog-item">
Absolute path checking on Windows, which was incorrect for some cases, has been fixed now.
</li>
<li markdown="1" class="changelog-item">
IP address(es) resolution with proxies has been greatly improved.
</li>
<li markdown="1" class="changelog-item">
The `req.range` options object now includes a `combine` option (`false` by default), which when `true`, combines overlapping and adjacent ranges and return as if they were specified that way in the header.
</li>
</ul>
For a complete list of changes in this release, you can refer to its [entry in History.md](https://github.com/expressjs/express/blob/master/History.md#4134--2016-06-16).

View File

@@ -40,15 +40,13 @@ redirect_from: "/en/index.html"
</section>
<section id="announcements">
{% include announcement/announcement-{{ page.lang }}.md %}
</section>
<section id="doc-langs" markdown="1">
Documentation translations provided by <a href="http://strongloop.com">StrongLoop/IBM</a>:
[French](/fr/), [German](/de/), [Spanish](/es/), [Italian](/it/), [Japanese](/ja/), [Russian](/ru/), [Chinese](/zh-cn/), [Traditional Chinese](/zh-tw/), [Korean](/ko/), [Portuguese](/pt-br/).
Community translation available for: [Slovak](/sk), [Ukrainian](/uk) and [Uzbek](/uz/).
</section>
<!--
<section id="announcements">
{% include announcement/announcement-{{ page.lang }}.md %}
</section>
-->

View File

@@ -157,6 +157,7 @@ $(function(){
$('#advanced-topics-menu').dropit({ action: 'click' })
$('#resources-menu').dropit({ action: 'click' })
$('#lb-menu').dropit({ action: 'click' })
$('#changelog-menu').dropit({ action: 'click' })
}
else {
$('#application-menu').dropit({ action: 'mouseenter' })
@@ -165,6 +166,7 @@ $(function(){
$('#advanced-topics-menu').dropit({ action: 'mouseenter' })
$('#resources-menu').dropit({ action: 'mouseenter' })
$('#lb-menu').dropit({ action: 'mouseenter' })
$('#changelog-menu').dropit({ action: 'mouseenter' })
}
// mobile