From 594e4eea4c360ce54300e9f6030a715bc52b0029 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 17 Jul 2015 08:24:35 +0200 Subject: [PATCH] 2.5 notes --- http/Params.md | 85 ++++++++++++++++++++++++++++++++++++++++++------- http/Url.md | 2 +- http/Url/mod.md | 11 +++++-- 3 files changed, 83 insertions(+), 15 deletions(-) diff --git a/http/Params.md b/http/Params.md index 44d90d3..7943b97 100644 --- a/http/Params.md +++ b/http/Params.md @@ -6,7 +6,8 @@ Parse, interpret and compose HTTP (header) parameters. Version | Change --------|------- -2.0.1 | Added [RFC5987](http://tools.ietf.org/html/rfc5987) support +2.1.0 | Added [RFC5987](http://tools.ietf.org/html/rfc5987) support +2.5.0 | Added [RFC5988](http://tools.ietf.org/html/rfc5987) support ## Example: @@ -47,16 +48,16 @@ Yields: array(2) { ["*rfc5987*"]=> array(2) { - ["a1"]=> - array(1) { - [""]=> - string(3) "aß" - } - ["a2"]=> - array(1) { - [""]=> - string(3) "eß" - } + ["a1"]=> + array(1) { + [""]=> + string(3) "aß" + } + ["a2"]=> + array(1) { + [""]=> + string(3) "eß" + } } ["a3"]=> string(2) "no" @@ -73,6 +74,66 @@ Yields: } string(98) "p1*=utf-8'de's%C3%BC%C3%9F,p2*=utf-8''hei%C3%9F;a1*=utf-8''a%C3%9F;a2*=utf-8''e%C3%9F;a3=no,p3=not" +## Web Linking Example: + + $link = <<; + rel="previous"; title*=UTF-8'de'letztes%20Kapitel, + ; + rel="next"; title*=UTF-8'de'n%c3%a4chstes%20Kapitel + EOF; + + $p = current(http\Header::parse($link, "http\\Header"))->getParams( + http\Params::DEF_PARAM_SEP, + http\Params::DEF_ARG_SEP, + http\Params::DEF_VAL_SEP, + http\Params::PARSE_RFC5988 | http\Params::PARSE_ESCAPED + ); + + var_dump($p->params); + var_dump((string)$p); + +Yields: + + array(2) { + ["/TheBook/chapter2"]=> + array(2) { + ["value"]=> + bool(true) + ["arguments"]=> + array(2) { + ["rel"]=> + string(8) "previous" + ["*rfc5987*"]=> + array(1) { + ["title"]=> + array(1) { + ["de"]=> + string(15) "letztes Kapitel" + } + } + } + } + ["/TheBook/chapter4"]=> + array(2) { + ["value"]=> + bool(true) + ["arguments"]=> + array(2) { + ["rel"]=> + string(4) "next" + ["*rfc5987*"]=> + array(1) { + ["title"]=> + array(1) { + ["de"]=> + string(17) "nächstes Kapitel" + } + } + } + } + } + string(139) ";rel="previous";title*=utf-8'de'letztes%20Kapitel,;rel="next";title*=utf-8'de'n%C3%A4chstes%20Kapitel" ## Constants: @@ -96,6 +157,8 @@ Yields: Parse URL querystring (same as http\Params::PARSE_URLENCODED|http\Params::PARSE_DIMENSION). * PARSE_RFC5987 Parse [RFC5987](http://tools.ietf.org/html/rfc5987) style encoded character set and language information embedded in HTTP header params. +* PARSE_RFC5988 + Parse [RFC5988](http://tools.ietf.org/html/rfc5988) (Web Linking) tags of Link headers. ## Properties: diff --git a/http/Url.md b/http/Url.md index 61ab10d..71d41e1 100644 --- a/http/Url.md +++ b/http/Url.md @@ -2,7 +2,7 @@ The http\Url class provides versatile means to parse, construct and manipulate URLs. -## Changelog +## Changelog: Version | Changes --------|-------- diff --git a/http/Url/mod.md b/http/Url/mod.md index 9fab9a8..ac474ec 100644 --- a/http/Url/mod.md +++ b/http/Url/mod.md @@ -1,4 +1,4 @@ -# http\Url http\Url::mod(mixed $parts[, int $flags = http\Url::JOIN_PATH|http\Url::JOIN_QUERY) +# http\Url http\Url::mod(mixed $parts[, int $flags = http\Url::JOIN_PATH|http\Url::JOIN_QUERY|http\Url::SANITIZE_PATH) Clone this URL and apply $parts to the cloned URL. @@ -8,7 +8,7 @@ Clone this URL and apply $parts to the cloned URL. * mixed $parts New URL parts. -* Optional int $flags = http\Url::JOIN_PATH|http\Url::JOIN_QUERY +* Optional int $flags = http\Url::JOIN_PATH|http\Url::JOIN_QUERY|http\Url::SANITIZE_PATH Modus operandi of URL construction. See http\Url constants. ## Returns: @@ -17,6 +17,11 @@ Clone this URL and apply $parts to the cloned URL. ## Throws: - * http\Exception\InvalidArgumentException * http\Exception\BadUrlException + +## Changelog: + +Version | Changes +--------|-------- +2.5.0 | Added http\Url::SANITIZE_PATH to default flags. -- 2.30.2