Releases: nette/http
Releases · nette/http
Released version 3.4.0
This release brings serious firepower to server-side HTTP handling. The headline is a brand-new SSRF defense kit – IPAddress and UrlValidator let you validate URLs and pin connections before your app ever talks to an attacker-controlled host. On top of that, cookie handling gets a modern overhaul with a type-safe SameSite enum, CHIPS/Partitioned support, and a proper Max-Age attribute, while the new Request::isFrom() gives you reliable same-site request detection – even on Safari. Now on PHP 8.3.
Changes
- PHP 8.3 is now required. Time to upgrade your runtime if you haven't already.
UserStorageis gone – the long-deprecated class has been removed. Use the standard authentication storage instead.Request::getRemoteHost()is deprecated and now returnsnull– reverse DNS lookups were slow, unreliable, and a privacy footgun. Resolve the hostname yourself fromgetRemoteAddress()if you really need it (#218).
Deprecations (still working, but plan ahead)
- The
IResponse::SameSite*constants are deprecated in favor of the newSameSiteenum. Request::isSameSite()is deprecated – useisFrom()instead.- Passing integer
0as the expiration toResponse::setCookie()is deprecated – usenullfor a session cookie.
✨ New Features
- SSRF protection, batteries included – the new IPAddress is an immutable IPv4/IPv6 value object with rich predicates (
isPublic(),isPrivate(),isLoopback(),isLinkLocal(),isMulticast(),isReserved()), CIDR matching viaisInRange(), and IPv4-mapped IPv6 normalization. Pair it with UrlValidator, a configurable guard that vets scheme, port, host allow/blocklists, userinfo, and – optionally with DNS – the resolved IP ranges. It even hands back the resolved IPs so you can pin the connection throughCURLOPT_RESOLVEand defeat DNS-rebinding. Request::isFrom()– a single, reliable way to check where a request came from, withsite,dest, anduserparameters built on theSec-Fetch-*headers. For browsers withoutSec-Fetchsupport (Safari < 16.4), it transparently falls back to a strict cookie, so same-site detection just works everywhere.- Type-safe
SameSiteenum –setCookie()andSessionnow accept a proper enum instead of magic strings, so typos become compile-time problems, not silent security holes. Response::setCookie()speaks modern cookie – it now supports thePartitionedattribute (CHIPS) for third-party cookies, emits aMax-Ageattribute (which takes precedence overexpiresand ignores the client clock), and forcesSecureautomatically whenSameSite=None, sparing you a browser rejection.Helpers::expirationToSeconds()– one consistent parser for every expiration value across the library. Numbers are relative seconds, whileDateTimeInterfaceand textual strings like'20 minutes'or'2024-01-01'resolve as absolute times; each caller decides whatnullmeans in its own context.Helpers::parseQualityList()– parses HTTP quality-value lists (Accept,Accept-Language, …) into a ranked token map.Request::detectLanguage()was rewritten on top of it and is more correct as a result.
Released version 3.3.4
- RequestFactory::setForceHttps() – force the request scheme to HTTPS regardless of the server environment, handy behind proxies and load balancers that don't advertise TLS termination. Also exposed via the DI config option
http: forceHttps: true. - Request::getOrigin() now strictly follows RFC 6454 – returns
nullfor anyOriginheader that isn't a barescheme://host[:port](e.g. headers containing a path are rejected instead of being silently accepted). - Improved phpDoc types and descriptions across the whole
Nette\Httpnamespace – better IDE autocompletion and PHPStan inference forRequest,Response,Session,Urland friends.
Released version 3.3.3
- support for PHP 8.5
- optimized global function calls
- Url, UrlImmutable: user & password are deprecated
Released version 3.3.2
- UrlImmutable, UrlScript: added
resolve() - Url: added
isAbsolute()&removeDotSegments() - UrlImmutable, UrlScript: removed
build()method Url::canonicalize()char " does not need to be encoded- Url, UrlImmutable: user & password are deprecated
FileUpload::__construct()accepts path- SessionPanel: convert templates to Latte-like syntax
Released version 3.3.1
- support for PHP 8.4
FileUpload::getSanitizedName()changes the extension only for image files #239- RequestFactory: extract port from x-forwarded-host (#230)
- FileUpload: Initialize properties (#235)(#195)
- Session: keep exceptions chain on session_start (#240)
- Session: SessionSection class template annotation #225
- IResponse: added DateTimeInterface to setCookie $expire param (#237)
- readonly properties
Released version 3.3.0
- requires PHP 8.1
- uses PHP 8.1 features
Released version 3.2.4
- FileUpload: added
getSuggestedExtension() - RequestFactory: unify and fix host parsing (#229)
Released version 3.2.3
- support for PHP 8.3
- FileUpload: detects supported images
- RequestFactory: fixed port detection when HTTP_HOST & SERVER_PORT are used #223
- removed fix for IE
Released version 3.2.2
- SessionExtension: don't set readAndClose if null (#213)
- Improved https recognition behind load balancer (#221)
- RequestFactory: fix X-Forwarded-Host mixup with remote host (#222)
- RequestFactory: performance optimization #220
- RequestFactory: fixed filter detection
- Url: host can end with dot #198
- added
Session::getSectionNames(), replacement forgetIterator()