@@ -16,728 +16,728 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class Uri implements UriInterface, \JsonSerializable |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * Absolute http and https URIs require a host per RFC 7230 Section 2.7 |
|
| 21 | - * but in generic URIs the host can be empty. So for http(s) URIs |
|
| 22 | - * we apply this default host when no host is given yet to form a |
|
| 23 | - * valid URI. |
|
| 24 | - */ |
|
| 25 | - private const HTTP_DEFAULT_HOST = 'localhost'; |
|
| 26 | - |
|
| 27 | - private const DEFAULT_PORTS = [ |
|
| 28 | - 'http' => 80, |
|
| 29 | - 'https' => 443, |
|
| 30 | - 'ftp' => 21, |
|
| 31 | - 'gopher' => 70, |
|
| 32 | - 'nntp' => 119, |
|
| 33 | - 'news' => 119, |
|
| 34 | - 'telnet' => 23, |
|
| 35 | - 'tn3270' => 23, |
|
| 36 | - 'imap' => 143, |
|
| 37 | - 'pop' => 110, |
|
| 38 | - 'ldap' => 389, |
|
| 39 | - ]; |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * Unreserved characters for use in a regex. |
|
| 43 | - * |
|
| 44 | - * @see https://datatracker.ietf.org/doc/html/rfc3986#section-2.3 |
|
| 45 | - */ |
|
| 46 | - private const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~'; |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * Sub-delims for use in a regex. |
|
| 50 | - * |
|
| 51 | - * @see https://datatracker.ietf.org/doc/html/rfc3986#section-2.2 |
|
| 52 | - */ |
|
| 53 | - private const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;='; |
|
| 54 | - private const QUERY_SEPARATORS_REPLACEMENT = ['=' => '%3D', '&' => '%26']; |
|
| 55 | - |
|
| 56 | - /** @var string Uri scheme. */ |
|
| 57 | - private $scheme = ''; |
|
| 58 | - |
|
| 59 | - /** @var string Uri user info. */ |
|
| 60 | - private $userInfo = ''; |
|
| 61 | - |
|
| 62 | - /** @var string Uri host. */ |
|
| 63 | - private $host = ''; |
|
| 64 | - |
|
| 65 | - /** @var int|null Uri port. */ |
|
| 66 | - private $port; |
|
| 67 | - |
|
| 68 | - /** @var string Uri path. */ |
|
| 69 | - private $path = ''; |
|
| 70 | - |
|
| 71 | - /** @var string Uri query string. */ |
|
| 72 | - private $query = ''; |
|
| 73 | - |
|
| 74 | - /** @var string Uri fragment. */ |
|
| 75 | - private $fragment = ''; |
|
| 76 | - |
|
| 77 | - /** @var string|null String representation */ |
|
| 78 | - private $composedComponents; |
|
| 79 | - |
|
| 80 | - public function __construct(string $uri = '') |
|
| 81 | - { |
|
| 82 | - if ($uri !== '') { |
|
| 83 | - $parts = self::parse($uri); |
|
| 84 | - if ($parts === false) { |
|
| 85 | - throw new MalformedUriException("Unable to parse URI: $uri"); |
|
| 86 | - } |
|
| 87 | - $this->applyParts($parts); |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * UTF-8 aware \parse_url() replacement. |
|
| 93 | - * |
|
| 94 | - * The internal function produces broken output for non ASCII domain names |
|
| 95 | - * (IDN) when used with locales other than "C". |
|
| 96 | - * |
|
| 97 | - * On the other hand, cURL understands IDN correctly only when UTF-8 locale |
|
| 98 | - * is configured ("C.UTF-8", "en_US.UTF-8", etc.). |
|
| 99 | - * |
|
| 100 | - * @see https://bugs.php.net/bug.php?id=52923 |
|
| 101 | - * @see https://www.php.net/manual/en/function.parse-url.php#114817 |
|
| 102 | - * @see https://curl.haxx.se/libcurl/c/CURLOPT_URL.html#ENCODING |
|
| 103 | - * |
|
| 104 | - * @return array|false |
|
| 105 | - */ |
|
| 106 | - private static function parse(string $url) |
|
| 107 | - { |
|
| 108 | - // If IPv6 |
|
| 109 | - $prefix = ''; |
|
| 110 | - if (preg_match('%^(.*://\[[0-9:a-f]+\])(.*?)$%', $url, $matches)) { |
|
| 111 | - /** @var array{0:string, 1:string, 2:string} $matches */ |
|
| 112 | - $prefix = $matches[1]; |
|
| 113 | - $url = $matches[2]; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - /** @var string */ |
|
| 117 | - $encodedUrl = preg_replace_callback( |
|
| 118 | - '%[^:/@?&=#]+%usD', |
|
| 119 | - static function ($matches) { |
|
| 120 | - return urlencode($matches[0]); |
|
| 121 | - }, |
|
| 122 | - $url |
|
| 123 | - ); |
|
| 124 | - |
|
| 125 | - $result = parse_url($prefix.$encodedUrl); |
|
| 126 | - |
|
| 127 | - if ($result === false) { |
|
| 128 | - return false; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - return array_map('urldecode', $result); |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - public function __toString(): string |
|
| 135 | - { |
|
| 136 | - if ($this->composedComponents === null) { |
|
| 137 | - $this->composedComponents = self::composeComponents( |
|
| 138 | - $this->scheme, |
|
| 139 | - $this->getAuthority(), |
|
| 140 | - $this->path, |
|
| 141 | - $this->query, |
|
| 142 | - $this->fragment |
|
| 143 | - ); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - return $this->composedComponents; |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * Composes a URI reference string from its various components. |
|
| 151 | - * |
|
| 152 | - * Usually this method does not need to be called manually but instead is used indirectly via |
|
| 153 | - * `OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\UriInterface::__toString`. |
|
| 154 | - * |
|
| 155 | - * PSR-7 UriInterface treats an empty component the same as a missing component as |
|
| 156 | - * getQuery(), getFragment() etc. always return a string. This explains the slight |
|
| 157 | - * difference to RFC 3986 Section 5.3. |
|
| 158 | - * |
|
| 159 | - * Another adjustment is that the authority separator is added even when the authority is missing/empty |
|
| 160 | - * for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with |
|
| 161 | - * `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But |
|
| 162 | - * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to |
|
| 163 | - * that format). |
|
| 164 | - * |
|
| 165 | - * @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.3 |
|
| 166 | - */ |
|
| 167 | - public static function composeComponents(?string $scheme, ?string $authority, string $path, ?string $query, ?string $fragment): string |
|
| 168 | - { |
|
| 169 | - $uri = ''; |
|
| 170 | - |
|
| 171 | - // weak type checks to also accept null until we can add scalar type hints |
|
| 172 | - if ($scheme != '') { |
|
| 173 | - $uri .= $scheme.':'; |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - if ($authority != '' || $scheme === 'file') { |
|
| 177 | - $uri .= '//'.$authority; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - if ($authority != '' && $path != '' && $path[0] != '/') { |
|
| 181 | - $path = '/'.$path; |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - $uri .= $path; |
|
| 185 | - |
|
| 186 | - if ($query != '') { |
|
| 187 | - $uri .= '?'.$query; |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - if ($fragment != '') { |
|
| 191 | - $uri .= '#'.$fragment; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - return $uri; |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - /** |
|
| 198 | - * Whether the URI has the default port of the current scheme. |
|
| 199 | - * |
|
| 200 | - * `OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used |
|
| 201 | - * independently of the implementation. |
|
| 202 | - */ |
|
| 203 | - public static function isDefaultPort(UriInterface $uri): bool |
|
| 204 | - { |
|
| 205 | - return $uri->getPort() === null |
|
| 206 | - || (isset(self::DEFAULT_PORTS[$uri->getScheme()]) && $uri->getPort() === self::DEFAULT_PORTS[$uri->getScheme()]); |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - /** |
|
| 210 | - * Whether the URI is absolute, i.e. it has a scheme. |
|
| 211 | - * |
|
| 212 | - * An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true |
|
| 213 | - * if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative |
|
| 214 | - * to another URI, the base URI. Relative references can be divided into several forms: |
|
| 215 | - * - network-path references, e.g. '//example.com/path' |
|
| 216 | - * - absolute-path references, e.g. '/path' |
|
| 217 | - * - relative-path references, e.g. 'subpath' |
|
| 218 | - * |
|
| 219 | - * @see Uri::isNetworkPathReference |
|
| 220 | - * @see Uri::isAbsolutePathReference |
|
| 221 | - * @see Uri::isRelativePathReference |
|
| 222 | - * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4 |
|
| 223 | - */ |
|
| 224 | - public static function isAbsolute(UriInterface $uri): bool |
|
| 225 | - { |
|
| 226 | - return $uri->getScheme() !== ''; |
|
| 227 | - } |
|
| 228 | - |
|
| 229 | - /** |
|
| 230 | - * Whether the URI is a network-path reference. |
|
| 231 | - * |
|
| 232 | - * A relative reference that begins with two slash characters is termed an network-path reference. |
|
| 233 | - * |
|
| 234 | - * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2 |
|
| 235 | - */ |
|
| 236 | - public static function isNetworkPathReference(UriInterface $uri): bool |
|
| 237 | - { |
|
| 238 | - return $uri->getScheme() === '' && $uri->getAuthority() !== ''; |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - /** |
|
| 242 | - * Whether the URI is a absolute-path reference. |
|
| 243 | - * |
|
| 244 | - * A relative reference that begins with a single slash character is termed an absolute-path reference. |
|
| 245 | - * |
|
| 246 | - * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2 |
|
| 247 | - */ |
|
| 248 | - public static function isAbsolutePathReference(UriInterface $uri): bool |
|
| 249 | - { |
|
| 250 | - return $uri->getScheme() === '' |
|
| 251 | - && $uri->getAuthority() === '' |
|
| 252 | - && isset($uri->getPath()[0]) |
|
| 253 | - && $uri->getPath()[0] === '/'; |
|
| 254 | - } |
|
| 255 | - |
|
| 256 | - /** |
|
| 257 | - * Whether the URI is a relative-path reference. |
|
| 258 | - * |
|
| 259 | - * A relative reference that does not begin with a slash character is termed a relative-path reference. |
|
| 260 | - * |
|
| 261 | - * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2 |
|
| 262 | - */ |
|
| 263 | - public static function isRelativePathReference(UriInterface $uri): bool |
|
| 264 | - { |
|
| 265 | - return $uri->getScheme() === '' |
|
| 266 | - && $uri->getAuthority() === '' |
|
| 267 | - && (!isset($uri->getPath()[0]) || $uri->getPath()[0] !== '/'); |
|
| 268 | - } |
|
| 269 | - |
|
| 270 | - /** |
|
| 271 | - * Whether the URI is a same-document reference. |
|
| 272 | - * |
|
| 273 | - * A same-document reference refers to a URI that is, aside from its fragment |
|
| 274 | - * component, identical to the base URI. When no base URI is given, only an empty |
|
| 275 | - * URI reference (apart from its fragment) is considered a same-document reference. |
|
| 276 | - * |
|
| 277 | - * @param UriInterface $uri The URI to check |
|
| 278 | - * @param UriInterface|null $base An optional base URI to compare against |
|
| 279 | - * |
|
| 280 | - * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.4 |
|
| 281 | - */ |
|
| 282 | - public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool |
|
| 283 | - { |
|
| 284 | - if ($base !== null) { |
|
| 285 | - $uri = UriResolver::resolve($base, $uri); |
|
| 286 | - |
|
| 287 | - return ($uri->getScheme() === $base->getScheme()) |
|
| 288 | - && ($uri->getAuthority() === $base->getAuthority()) |
|
| 289 | - && ($uri->getPath() === $base->getPath()) |
|
| 290 | - && ($uri->getQuery() === $base->getQuery()); |
|
| 291 | - } |
|
| 292 | - |
|
| 293 | - return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === ''; |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - /** |
|
| 297 | - * Creates a new URI with a specific query string value removed. |
|
| 298 | - * |
|
| 299 | - * Any existing query string values that exactly match the provided key are |
|
| 300 | - * removed. |
|
| 301 | - * |
|
| 302 | - * @param UriInterface $uri URI to use as a base. |
|
| 303 | - * @param string $key Query string key to remove. |
|
| 304 | - */ |
|
| 305 | - public static function withoutQueryValue(UriInterface $uri, string $key): UriInterface |
|
| 306 | - { |
|
| 307 | - $result = self::getFilteredQueryString($uri, [$key]); |
|
| 308 | - |
|
| 309 | - return $uri->withQuery(implode('&', $result)); |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - /** |
|
| 313 | - * Creates a new URI with a specific query string value. |
|
| 314 | - * |
|
| 315 | - * Any existing query string values that exactly match the provided key are |
|
| 316 | - * removed and replaced with the given key value pair. |
|
| 317 | - * |
|
| 318 | - * A value of null will set the query string key without a value, e.g. "key" |
|
| 319 | - * instead of "key=value". |
|
| 320 | - * |
|
| 321 | - * @param UriInterface $uri URI to use as a base. |
|
| 322 | - * @param string $key Key to set. |
|
| 323 | - * @param string|null $value Value to set |
|
| 324 | - */ |
|
| 325 | - public static function withQueryValue(UriInterface $uri, string $key, ?string $value): UriInterface |
|
| 326 | - { |
|
| 327 | - $result = self::getFilteredQueryString($uri, [$key]); |
|
| 328 | - |
|
| 329 | - $result[] = self::generateQueryString($key, $value); |
|
| 330 | - |
|
| 331 | - return $uri->withQuery(implode('&', $result)); |
|
| 332 | - } |
|
| 333 | - |
|
| 334 | - /** |
|
| 335 | - * Creates a new URI with multiple specific query string values. |
|
| 336 | - * |
|
| 337 | - * It has the same behavior as withQueryValue() but for an associative array of key => value. |
|
| 338 | - * |
|
| 339 | - * @param UriInterface $uri URI to use as a base. |
|
| 340 | - * @param (string|null)[] $keyValueArray Associative array of key and values |
|
| 341 | - */ |
|
| 342 | - public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface |
|
| 343 | - { |
|
| 344 | - $result = self::getFilteredQueryString($uri, array_keys($keyValueArray)); |
|
| 345 | - |
|
| 346 | - foreach ($keyValueArray as $key => $value) { |
|
| 347 | - $result[] = self::generateQueryString((string) $key, $value !== null ? (string) $value : null); |
|
| 348 | - } |
|
| 349 | - |
|
| 350 | - return $uri->withQuery(implode('&', $result)); |
|
| 351 | - } |
|
| 352 | - |
|
| 353 | - /** |
|
| 354 | - * Creates a URI from a hash of `parse_url` components. |
|
| 355 | - * |
|
| 356 | - * @see https://www.php.net/manual/en/function.parse-url.php |
|
| 357 | - * |
|
| 358 | - * @throws MalformedUriException If the components do not form a valid URI. |
|
| 359 | - */ |
|
| 360 | - public static function fromParts(array $parts): UriInterface |
|
| 361 | - { |
|
| 362 | - $uri = new self(); |
|
| 363 | - $uri->applyParts($parts); |
|
| 364 | - $uri->validateState(); |
|
| 365 | - |
|
| 366 | - return $uri; |
|
| 367 | - } |
|
| 368 | - |
|
| 369 | - public function getScheme(): string |
|
| 370 | - { |
|
| 371 | - return $this->scheme; |
|
| 372 | - } |
|
| 373 | - |
|
| 374 | - public function getAuthority(): string |
|
| 375 | - { |
|
| 376 | - $authority = $this->host; |
|
| 377 | - if ($this->userInfo !== '') { |
|
| 378 | - $authority = $this->userInfo.'@'.$authority; |
|
| 379 | - } |
|
| 380 | - |
|
| 381 | - if ($this->port !== null) { |
|
| 382 | - $authority .= ':'.$this->port; |
|
| 383 | - } |
|
| 384 | - |
|
| 385 | - return $authority; |
|
| 386 | - } |
|
| 387 | - |
|
| 388 | - public function getUserInfo(): string |
|
| 389 | - { |
|
| 390 | - return $this->userInfo; |
|
| 391 | - } |
|
| 392 | - |
|
| 393 | - public function getHost(): string |
|
| 394 | - { |
|
| 395 | - return $this->host; |
|
| 396 | - } |
|
| 397 | - |
|
| 398 | - public function getPort(): ?int |
|
| 399 | - { |
|
| 400 | - return $this->port; |
|
| 401 | - } |
|
| 402 | - |
|
| 403 | - public function getPath(): string |
|
| 404 | - { |
|
| 405 | - return $this->path; |
|
| 406 | - } |
|
| 407 | - |
|
| 408 | - public function getQuery(): string |
|
| 409 | - { |
|
| 410 | - return $this->query; |
|
| 411 | - } |
|
| 412 | - |
|
| 413 | - public function getFragment(): string |
|
| 414 | - { |
|
| 415 | - return $this->fragment; |
|
| 416 | - } |
|
| 417 | - |
|
| 418 | - public function withScheme($scheme): UriInterface |
|
| 419 | - { |
|
| 420 | - $scheme = $this->filterScheme($scheme); |
|
| 421 | - |
|
| 422 | - if ($this->scheme === $scheme) { |
|
| 423 | - return $this; |
|
| 424 | - } |
|
| 425 | - |
|
| 426 | - $new = clone $this; |
|
| 427 | - $new->scheme = $scheme; |
|
| 428 | - $new->composedComponents = null; |
|
| 429 | - $new->removeDefaultPort(); |
|
| 430 | - $new->validateState(); |
|
| 431 | - |
|
| 432 | - return $new; |
|
| 433 | - } |
|
| 434 | - |
|
| 435 | - public function withUserInfo($user, $password = null): UriInterface |
|
| 436 | - { |
|
| 437 | - $info = $this->filterUserInfoComponent($user); |
|
| 438 | - if ($password !== null) { |
|
| 439 | - $info .= ':'.$this->filterUserInfoComponent($password); |
|
| 440 | - } |
|
| 441 | - |
|
| 442 | - if ($this->userInfo === $info) { |
|
| 443 | - return $this; |
|
| 444 | - } |
|
| 445 | - |
|
| 446 | - $new = clone $this; |
|
| 447 | - $new->userInfo = $info; |
|
| 448 | - $new->composedComponents = null; |
|
| 449 | - $new->validateState(); |
|
| 450 | - |
|
| 451 | - return $new; |
|
| 452 | - } |
|
| 453 | - |
|
| 454 | - public function withHost($host): UriInterface |
|
| 455 | - { |
|
| 456 | - $host = $this->filterHost($host); |
|
| 457 | - |
|
| 458 | - if ($this->host === $host) { |
|
| 459 | - return $this; |
|
| 460 | - } |
|
| 461 | - |
|
| 462 | - $new = clone $this; |
|
| 463 | - $new->host = $host; |
|
| 464 | - $new->composedComponents = null; |
|
| 465 | - $new->validateState(); |
|
| 466 | - |
|
| 467 | - return $new; |
|
| 468 | - } |
|
| 469 | - |
|
| 470 | - public function withPort($port): UriInterface |
|
| 471 | - { |
|
| 472 | - $port = $this->filterPort($port); |
|
| 473 | - |
|
| 474 | - if ($this->port === $port) { |
|
| 475 | - return $this; |
|
| 476 | - } |
|
| 477 | - |
|
| 478 | - $new = clone $this; |
|
| 479 | - $new->port = $port; |
|
| 480 | - $new->composedComponents = null; |
|
| 481 | - $new->removeDefaultPort(); |
|
| 482 | - $new->validateState(); |
|
| 483 | - |
|
| 484 | - return $new; |
|
| 485 | - } |
|
| 486 | - |
|
| 487 | - public function withPath($path): UriInterface |
|
| 488 | - { |
|
| 489 | - $path = $this->filterPath($path); |
|
| 490 | - |
|
| 491 | - if ($this->path === $path) { |
|
| 492 | - return $this; |
|
| 493 | - } |
|
| 494 | - |
|
| 495 | - $new = clone $this; |
|
| 496 | - $new->path = $path; |
|
| 497 | - $new->composedComponents = null; |
|
| 498 | - $new->validateState(); |
|
| 499 | - |
|
| 500 | - return $new; |
|
| 501 | - } |
|
| 502 | - |
|
| 503 | - public function withQuery($query): UriInterface |
|
| 504 | - { |
|
| 505 | - $query = $this->filterQueryAndFragment($query); |
|
| 506 | - |
|
| 507 | - if ($this->query === $query) { |
|
| 508 | - return $this; |
|
| 509 | - } |
|
| 510 | - |
|
| 511 | - $new = clone $this; |
|
| 512 | - $new->query = $query; |
|
| 513 | - $new->composedComponents = null; |
|
| 514 | - |
|
| 515 | - return $new; |
|
| 516 | - } |
|
| 517 | - |
|
| 518 | - public function withFragment($fragment): UriInterface |
|
| 519 | - { |
|
| 520 | - $fragment = $this->filterQueryAndFragment($fragment); |
|
| 521 | - |
|
| 522 | - if ($this->fragment === $fragment) { |
|
| 523 | - return $this; |
|
| 524 | - } |
|
| 525 | - |
|
| 526 | - $new = clone $this; |
|
| 527 | - $new->fragment = $fragment; |
|
| 528 | - $new->composedComponents = null; |
|
| 529 | - |
|
| 530 | - return $new; |
|
| 531 | - } |
|
| 532 | - |
|
| 533 | - public function jsonSerialize(): string |
|
| 534 | - { |
|
| 535 | - return $this->__toString(); |
|
| 536 | - } |
|
| 537 | - |
|
| 538 | - /** |
|
| 539 | - * Apply parse_url parts to a URI. |
|
| 540 | - * |
|
| 541 | - * @param array $parts Array of parse_url parts to apply. |
|
| 542 | - */ |
|
| 543 | - private function applyParts(array $parts): void |
|
| 544 | - { |
|
| 545 | - $this->scheme = isset($parts['scheme']) |
|
| 546 | - ? $this->filterScheme($parts['scheme']) |
|
| 547 | - : ''; |
|
| 548 | - $this->userInfo = isset($parts['user']) |
|
| 549 | - ? $this->filterUserInfoComponent($parts['user']) |
|
| 550 | - : ''; |
|
| 551 | - $this->host = isset($parts['host']) |
|
| 552 | - ? $this->filterHost($parts['host']) |
|
| 553 | - : ''; |
|
| 554 | - $this->port = isset($parts['port']) |
|
| 555 | - ? $this->filterPort($parts['port']) |
|
| 556 | - : null; |
|
| 557 | - $this->path = isset($parts['path']) |
|
| 558 | - ? $this->filterPath($parts['path']) |
|
| 559 | - : ''; |
|
| 560 | - $this->query = isset($parts['query']) |
|
| 561 | - ? $this->filterQueryAndFragment($parts['query']) |
|
| 562 | - : ''; |
|
| 563 | - $this->fragment = isset($parts['fragment']) |
|
| 564 | - ? $this->filterQueryAndFragment($parts['fragment']) |
|
| 565 | - : ''; |
|
| 566 | - if (isset($parts['pass'])) { |
|
| 567 | - $this->userInfo .= ':'.$this->filterUserInfoComponent($parts['pass']); |
|
| 568 | - } |
|
| 569 | - |
|
| 570 | - $this->removeDefaultPort(); |
|
| 571 | - } |
|
| 572 | - |
|
| 573 | - /** |
|
| 574 | - * @param mixed $scheme |
|
| 575 | - * |
|
| 576 | - * @throws \InvalidArgumentException If the scheme is invalid. |
|
| 577 | - */ |
|
| 578 | - private function filterScheme($scheme): string |
|
| 579 | - { |
|
| 580 | - if (!is_string($scheme)) { |
|
| 581 | - throw new \InvalidArgumentException('Scheme must be a string'); |
|
| 582 | - } |
|
| 583 | - |
|
| 584 | - return \strtr($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); |
|
| 585 | - } |
|
| 586 | - |
|
| 587 | - /** |
|
| 588 | - * @param mixed $component |
|
| 589 | - * |
|
| 590 | - * @throws \InvalidArgumentException If the user info is invalid. |
|
| 591 | - */ |
|
| 592 | - private function filterUserInfoComponent($component): string |
|
| 593 | - { |
|
| 594 | - if (!is_string($component)) { |
|
| 595 | - throw new \InvalidArgumentException('User info must be a string'); |
|
| 596 | - } |
|
| 597 | - |
|
| 598 | - return preg_replace_callback( |
|
| 599 | - '/(?:[^%'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.']+|%(?![A-Fa-f0-9]{2}))/', |
|
| 600 | - [$this, 'rawurlencodeMatchZero'], |
|
| 601 | - $component |
|
| 602 | - ); |
|
| 603 | - } |
|
| 604 | - |
|
| 605 | - /** |
|
| 606 | - * @param mixed $host |
|
| 607 | - * |
|
| 608 | - * @throws \InvalidArgumentException If the host is invalid. |
|
| 609 | - */ |
|
| 610 | - private function filterHost($host): string |
|
| 611 | - { |
|
| 612 | - if (!is_string($host)) { |
|
| 613 | - throw new \InvalidArgumentException('Host must be a string'); |
|
| 614 | - } |
|
| 615 | - |
|
| 616 | - return \strtr($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); |
|
| 617 | - } |
|
| 618 | - |
|
| 619 | - /** |
|
| 620 | - * @param mixed $port |
|
| 621 | - * |
|
| 622 | - * @throws \InvalidArgumentException If the port is invalid. |
|
| 623 | - */ |
|
| 624 | - private function filterPort($port): ?int |
|
| 625 | - { |
|
| 626 | - if ($port === null) { |
|
| 627 | - return null; |
|
| 628 | - } |
|
| 629 | - |
|
| 630 | - $port = (int) $port; |
|
| 631 | - if (0 > $port || 0xFFFF < $port) { |
|
| 632 | - throw new \InvalidArgumentException( |
|
| 633 | - sprintf('Invalid port: %d. Must be between 0 and 65535', $port) |
|
| 634 | - ); |
|
| 635 | - } |
|
| 636 | - |
|
| 637 | - return $port; |
|
| 638 | - } |
|
| 639 | - |
|
| 640 | - /** |
|
| 641 | - * @param (string|int)[] $keys |
|
| 642 | - * |
|
| 643 | - * @return string[] |
|
| 644 | - */ |
|
| 645 | - private static function getFilteredQueryString(UriInterface $uri, array $keys): array |
|
| 646 | - { |
|
| 647 | - $current = $uri->getQuery(); |
|
| 648 | - |
|
| 649 | - if ($current === '') { |
|
| 650 | - return []; |
|
| 651 | - } |
|
| 652 | - |
|
| 653 | - $decodedKeys = array_map(function ($k): string { |
|
| 654 | - return rawurldecode((string) $k); |
|
| 655 | - }, $keys); |
|
| 656 | - |
|
| 657 | - return array_filter(explode('&', $current), function ($part) use ($decodedKeys) { |
|
| 658 | - return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true); |
|
| 659 | - }); |
|
| 660 | - } |
|
| 661 | - |
|
| 662 | - private static function generateQueryString(string $key, ?string $value): string |
|
| 663 | - { |
|
| 664 | - // Query string separators ("=", "&") within the key or value need to be encoded |
|
| 665 | - // (while preventing double-encoding) before setting the query string. All other |
|
| 666 | - // chars that need percent-encoding will be encoded by withQuery(). |
|
| 667 | - $queryString = strtr($key, self::QUERY_SEPARATORS_REPLACEMENT); |
|
| 668 | - |
|
| 669 | - if ($value !== null) { |
|
| 670 | - $queryString .= '='.strtr($value, self::QUERY_SEPARATORS_REPLACEMENT); |
|
| 671 | - } |
|
| 672 | - |
|
| 673 | - return $queryString; |
|
| 674 | - } |
|
| 675 | - |
|
| 676 | - private function removeDefaultPort(): void |
|
| 677 | - { |
|
| 678 | - if ($this->port !== null && self::isDefaultPort($this)) { |
|
| 679 | - $this->port = null; |
|
| 680 | - } |
|
| 681 | - } |
|
| 682 | - |
|
| 683 | - /** |
|
| 684 | - * Filters the path of a URI |
|
| 685 | - * |
|
| 686 | - * @param mixed $path |
|
| 687 | - * |
|
| 688 | - * @throws \InvalidArgumentException If the path is invalid. |
|
| 689 | - */ |
|
| 690 | - private function filterPath($path): string |
|
| 691 | - { |
|
| 692 | - if (!is_string($path)) { |
|
| 693 | - throw new \InvalidArgumentException('Path must be a string'); |
|
| 694 | - } |
|
| 695 | - |
|
| 696 | - return preg_replace_callback( |
|
| 697 | - '/(?:[^'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.'%:@\/]++|%(?![A-Fa-f0-9]{2}))/', |
|
| 698 | - [$this, 'rawurlencodeMatchZero'], |
|
| 699 | - $path |
|
| 700 | - ); |
|
| 701 | - } |
|
| 702 | - |
|
| 703 | - /** |
|
| 704 | - * Filters the query string or fragment of a URI. |
|
| 705 | - * |
|
| 706 | - * @param mixed $str |
|
| 707 | - * |
|
| 708 | - * @throws \InvalidArgumentException If the query or fragment is invalid. |
|
| 709 | - */ |
|
| 710 | - private function filterQueryAndFragment($str): string |
|
| 711 | - { |
|
| 712 | - if (!is_string($str)) { |
|
| 713 | - throw new \InvalidArgumentException('Query and fragment must be a string'); |
|
| 714 | - } |
|
| 715 | - |
|
| 716 | - return preg_replace_callback( |
|
| 717 | - '/(?:[^'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.'%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', |
|
| 718 | - [$this, 'rawurlencodeMatchZero'], |
|
| 719 | - $str |
|
| 720 | - ); |
|
| 721 | - } |
|
| 722 | - |
|
| 723 | - private function rawurlencodeMatchZero(array $match): string |
|
| 724 | - { |
|
| 725 | - return rawurlencode($match[0]); |
|
| 726 | - } |
|
| 727 | - |
|
| 728 | - private function validateState(): void |
|
| 729 | - { |
|
| 730 | - if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) { |
|
| 731 | - $this->host = self::HTTP_DEFAULT_HOST; |
|
| 732 | - } |
|
| 733 | - |
|
| 734 | - if ($this->getAuthority() === '') { |
|
| 735 | - if (0 === strpos($this->path, '//')) { |
|
| 736 | - throw new MalformedUriException('The path of a URI without an authority must not start with two slashes "//"'); |
|
| 737 | - } |
|
| 738 | - if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) { |
|
| 739 | - throw new MalformedUriException('A relative URI must not have a path beginning with a segment containing a colon'); |
|
| 740 | - } |
|
| 741 | - } |
|
| 742 | - } |
|
| 19 | + /** |
|
| 20 | + * Absolute http and https URIs require a host per RFC 7230 Section 2.7 |
|
| 21 | + * but in generic URIs the host can be empty. So for http(s) URIs |
|
| 22 | + * we apply this default host when no host is given yet to form a |
|
| 23 | + * valid URI. |
|
| 24 | + */ |
|
| 25 | + private const HTTP_DEFAULT_HOST = 'localhost'; |
|
| 26 | + |
|
| 27 | + private const DEFAULT_PORTS = [ |
|
| 28 | + 'http' => 80, |
|
| 29 | + 'https' => 443, |
|
| 30 | + 'ftp' => 21, |
|
| 31 | + 'gopher' => 70, |
|
| 32 | + 'nntp' => 119, |
|
| 33 | + 'news' => 119, |
|
| 34 | + 'telnet' => 23, |
|
| 35 | + 'tn3270' => 23, |
|
| 36 | + 'imap' => 143, |
|
| 37 | + 'pop' => 110, |
|
| 38 | + 'ldap' => 389, |
|
| 39 | + ]; |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * Unreserved characters for use in a regex. |
|
| 43 | + * |
|
| 44 | + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-2.3 |
|
| 45 | + */ |
|
| 46 | + private const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~'; |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * Sub-delims for use in a regex. |
|
| 50 | + * |
|
| 51 | + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-2.2 |
|
| 52 | + */ |
|
| 53 | + private const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;='; |
|
| 54 | + private const QUERY_SEPARATORS_REPLACEMENT = ['=' => '%3D', '&' => '%26']; |
|
| 55 | + |
|
| 56 | + /** @var string Uri scheme. */ |
|
| 57 | + private $scheme = ''; |
|
| 58 | + |
|
| 59 | + /** @var string Uri user info. */ |
|
| 60 | + private $userInfo = ''; |
|
| 61 | + |
|
| 62 | + /** @var string Uri host. */ |
|
| 63 | + private $host = ''; |
|
| 64 | + |
|
| 65 | + /** @var int|null Uri port. */ |
|
| 66 | + private $port; |
|
| 67 | + |
|
| 68 | + /** @var string Uri path. */ |
|
| 69 | + private $path = ''; |
|
| 70 | + |
|
| 71 | + /** @var string Uri query string. */ |
|
| 72 | + private $query = ''; |
|
| 73 | + |
|
| 74 | + /** @var string Uri fragment. */ |
|
| 75 | + private $fragment = ''; |
|
| 76 | + |
|
| 77 | + /** @var string|null String representation */ |
|
| 78 | + private $composedComponents; |
|
| 79 | + |
|
| 80 | + public function __construct(string $uri = '') |
|
| 81 | + { |
|
| 82 | + if ($uri !== '') { |
|
| 83 | + $parts = self::parse($uri); |
|
| 84 | + if ($parts === false) { |
|
| 85 | + throw new MalformedUriException("Unable to parse URI: $uri"); |
|
| 86 | + } |
|
| 87 | + $this->applyParts($parts); |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * UTF-8 aware \parse_url() replacement. |
|
| 93 | + * |
|
| 94 | + * The internal function produces broken output for non ASCII domain names |
|
| 95 | + * (IDN) when used with locales other than "C". |
|
| 96 | + * |
|
| 97 | + * On the other hand, cURL understands IDN correctly only when UTF-8 locale |
|
| 98 | + * is configured ("C.UTF-8", "en_US.UTF-8", etc.). |
|
| 99 | + * |
|
| 100 | + * @see https://bugs.php.net/bug.php?id=52923 |
|
| 101 | + * @see https://www.php.net/manual/en/function.parse-url.php#114817 |
|
| 102 | + * @see https://curl.haxx.se/libcurl/c/CURLOPT_URL.html#ENCODING |
|
| 103 | + * |
|
| 104 | + * @return array|false |
|
| 105 | + */ |
|
| 106 | + private static function parse(string $url) |
|
| 107 | + { |
|
| 108 | + // If IPv6 |
|
| 109 | + $prefix = ''; |
|
| 110 | + if (preg_match('%^(.*://\[[0-9:a-f]+\])(.*?)$%', $url, $matches)) { |
|
| 111 | + /** @var array{0:string, 1:string, 2:string} $matches */ |
|
| 112 | + $prefix = $matches[1]; |
|
| 113 | + $url = $matches[2]; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + /** @var string */ |
|
| 117 | + $encodedUrl = preg_replace_callback( |
|
| 118 | + '%[^:/@?&=#]+%usD', |
|
| 119 | + static function ($matches) { |
|
| 120 | + return urlencode($matches[0]); |
|
| 121 | + }, |
|
| 122 | + $url |
|
| 123 | + ); |
|
| 124 | + |
|
| 125 | + $result = parse_url($prefix.$encodedUrl); |
|
| 126 | + |
|
| 127 | + if ($result === false) { |
|
| 128 | + return false; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + return array_map('urldecode', $result); |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + public function __toString(): string |
|
| 135 | + { |
|
| 136 | + if ($this->composedComponents === null) { |
|
| 137 | + $this->composedComponents = self::composeComponents( |
|
| 138 | + $this->scheme, |
|
| 139 | + $this->getAuthority(), |
|
| 140 | + $this->path, |
|
| 141 | + $this->query, |
|
| 142 | + $this->fragment |
|
| 143 | + ); |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + return $this->composedComponents; |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * Composes a URI reference string from its various components. |
|
| 151 | + * |
|
| 152 | + * Usually this method does not need to be called manually but instead is used indirectly via |
|
| 153 | + * `OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\UriInterface::__toString`. |
|
| 154 | + * |
|
| 155 | + * PSR-7 UriInterface treats an empty component the same as a missing component as |
|
| 156 | + * getQuery(), getFragment() etc. always return a string. This explains the slight |
|
| 157 | + * difference to RFC 3986 Section 5.3. |
|
| 158 | + * |
|
| 159 | + * Another adjustment is that the authority separator is added even when the authority is missing/empty |
|
| 160 | + * for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with |
|
| 161 | + * `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But |
|
| 162 | + * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to |
|
| 163 | + * that format). |
|
| 164 | + * |
|
| 165 | + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.3 |
|
| 166 | + */ |
|
| 167 | + public static function composeComponents(?string $scheme, ?string $authority, string $path, ?string $query, ?string $fragment): string |
|
| 168 | + { |
|
| 169 | + $uri = ''; |
|
| 170 | + |
|
| 171 | + // weak type checks to also accept null until we can add scalar type hints |
|
| 172 | + if ($scheme != '') { |
|
| 173 | + $uri .= $scheme.':'; |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + if ($authority != '' || $scheme === 'file') { |
|
| 177 | + $uri .= '//'.$authority; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + if ($authority != '' && $path != '' && $path[0] != '/') { |
|
| 181 | + $path = '/'.$path; |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + $uri .= $path; |
|
| 185 | + |
|
| 186 | + if ($query != '') { |
|
| 187 | + $uri .= '?'.$query; |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + if ($fragment != '') { |
|
| 191 | + $uri .= '#'.$fragment; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + return $uri; |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + /** |
|
| 198 | + * Whether the URI has the default port of the current scheme. |
|
| 199 | + * |
|
| 200 | + * `OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used |
|
| 201 | + * independently of the implementation. |
|
| 202 | + */ |
|
| 203 | + public static function isDefaultPort(UriInterface $uri): bool |
|
| 204 | + { |
|
| 205 | + return $uri->getPort() === null |
|
| 206 | + || (isset(self::DEFAULT_PORTS[$uri->getScheme()]) && $uri->getPort() === self::DEFAULT_PORTS[$uri->getScheme()]); |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + /** |
|
| 210 | + * Whether the URI is absolute, i.e. it has a scheme. |
|
| 211 | + * |
|
| 212 | + * An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true |
|
| 213 | + * if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative |
|
| 214 | + * to another URI, the base URI. Relative references can be divided into several forms: |
|
| 215 | + * - network-path references, e.g. '//example.com/path' |
|
| 216 | + * - absolute-path references, e.g. '/path' |
|
| 217 | + * - relative-path references, e.g. 'subpath' |
|
| 218 | + * |
|
| 219 | + * @see Uri::isNetworkPathReference |
|
| 220 | + * @see Uri::isAbsolutePathReference |
|
| 221 | + * @see Uri::isRelativePathReference |
|
| 222 | + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4 |
|
| 223 | + */ |
|
| 224 | + public static function isAbsolute(UriInterface $uri): bool |
|
| 225 | + { |
|
| 226 | + return $uri->getScheme() !== ''; |
|
| 227 | + } |
|
| 228 | + |
|
| 229 | + /** |
|
| 230 | + * Whether the URI is a network-path reference. |
|
| 231 | + * |
|
| 232 | + * A relative reference that begins with two slash characters is termed an network-path reference. |
|
| 233 | + * |
|
| 234 | + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2 |
|
| 235 | + */ |
|
| 236 | + public static function isNetworkPathReference(UriInterface $uri): bool |
|
| 237 | + { |
|
| 238 | + return $uri->getScheme() === '' && $uri->getAuthority() !== ''; |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + /** |
|
| 242 | + * Whether the URI is a absolute-path reference. |
|
| 243 | + * |
|
| 244 | + * A relative reference that begins with a single slash character is termed an absolute-path reference. |
|
| 245 | + * |
|
| 246 | + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2 |
|
| 247 | + */ |
|
| 248 | + public static function isAbsolutePathReference(UriInterface $uri): bool |
|
| 249 | + { |
|
| 250 | + return $uri->getScheme() === '' |
|
| 251 | + && $uri->getAuthority() === '' |
|
| 252 | + && isset($uri->getPath()[0]) |
|
| 253 | + && $uri->getPath()[0] === '/'; |
|
| 254 | + } |
|
| 255 | + |
|
| 256 | + /** |
|
| 257 | + * Whether the URI is a relative-path reference. |
|
| 258 | + * |
|
| 259 | + * A relative reference that does not begin with a slash character is termed a relative-path reference. |
|
| 260 | + * |
|
| 261 | + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2 |
|
| 262 | + */ |
|
| 263 | + public static function isRelativePathReference(UriInterface $uri): bool |
|
| 264 | + { |
|
| 265 | + return $uri->getScheme() === '' |
|
| 266 | + && $uri->getAuthority() === '' |
|
| 267 | + && (!isset($uri->getPath()[0]) || $uri->getPath()[0] !== '/'); |
|
| 268 | + } |
|
| 269 | + |
|
| 270 | + /** |
|
| 271 | + * Whether the URI is a same-document reference. |
|
| 272 | + * |
|
| 273 | + * A same-document reference refers to a URI that is, aside from its fragment |
|
| 274 | + * component, identical to the base URI. When no base URI is given, only an empty |
|
| 275 | + * URI reference (apart from its fragment) is considered a same-document reference. |
|
| 276 | + * |
|
| 277 | + * @param UriInterface $uri The URI to check |
|
| 278 | + * @param UriInterface|null $base An optional base URI to compare against |
|
| 279 | + * |
|
| 280 | + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.4 |
|
| 281 | + */ |
|
| 282 | + public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool |
|
| 283 | + { |
|
| 284 | + if ($base !== null) { |
|
| 285 | + $uri = UriResolver::resolve($base, $uri); |
|
| 286 | + |
|
| 287 | + return ($uri->getScheme() === $base->getScheme()) |
|
| 288 | + && ($uri->getAuthority() === $base->getAuthority()) |
|
| 289 | + && ($uri->getPath() === $base->getPath()) |
|
| 290 | + && ($uri->getQuery() === $base->getQuery()); |
|
| 291 | + } |
|
| 292 | + |
|
| 293 | + return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === ''; |
|
| 294 | + } |
|
| 295 | + |
|
| 296 | + /** |
|
| 297 | + * Creates a new URI with a specific query string value removed. |
|
| 298 | + * |
|
| 299 | + * Any existing query string values that exactly match the provided key are |
|
| 300 | + * removed. |
|
| 301 | + * |
|
| 302 | + * @param UriInterface $uri URI to use as a base. |
|
| 303 | + * @param string $key Query string key to remove. |
|
| 304 | + */ |
|
| 305 | + public static function withoutQueryValue(UriInterface $uri, string $key): UriInterface |
|
| 306 | + { |
|
| 307 | + $result = self::getFilteredQueryString($uri, [$key]); |
|
| 308 | + |
|
| 309 | + return $uri->withQuery(implode('&', $result)); |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + /** |
|
| 313 | + * Creates a new URI with a specific query string value. |
|
| 314 | + * |
|
| 315 | + * Any existing query string values that exactly match the provided key are |
|
| 316 | + * removed and replaced with the given key value pair. |
|
| 317 | + * |
|
| 318 | + * A value of null will set the query string key without a value, e.g. "key" |
|
| 319 | + * instead of "key=value". |
|
| 320 | + * |
|
| 321 | + * @param UriInterface $uri URI to use as a base. |
|
| 322 | + * @param string $key Key to set. |
|
| 323 | + * @param string|null $value Value to set |
|
| 324 | + */ |
|
| 325 | + public static function withQueryValue(UriInterface $uri, string $key, ?string $value): UriInterface |
|
| 326 | + { |
|
| 327 | + $result = self::getFilteredQueryString($uri, [$key]); |
|
| 328 | + |
|
| 329 | + $result[] = self::generateQueryString($key, $value); |
|
| 330 | + |
|
| 331 | + return $uri->withQuery(implode('&', $result)); |
|
| 332 | + } |
|
| 333 | + |
|
| 334 | + /** |
|
| 335 | + * Creates a new URI with multiple specific query string values. |
|
| 336 | + * |
|
| 337 | + * It has the same behavior as withQueryValue() but for an associative array of key => value. |
|
| 338 | + * |
|
| 339 | + * @param UriInterface $uri URI to use as a base. |
|
| 340 | + * @param (string|null)[] $keyValueArray Associative array of key and values |
|
| 341 | + */ |
|
| 342 | + public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface |
|
| 343 | + { |
|
| 344 | + $result = self::getFilteredQueryString($uri, array_keys($keyValueArray)); |
|
| 345 | + |
|
| 346 | + foreach ($keyValueArray as $key => $value) { |
|
| 347 | + $result[] = self::generateQueryString((string) $key, $value !== null ? (string) $value : null); |
|
| 348 | + } |
|
| 349 | + |
|
| 350 | + return $uri->withQuery(implode('&', $result)); |
|
| 351 | + } |
|
| 352 | + |
|
| 353 | + /** |
|
| 354 | + * Creates a URI from a hash of `parse_url` components. |
|
| 355 | + * |
|
| 356 | + * @see https://www.php.net/manual/en/function.parse-url.php |
|
| 357 | + * |
|
| 358 | + * @throws MalformedUriException If the components do not form a valid URI. |
|
| 359 | + */ |
|
| 360 | + public static function fromParts(array $parts): UriInterface |
|
| 361 | + { |
|
| 362 | + $uri = new self(); |
|
| 363 | + $uri->applyParts($parts); |
|
| 364 | + $uri->validateState(); |
|
| 365 | + |
|
| 366 | + return $uri; |
|
| 367 | + } |
|
| 368 | + |
|
| 369 | + public function getScheme(): string |
|
| 370 | + { |
|
| 371 | + return $this->scheme; |
|
| 372 | + } |
|
| 373 | + |
|
| 374 | + public function getAuthority(): string |
|
| 375 | + { |
|
| 376 | + $authority = $this->host; |
|
| 377 | + if ($this->userInfo !== '') { |
|
| 378 | + $authority = $this->userInfo.'@'.$authority; |
|
| 379 | + } |
|
| 380 | + |
|
| 381 | + if ($this->port !== null) { |
|
| 382 | + $authority .= ':'.$this->port; |
|
| 383 | + } |
|
| 384 | + |
|
| 385 | + return $authority; |
|
| 386 | + } |
|
| 387 | + |
|
| 388 | + public function getUserInfo(): string |
|
| 389 | + { |
|
| 390 | + return $this->userInfo; |
|
| 391 | + } |
|
| 392 | + |
|
| 393 | + public function getHost(): string |
|
| 394 | + { |
|
| 395 | + return $this->host; |
|
| 396 | + } |
|
| 397 | + |
|
| 398 | + public function getPort(): ?int |
|
| 399 | + { |
|
| 400 | + return $this->port; |
|
| 401 | + } |
|
| 402 | + |
|
| 403 | + public function getPath(): string |
|
| 404 | + { |
|
| 405 | + return $this->path; |
|
| 406 | + } |
|
| 407 | + |
|
| 408 | + public function getQuery(): string |
|
| 409 | + { |
|
| 410 | + return $this->query; |
|
| 411 | + } |
|
| 412 | + |
|
| 413 | + public function getFragment(): string |
|
| 414 | + { |
|
| 415 | + return $this->fragment; |
|
| 416 | + } |
|
| 417 | + |
|
| 418 | + public function withScheme($scheme): UriInterface |
|
| 419 | + { |
|
| 420 | + $scheme = $this->filterScheme($scheme); |
|
| 421 | + |
|
| 422 | + if ($this->scheme === $scheme) { |
|
| 423 | + return $this; |
|
| 424 | + } |
|
| 425 | + |
|
| 426 | + $new = clone $this; |
|
| 427 | + $new->scheme = $scheme; |
|
| 428 | + $new->composedComponents = null; |
|
| 429 | + $new->removeDefaultPort(); |
|
| 430 | + $new->validateState(); |
|
| 431 | + |
|
| 432 | + return $new; |
|
| 433 | + } |
|
| 434 | + |
|
| 435 | + public function withUserInfo($user, $password = null): UriInterface |
|
| 436 | + { |
|
| 437 | + $info = $this->filterUserInfoComponent($user); |
|
| 438 | + if ($password !== null) { |
|
| 439 | + $info .= ':'.$this->filterUserInfoComponent($password); |
|
| 440 | + } |
|
| 441 | + |
|
| 442 | + if ($this->userInfo === $info) { |
|
| 443 | + return $this; |
|
| 444 | + } |
|
| 445 | + |
|
| 446 | + $new = clone $this; |
|
| 447 | + $new->userInfo = $info; |
|
| 448 | + $new->composedComponents = null; |
|
| 449 | + $new->validateState(); |
|
| 450 | + |
|
| 451 | + return $new; |
|
| 452 | + } |
|
| 453 | + |
|
| 454 | + public function withHost($host): UriInterface |
|
| 455 | + { |
|
| 456 | + $host = $this->filterHost($host); |
|
| 457 | + |
|
| 458 | + if ($this->host === $host) { |
|
| 459 | + return $this; |
|
| 460 | + } |
|
| 461 | + |
|
| 462 | + $new = clone $this; |
|
| 463 | + $new->host = $host; |
|
| 464 | + $new->composedComponents = null; |
|
| 465 | + $new->validateState(); |
|
| 466 | + |
|
| 467 | + return $new; |
|
| 468 | + } |
|
| 469 | + |
|
| 470 | + public function withPort($port): UriInterface |
|
| 471 | + { |
|
| 472 | + $port = $this->filterPort($port); |
|
| 473 | + |
|
| 474 | + if ($this->port === $port) { |
|
| 475 | + return $this; |
|
| 476 | + } |
|
| 477 | + |
|
| 478 | + $new = clone $this; |
|
| 479 | + $new->port = $port; |
|
| 480 | + $new->composedComponents = null; |
|
| 481 | + $new->removeDefaultPort(); |
|
| 482 | + $new->validateState(); |
|
| 483 | + |
|
| 484 | + return $new; |
|
| 485 | + } |
|
| 486 | + |
|
| 487 | + public function withPath($path): UriInterface |
|
| 488 | + { |
|
| 489 | + $path = $this->filterPath($path); |
|
| 490 | + |
|
| 491 | + if ($this->path === $path) { |
|
| 492 | + return $this; |
|
| 493 | + } |
|
| 494 | + |
|
| 495 | + $new = clone $this; |
|
| 496 | + $new->path = $path; |
|
| 497 | + $new->composedComponents = null; |
|
| 498 | + $new->validateState(); |
|
| 499 | + |
|
| 500 | + return $new; |
|
| 501 | + } |
|
| 502 | + |
|
| 503 | + public function withQuery($query): UriInterface |
|
| 504 | + { |
|
| 505 | + $query = $this->filterQueryAndFragment($query); |
|
| 506 | + |
|
| 507 | + if ($this->query === $query) { |
|
| 508 | + return $this; |
|
| 509 | + } |
|
| 510 | + |
|
| 511 | + $new = clone $this; |
|
| 512 | + $new->query = $query; |
|
| 513 | + $new->composedComponents = null; |
|
| 514 | + |
|
| 515 | + return $new; |
|
| 516 | + } |
|
| 517 | + |
|
| 518 | + public function withFragment($fragment): UriInterface |
|
| 519 | + { |
|
| 520 | + $fragment = $this->filterQueryAndFragment($fragment); |
|
| 521 | + |
|
| 522 | + if ($this->fragment === $fragment) { |
|
| 523 | + return $this; |
|
| 524 | + } |
|
| 525 | + |
|
| 526 | + $new = clone $this; |
|
| 527 | + $new->fragment = $fragment; |
|
| 528 | + $new->composedComponents = null; |
|
| 529 | + |
|
| 530 | + return $new; |
|
| 531 | + } |
|
| 532 | + |
|
| 533 | + public function jsonSerialize(): string |
|
| 534 | + { |
|
| 535 | + return $this->__toString(); |
|
| 536 | + } |
|
| 537 | + |
|
| 538 | + /** |
|
| 539 | + * Apply parse_url parts to a URI. |
|
| 540 | + * |
|
| 541 | + * @param array $parts Array of parse_url parts to apply. |
|
| 542 | + */ |
|
| 543 | + private function applyParts(array $parts): void |
|
| 544 | + { |
|
| 545 | + $this->scheme = isset($parts['scheme']) |
|
| 546 | + ? $this->filterScheme($parts['scheme']) |
|
| 547 | + : ''; |
|
| 548 | + $this->userInfo = isset($parts['user']) |
|
| 549 | + ? $this->filterUserInfoComponent($parts['user']) |
|
| 550 | + : ''; |
|
| 551 | + $this->host = isset($parts['host']) |
|
| 552 | + ? $this->filterHost($parts['host']) |
|
| 553 | + : ''; |
|
| 554 | + $this->port = isset($parts['port']) |
|
| 555 | + ? $this->filterPort($parts['port']) |
|
| 556 | + : null; |
|
| 557 | + $this->path = isset($parts['path']) |
|
| 558 | + ? $this->filterPath($parts['path']) |
|
| 559 | + : ''; |
|
| 560 | + $this->query = isset($parts['query']) |
|
| 561 | + ? $this->filterQueryAndFragment($parts['query']) |
|
| 562 | + : ''; |
|
| 563 | + $this->fragment = isset($parts['fragment']) |
|
| 564 | + ? $this->filterQueryAndFragment($parts['fragment']) |
|
| 565 | + : ''; |
|
| 566 | + if (isset($parts['pass'])) { |
|
| 567 | + $this->userInfo .= ':'.$this->filterUserInfoComponent($parts['pass']); |
|
| 568 | + } |
|
| 569 | + |
|
| 570 | + $this->removeDefaultPort(); |
|
| 571 | + } |
|
| 572 | + |
|
| 573 | + /** |
|
| 574 | + * @param mixed $scheme |
|
| 575 | + * |
|
| 576 | + * @throws \InvalidArgumentException If the scheme is invalid. |
|
| 577 | + */ |
|
| 578 | + private function filterScheme($scheme): string |
|
| 579 | + { |
|
| 580 | + if (!is_string($scheme)) { |
|
| 581 | + throw new \InvalidArgumentException('Scheme must be a string'); |
|
| 582 | + } |
|
| 583 | + |
|
| 584 | + return \strtr($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); |
|
| 585 | + } |
|
| 586 | + |
|
| 587 | + /** |
|
| 588 | + * @param mixed $component |
|
| 589 | + * |
|
| 590 | + * @throws \InvalidArgumentException If the user info is invalid. |
|
| 591 | + */ |
|
| 592 | + private function filterUserInfoComponent($component): string |
|
| 593 | + { |
|
| 594 | + if (!is_string($component)) { |
|
| 595 | + throw new \InvalidArgumentException('User info must be a string'); |
|
| 596 | + } |
|
| 597 | + |
|
| 598 | + return preg_replace_callback( |
|
| 599 | + '/(?:[^%'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.']+|%(?![A-Fa-f0-9]{2}))/', |
|
| 600 | + [$this, 'rawurlencodeMatchZero'], |
|
| 601 | + $component |
|
| 602 | + ); |
|
| 603 | + } |
|
| 604 | + |
|
| 605 | + /** |
|
| 606 | + * @param mixed $host |
|
| 607 | + * |
|
| 608 | + * @throws \InvalidArgumentException If the host is invalid. |
|
| 609 | + */ |
|
| 610 | + private function filterHost($host): string |
|
| 611 | + { |
|
| 612 | + if (!is_string($host)) { |
|
| 613 | + throw new \InvalidArgumentException('Host must be a string'); |
|
| 614 | + } |
|
| 615 | + |
|
| 616 | + return \strtr($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); |
|
| 617 | + } |
|
| 618 | + |
|
| 619 | + /** |
|
| 620 | + * @param mixed $port |
|
| 621 | + * |
|
| 622 | + * @throws \InvalidArgumentException If the port is invalid. |
|
| 623 | + */ |
|
| 624 | + private function filterPort($port): ?int |
|
| 625 | + { |
|
| 626 | + if ($port === null) { |
|
| 627 | + return null; |
|
| 628 | + } |
|
| 629 | + |
|
| 630 | + $port = (int) $port; |
|
| 631 | + if (0 > $port || 0xFFFF < $port) { |
|
| 632 | + throw new \InvalidArgumentException( |
|
| 633 | + sprintf('Invalid port: %d. Must be between 0 and 65535', $port) |
|
| 634 | + ); |
|
| 635 | + } |
|
| 636 | + |
|
| 637 | + return $port; |
|
| 638 | + } |
|
| 639 | + |
|
| 640 | + /** |
|
| 641 | + * @param (string|int)[] $keys |
|
| 642 | + * |
|
| 643 | + * @return string[] |
|
| 644 | + */ |
|
| 645 | + private static function getFilteredQueryString(UriInterface $uri, array $keys): array |
|
| 646 | + { |
|
| 647 | + $current = $uri->getQuery(); |
|
| 648 | + |
|
| 649 | + if ($current === '') { |
|
| 650 | + return []; |
|
| 651 | + } |
|
| 652 | + |
|
| 653 | + $decodedKeys = array_map(function ($k): string { |
|
| 654 | + return rawurldecode((string) $k); |
|
| 655 | + }, $keys); |
|
| 656 | + |
|
| 657 | + return array_filter(explode('&', $current), function ($part) use ($decodedKeys) { |
|
| 658 | + return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true); |
|
| 659 | + }); |
|
| 660 | + } |
|
| 661 | + |
|
| 662 | + private static function generateQueryString(string $key, ?string $value): string |
|
| 663 | + { |
|
| 664 | + // Query string separators ("=", "&") within the key or value need to be encoded |
|
| 665 | + // (while preventing double-encoding) before setting the query string. All other |
|
| 666 | + // chars that need percent-encoding will be encoded by withQuery(). |
|
| 667 | + $queryString = strtr($key, self::QUERY_SEPARATORS_REPLACEMENT); |
|
| 668 | + |
|
| 669 | + if ($value !== null) { |
|
| 670 | + $queryString .= '='.strtr($value, self::QUERY_SEPARATORS_REPLACEMENT); |
|
| 671 | + } |
|
| 672 | + |
|
| 673 | + return $queryString; |
|
| 674 | + } |
|
| 675 | + |
|
| 676 | + private function removeDefaultPort(): void |
|
| 677 | + { |
|
| 678 | + if ($this->port !== null && self::isDefaultPort($this)) { |
|
| 679 | + $this->port = null; |
|
| 680 | + } |
|
| 681 | + } |
|
| 682 | + |
|
| 683 | + /** |
|
| 684 | + * Filters the path of a URI |
|
| 685 | + * |
|
| 686 | + * @param mixed $path |
|
| 687 | + * |
|
| 688 | + * @throws \InvalidArgumentException If the path is invalid. |
|
| 689 | + */ |
|
| 690 | + private function filterPath($path): string |
|
| 691 | + { |
|
| 692 | + if (!is_string($path)) { |
|
| 693 | + throw new \InvalidArgumentException('Path must be a string'); |
|
| 694 | + } |
|
| 695 | + |
|
| 696 | + return preg_replace_callback( |
|
| 697 | + '/(?:[^'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.'%:@\/]++|%(?![A-Fa-f0-9]{2}))/', |
|
| 698 | + [$this, 'rawurlencodeMatchZero'], |
|
| 699 | + $path |
|
| 700 | + ); |
|
| 701 | + } |
|
| 702 | + |
|
| 703 | + /** |
|
| 704 | + * Filters the query string or fragment of a URI. |
|
| 705 | + * |
|
| 706 | + * @param mixed $str |
|
| 707 | + * |
|
| 708 | + * @throws \InvalidArgumentException If the query or fragment is invalid. |
|
| 709 | + */ |
|
| 710 | + private function filterQueryAndFragment($str): string |
|
| 711 | + { |
|
| 712 | + if (!is_string($str)) { |
|
| 713 | + throw new \InvalidArgumentException('Query and fragment must be a string'); |
|
| 714 | + } |
|
| 715 | + |
|
| 716 | + return preg_replace_callback( |
|
| 717 | + '/(?:[^'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.'%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', |
|
| 718 | + [$this, 'rawurlencodeMatchZero'], |
|
| 719 | + $str |
|
| 720 | + ); |
|
| 721 | + } |
|
| 722 | + |
|
| 723 | + private function rawurlencodeMatchZero(array $match): string |
|
| 724 | + { |
|
| 725 | + return rawurlencode($match[0]); |
|
| 726 | + } |
|
| 727 | + |
|
| 728 | + private function validateState(): void |
|
| 729 | + { |
|
| 730 | + if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) { |
|
| 731 | + $this->host = self::HTTP_DEFAULT_HOST; |
|
| 732 | + } |
|
| 733 | + |
|
| 734 | + if ($this->getAuthority() === '') { |
|
| 735 | + if (0 === strpos($this->path, '//')) { |
|
| 736 | + throw new MalformedUriException('The path of a URI without an authority must not start with two slashes "//"'); |
|
| 737 | + } |
|
| 738 | + if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) { |
|
| 739 | + throw new MalformedUriException('A relative URI must not have a path beginning with a segment containing a colon'); |
|
| 740 | + } |
|
| 741 | + } |
|
| 742 | + } |
|
| 743 | 743 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | /** @var string */ |
| 117 | 117 | $encodedUrl = preg_replace_callback( |
| 118 | 118 | '%[^:/@?&=#]+%usD', |
| 119 | - static function ($matches) { |
|
| 119 | + static function($matches) { |
|
| 120 | 120 | return urlencode($matches[0]); |
| 121 | 121 | }, |
| 122 | 122 | $url |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | $result = self::getFilteredQueryString($uri, array_keys($keyValueArray)); |
| 345 | 345 | |
| 346 | 346 | foreach ($keyValueArray as $key => $value) { |
| 347 | - $result[] = self::generateQueryString((string) $key, $value !== null ? (string) $value : null); |
|
| 347 | + $result[] = self::generateQueryString((string)$key, $value !== null ? (string)$value : null); |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | return $uri->withQuery(implode('&', $result)); |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | return null; |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | - $port = (int) $port; |
|
| 630 | + $port = (int)$port; |
|
| 631 | 631 | if (0 > $port || 0xFFFF < $port) { |
| 632 | 632 | throw new \InvalidArgumentException( |
| 633 | 633 | sprintf('Invalid port: %d. Must be between 0 and 65535', $port) |
@@ -650,11 +650,11 @@ discard block |
||
| 650 | 650 | return []; |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | - $decodedKeys = array_map(function ($k): string { |
|
| 654 | - return rawurldecode((string) $k); |
|
| 653 | + $decodedKeys = array_map(function($k): string { |
|
| 654 | + return rawurldecode((string)$k); |
|
| 655 | 655 | }, $keys); |
| 656 | 656 | |
| 657 | - return array_filter(explode('&', $current), function ($part) use ($decodedKeys) { |
|
| 657 | + return array_filter(explode('&', $current), function($part) use ($decodedKeys) { |
|
| 658 | 658 | return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true); |
| 659 | 659 | }); |
| 660 | 660 | } |
@@ -14,146 +14,146 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class Request implements RequestInterface |
| 16 | 16 | { |
| 17 | - use MessageTrait; |
|
| 18 | - |
|
| 19 | - /** @var string */ |
|
| 20 | - private $method; |
|
| 21 | - |
|
| 22 | - /** @var string|null */ |
|
| 23 | - private $requestTarget; |
|
| 24 | - |
|
| 25 | - /** @var UriInterface */ |
|
| 26 | - private $uri; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * @param string $method HTTP method |
|
| 30 | - * @param string|UriInterface $uri URI |
|
| 31 | - * @param (string|string[])[] $headers Request headers |
|
| 32 | - * @param string|resource|StreamInterface|null $body Request body |
|
| 33 | - * @param string $version Protocol version |
|
| 34 | - */ |
|
| 35 | - public function __construct( |
|
| 36 | - string $method, |
|
| 37 | - $uri, |
|
| 38 | - array $headers = [], |
|
| 39 | - $body = null, |
|
| 40 | - string $version = '1.1' |
|
| 41 | - ) { |
|
| 42 | - $this->assertMethod($method); |
|
| 43 | - if (!($uri instanceof UriInterface)) { |
|
| 44 | - $uri = new Uri($uri); |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - $this->method = strtoupper($method); |
|
| 48 | - $this->uri = $uri; |
|
| 49 | - $this->setHeaders($headers); |
|
| 50 | - $this->protocol = $version; |
|
| 51 | - |
|
| 52 | - if (!isset($this->headerNames['host'])) { |
|
| 53 | - $this->updateHostFromUri(); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - if ($body !== '' && $body !== null) { |
|
| 57 | - $this->stream = Utils::streamFor($body); |
|
| 58 | - } |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - public function getRequestTarget(): string |
|
| 62 | - { |
|
| 63 | - if ($this->requestTarget !== null) { |
|
| 64 | - return $this->requestTarget; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - $target = $this->uri->getPath(); |
|
| 68 | - if ($target === '') { |
|
| 69 | - $target = '/'; |
|
| 70 | - } |
|
| 71 | - if ($this->uri->getQuery() != '') { |
|
| 72 | - $target .= '?'.$this->uri->getQuery(); |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - return $target; |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - public function withRequestTarget($requestTarget): RequestInterface |
|
| 79 | - { |
|
| 80 | - if (preg_match('#\s#', $requestTarget)) { |
|
| 81 | - throw new InvalidArgumentException( |
|
| 82 | - 'Invalid request target provided; cannot contain whitespace' |
|
| 83 | - ); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - $new = clone $this; |
|
| 87 | - $new->requestTarget = $requestTarget; |
|
| 88 | - |
|
| 89 | - return $new; |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - public function getMethod(): string |
|
| 93 | - { |
|
| 94 | - return $this->method; |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - public function withMethod($method): RequestInterface |
|
| 98 | - { |
|
| 99 | - $this->assertMethod($method); |
|
| 100 | - $new = clone $this; |
|
| 101 | - $new->method = strtoupper($method); |
|
| 102 | - |
|
| 103 | - return $new; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - public function getUri(): UriInterface |
|
| 107 | - { |
|
| 108 | - return $this->uri; |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - public function withUri(UriInterface $uri, $preserveHost = false): RequestInterface |
|
| 112 | - { |
|
| 113 | - if ($uri === $this->uri) { |
|
| 114 | - return $this; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - $new = clone $this; |
|
| 118 | - $new->uri = $uri; |
|
| 119 | - |
|
| 120 | - if (!$preserveHost || !isset($this->headerNames['host'])) { |
|
| 121 | - $new->updateHostFromUri(); |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - return $new; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - private function updateHostFromUri(): void |
|
| 128 | - { |
|
| 129 | - $host = $this->uri->getHost(); |
|
| 130 | - |
|
| 131 | - if ($host == '') { |
|
| 132 | - return; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - if (($port = $this->uri->getPort()) !== null) { |
|
| 136 | - $host .= ':'.$port; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - if (isset($this->headerNames['host'])) { |
|
| 140 | - $header = $this->headerNames['host']; |
|
| 141 | - } else { |
|
| 142 | - $header = 'Host'; |
|
| 143 | - $this->headerNames['host'] = 'Host'; |
|
| 144 | - } |
|
| 145 | - // Ensure Host is the first header. |
|
| 146 | - // See: https://datatracker.ietf.org/doc/html/rfc7230#section-5.4 |
|
| 147 | - $this->headers = [$header => [$host]] + $this->headers; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * @param mixed $method |
|
| 152 | - */ |
|
| 153 | - private function assertMethod($method): void |
|
| 154 | - { |
|
| 155 | - if (!is_string($method) || $method === '') { |
|
| 156 | - throw new InvalidArgumentException('Method must be a non-empty string.'); |
|
| 157 | - } |
|
| 158 | - } |
|
| 17 | + use MessageTrait; |
|
| 18 | + |
|
| 19 | + /** @var string */ |
|
| 20 | + private $method; |
|
| 21 | + |
|
| 22 | + /** @var string|null */ |
|
| 23 | + private $requestTarget; |
|
| 24 | + |
|
| 25 | + /** @var UriInterface */ |
|
| 26 | + private $uri; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @param string $method HTTP method |
|
| 30 | + * @param string|UriInterface $uri URI |
|
| 31 | + * @param (string|string[])[] $headers Request headers |
|
| 32 | + * @param string|resource|StreamInterface|null $body Request body |
|
| 33 | + * @param string $version Protocol version |
|
| 34 | + */ |
|
| 35 | + public function __construct( |
|
| 36 | + string $method, |
|
| 37 | + $uri, |
|
| 38 | + array $headers = [], |
|
| 39 | + $body = null, |
|
| 40 | + string $version = '1.1' |
|
| 41 | + ) { |
|
| 42 | + $this->assertMethod($method); |
|
| 43 | + if (!($uri instanceof UriInterface)) { |
|
| 44 | + $uri = new Uri($uri); |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + $this->method = strtoupper($method); |
|
| 48 | + $this->uri = $uri; |
|
| 49 | + $this->setHeaders($headers); |
|
| 50 | + $this->protocol = $version; |
|
| 51 | + |
|
| 52 | + if (!isset($this->headerNames['host'])) { |
|
| 53 | + $this->updateHostFromUri(); |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + if ($body !== '' && $body !== null) { |
|
| 57 | + $this->stream = Utils::streamFor($body); |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + public function getRequestTarget(): string |
|
| 62 | + { |
|
| 63 | + if ($this->requestTarget !== null) { |
|
| 64 | + return $this->requestTarget; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + $target = $this->uri->getPath(); |
|
| 68 | + if ($target === '') { |
|
| 69 | + $target = '/'; |
|
| 70 | + } |
|
| 71 | + if ($this->uri->getQuery() != '') { |
|
| 72 | + $target .= '?'.$this->uri->getQuery(); |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + return $target; |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + public function withRequestTarget($requestTarget): RequestInterface |
|
| 79 | + { |
|
| 80 | + if (preg_match('#\s#', $requestTarget)) { |
|
| 81 | + throw new InvalidArgumentException( |
|
| 82 | + 'Invalid request target provided; cannot contain whitespace' |
|
| 83 | + ); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + $new = clone $this; |
|
| 87 | + $new->requestTarget = $requestTarget; |
|
| 88 | + |
|
| 89 | + return $new; |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + public function getMethod(): string |
|
| 93 | + { |
|
| 94 | + return $this->method; |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + public function withMethod($method): RequestInterface |
|
| 98 | + { |
|
| 99 | + $this->assertMethod($method); |
|
| 100 | + $new = clone $this; |
|
| 101 | + $new->method = strtoupper($method); |
|
| 102 | + |
|
| 103 | + return $new; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + public function getUri(): UriInterface |
|
| 107 | + { |
|
| 108 | + return $this->uri; |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + public function withUri(UriInterface $uri, $preserveHost = false): RequestInterface |
|
| 112 | + { |
|
| 113 | + if ($uri === $this->uri) { |
|
| 114 | + return $this; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + $new = clone $this; |
|
| 118 | + $new->uri = $uri; |
|
| 119 | + |
|
| 120 | + if (!$preserveHost || !isset($this->headerNames['host'])) { |
|
| 121 | + $new->updateHostFromUri(); |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + return $new; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + private function updateHostFromUri(): void |
|
| 128 | + { |
|
| 129 | + $host = $this->uri->getHost(); |
|
| 130 | + |
|
| 131 | + if ($host == '') { |
|
| 132 | + return; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + if (($port = $this->uri->getPort()) !== null) { |
|
| 136 | + $host .= ':'.$port; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + if (isset($this->headerNames['host'])) { |
|
| 140 | + $header = $this->headerNames['host']; |
|
| 141 | + } else { |
|
| 142 | + $header = 'Host'; |
|
| 143 | + $this->headerNames['host'] = 'Host'; |
|
| 144 | + } |
|
| 145 | + // Ensure Host is the first header. |
|
| 146 | + // See: https://datatracker.ietf.org/doc/html/rfc7230#section-5.4 |
|
| 147 | + $this->headers = [$header => [$host]] + $this->headers; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * @param mixed $method |
|
| 152 | + */ |
|
| 153 | + private function assertMethod($method): void |
|
| 154 | + { |
|
| 155 | + if (!is_string($method) || $method === '') { |
|
| 156 | + throw new InvalidArgumentException('Method must be a non-empty string.'); |
|
| 157 | + } |
|
| 158 | + } |
|
| 159 | 159 | } |
@@ -12,8 +12,7 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * PSR-7 request implementation. |
| 14 | 14 | */ |
| 15 | -class Request implements RequestInterface |
|
| 16 | -{ |
|
| 15 | +class Request implements RequestInterface { |
|
| 17 | 16 | use MessageTrait; |
| 18 | 17 | |
| 19 | 18 | /** @var string */ |
@@ -11,201 +11,201 @@ |
||
| 11 | 11 | |
| 12 | 12 | class UploadedFile implements UploadedFileInterface |
| 13 | 13 | { |
| 14 | - private const ERRORS = [ |
|
| 15 | - UPLOAD_ERR_OK, |
|
| 16 | - UPLOAD_ERR_INI_SIZE, |
|
| 17 | - UPLOAD_ERR_FORM_SIZE, |
|
| 18 | - UPLOAD_ERR_PARTIAL, |
|
| 19 | - UPLOAD_ERR_NO_FILE, |
|
| 20 | - UPLOAD_ERR_NO_TMP_DIR, |
|
| 21 | - UPLOAD_ERR_CANT_WRITE, |
|
| 22 | - UPLOAD_ERR_EXTENSION, |
|
| 23 | - ]; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * @var string|null |
|
| 27 | - */ |
|
| 28 | - private $clientFilename; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * @var string|null |
|
| 32 | - */ |
|
| 33 | - private $clientMediaType; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * @var int |
|
| 37 | - */ |
|
| 38 | - private $error; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @var string|null |
|
| 42 | - */ |
|
| 43 | - private $file; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * @var bool |
|
| 47 | - */ |
|
| 48 | - private $moved = false; |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @var int|null |
|
| 52 | - */ |
|
| 53 | - private $size; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * @var StreamInterface|null |
|
| 57 | - */ |
|
| 58 | - private $stream; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * @param StreamInterface|string|resource $streamOrFile |
|
| 62 | - */ |
|
| 63 | - public function __construct( |
|
| 64 | - $streamOrFile, |
|
| 65 | - ?int $size, |
|
| 66 | - int $errorStatus, |
|
| 67 | - string $clientFilename = null, |
|
| 68 | - string $clientMediaType = null |
|
| 69 | - ) { |
|
| 70 | - $this->setError($errorStatus); |
|
| 71 | - $this->size = $size; |
|
| 72 | - $this->clientFilename = $clientFilename; |
|
| 73 | - $this->clientMediaType = $clientMediaType; |
|
| 74 | - |
|
| 75 | - if ($this->isOk()) { |
|
| 76 | - $this->setStreamOrFile($streamOrFile); |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Depending on the value set file or stream variable |
|
| 82 | - * |
|
| 83 | - * @param StreamInterface|string|resource $streamOrFile |
|
| 84 | - * |
|
| 85 | - * @throws InvalidArgumentException |
|
| 86 | - */ |
|
| 87 | - private function setStreamOrFile($streamOrFile): void |
|
| 88 | - { |
|
| 89 | - if (is_string($streamOrFile)) { |
|
| 90 | - $this->file = $streamOrFile; |
|
| 91 | - } elseif (is_resource($streamOrFile)) { |
|
| 92 | - $this->stream = new Stream($streamOrFile); |
|
| 93 | - } elseif ($streamOrFile instanceof StreamInterface) { |
|
| 94 | - $this->stream = $streamOrFile; |
|
| 95 | - } else { |
|
| 96 | - throw new InvalidArgumentException( |
|
| 97 | - 'Invalid stream or file provided for UploadedFile' |
|
| 98 | - ); |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * @throws InvalidArgumentException |
|
| 104 | - */ |
|
| 105 | - private function setError(int $error): void |
|
| 106 | - { |
|
| 107 | - if (false === in_array($error, UploadedFile::ERRORS, true)) { |
|
| 108 | - throw new InvalidArgumentException( |
|
| 109 | - 'Invalid error status for UploadedFile' |
|
| 110 | - ); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - $this->error = $error; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - private static function isStringNotEmpty($param): bool |
|
| 117 | - { |
|
| 118 | - return is_string($param) && false === empty($param); |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * Return true if there is no upload error |
|
| 123 | - */ |
|
| 124 | - private function isOk(): bool |
|
| 125 | - { |
|
| 126 | - return $this->error === UPLOAD_ERR_OK; |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - public function isMoved(): bool |
|
| 130 | - { |
|
| 131 | - return $this->moved; |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - /** |
|
| 135 | - * @throws RuntimeException if is moved or not ok |
|
| 136 | - */ |
|
| 137 | - private function validateActive(): void |
|
| 138 | - { |
|
| 139 | - if (false === $this->isOk()) { |
|
| 140 | - throw new RuntimeException('Cannot retrieve stream due to upload error'); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - if ($this->isMoved()) { |
|
| 144 | - throw new RuntimeException('Cannot retrieve stream after it has already been moved'); |
|
| 145 | - } |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - public function getStream(): StreamInterface |
|
| 149 | - { |
|
| 150 | - $this->validateActive(); |
|
| 151 | - |
|
| 152 | - if ($this->stream instanceof StreamInterface) { |
|
| 153 | - return $this->stream; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - /** @var string $file */ |
|
| 157 | - $file = $this->file; |
|
| 158 | - |
|
| 159 | - return new LazyOpenStream($file, 'r+'); |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - public function moveTo($targetPath): void |
|
| 163 | - { |
|
| 164 | - $this->validateActive(); |
|
| 165 | - |
|
| 166 | - if (false === self::isStringNotEmpty($targetPath)) { |
|
| 167 | - throw new InvalidArgumentException( |
|
| 168 | - 'Invalid path provided for move operation; must be a non-empty string' |
|
| 169 | - ); |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - if ($this->file) { |
|
| 173 | - $this->moved = PHP_SAPI === 'cli' |
|
| 174 | - ? rename($this->file, $targetPath) |
|
| 175 | - : move_uploaded_file($this->file, $targetPath); |
|
| 176 | - } else { |
|
| 177 | - Utils::copyToStream( |
|
| 178 | - $this->getStream(), |
|
| 179 | - new LazyOpenStream($targetPath, 'w') |
|
| 180 | - ); |
|
| 181 | - |
|
| 182 | - $this->moved = true; |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - if (false === $this->moved) { |
|
| 186 | - throw new RuntimeException( |
|
| 187 | - sprintf('Uploaded file could not be moved to %s', $targetPath) |
|
| 188 | - ); |
|
| 189 | - } |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - public function getSize(): ?int |
|
| 193 | - { |
|
| 194 | - return $this->size; |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - public function getError(): int |
|
| 198 | - { |
|
| 199 | - return $this->error; |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - public function getClientFilename(): ?string |
|
| 203 | - { |
|
| 204 | - return $this->clientFilename; |
|
| 205 | - } |
|
| 206 | - |
|
| 207 | - public function getClientMediaType(): ?string |
|
| 208 | - { |
|
| 209 | - return $this->clientMediaType; |
|
| 210 | - } |
|
| 14 | + private const ERRORS = [ |
|
| 15 | + UPLOAD_ERR_OK, |
|
| 16 | + UPLOAD_ERR_INI_SIZE, |
|
| 17 | + UPLOAD_ERR_FORM_SIZE, |
|
| 18 | + UPLOAD_ERR_PARTIAL, |
|
| 19 | + UPLOAD_ERR_NO_FILE, |
|
| 20 | + UPLOAD_ERR_NO_TMP_DIR, |
|
| 21 | + UPLOAD_ERR_CANT_WRITE, |
|
| 22 | + UPLOAD_ERR_EXTENSION, |
|
| 23 | + ]; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * @var string|null |
|
| 27 | + */ |
|
| 28 | + private $clientFilename; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * @var string|null |
|
| 32 | + */ |
|
| 33 | + private $clientMediaType; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @var int |
|
| 37 | + */ |
|
| 38 | + private $error; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @var string|null |
|
| 42 | + */ |
|
| 43 | + private $file; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * @var bool |
|
| 47 | + */ |
|
| 48 | + private $moved = false; |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @var int|null |
|
| 52 | + */ |
|
| 53 | + private $size; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * @var StreamInterface|null |
|
| 57 | + */ |
|
| 58 | + private $stream; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * @param StreamInterface|string|resource $streamOrFile |
|
| 62 | + */ |
|
| 63 | + public function __construct( |
|
| 64 | + $streamOrFile, |
|
| 65 | + ?int $size, |
|
| 66 | + int $errorStatus, |
|
| 67 | + string $clientFilename = null, |
|
| 68 | + string $clientMediaType = null |
|
| 69 | + ) { |
|
| 70 | + $this->setError($errorStatus); |
|
| 71 | + $this->size = $size; |
|
| 72 | + $this->clientFilename = $clientFilename; |
|
| 73 | + $this->clientMediaType = $clientMediaType; |
|
| 74 | + |
|
| 75 | + if ($this->isOk()) { |
|
| 76 | + $this->setStreamOrFile($streamOrFile); |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Depending on the value set file or stream variable |
|
| 82 | + * |
|
| 83 | + * @param StreamInterface|string|resource $streamOrFile |
|
| 84 | + * |
|
| 85 | + * @throws InvalidArgumentException |
|
| 86 | + */ |
|
| 87 | + private function setStreamOrFile($streamOrFile): void |
|
| 88 | + { |
|
| 89 | + if (is_string($streamOrFile)) { |
|
| 90 | + $this->file = $streamOrFile; |
|
| 91 | + } elseif (is_resource($streamOrFile)) { |
|
| 92 | + $this->stream = new Stream($streamOrFile); |
|
| 93 | + } elseif ($streamOrFile instanceof StreamInterface) { |
|
| 94 | + $this->stream = $streamOrFile; |
|
| 95 | + } else { |
|
| 96 | + throw new InvalidArgumentException( |
|
| 97 | + 'Invalid stream or file provided for UploadedFile' |
|
| 98 | + ); |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * @throws InvalidArgumentException |
|
| 104 | + */ |
|
| 105 | + private function setError(int $error): void |
|
| 106 | + { |
|
| 107 | + if (false === in_array($error, UploadedFile::ERRORS, true)) { |
|
| 108 | + throw new InvalidArgumentException( |
|
| 109 | + 'Invalid error status for UploadedFile' |
|
| 110 | + ); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + $this->error = $error; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + private static function isStringNotEmpty($param): bool |
|
| 117 | + { |
|
| 118 | + return is_string($param) && false === empty($param); |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * Return true if there is no upload error |
|
| 123 | + */ |
|
| 124 | + private function isOk(): bool |
|
| 125 | + { |
|
| 126 | + return $this->error === UPLOAD_ERR_OK; |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + public function isMoved(): bool |
|
| 130 | + { |
|
| 131 | + return $this->moved; |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + /** |
|
| 135 | + * @throws RuntimeException if is moved or not ok |
|
| 136 | + */ |
|
| 137 | + private function validateActive(): void |
|
| 138 | + { |
|
| 139 | + if (false === $this->isOk()) { |
|
| 140 | + throw new RuntimeException('Cannot retrieve stream due to upload error'); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + if ($this->isMoved()) { |
|
| 144 | + throw new RuntimeException('Cannot retrieve stream after it has already been moved'); |
|
| 145 | + } |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + public function getStream(): StreamInterface |
|
| 149 | + { |
|
| 150 | + $this->validateActive(); |
|
| 151 | + |
|
| 152 | + if ($this->stream instanceof StreamInterface) { |
|
| 153 | + return $this->stream; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + /** @var string $file */ |
|
| 157 | + $file = $this->file; |
|
| 158 | + |
|
| 159 | + return new LazyOpenStream($file, 'r+'); |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + public function moveTo($targetPath): void |
|
| 163 | + { |
|
| 164 | + $this->validateActive(); |
|
| 165 | + |
|
| 166 | + if (false === self::isStringNotEmpty($targetPath)) { |
|
| 167 | + throw new InvalidArgumentException( |
|
| 168 | + 'Invalid path provided for move operation; must be a non-empty string' |
|
| 169 | + ); |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + if ($this->file) { |
|
| 173 | + $this->moved = PHP_SAPI === 'cli' |
|
| 174 | + ? rename($this->file, $targetPath) |
|
| 175 | + : move_uploaded_file($this->file, $targetPath); |
|
| 176 | + } else { |
|
| 177 | + Utils::copyToStream( |
|
| 178 | + $this->getStream(), |
|
| 179 | + new LazyOpenStream($targetPath, 'w') |
|
| 180 | + ); |
|
| 181 | + |
|
| 182 | + $this->moved = true; |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + if (false === $this->moved) { |
|
| 186 | + throw new RuntimeException( |
|
| 187 | + sprintf('Uploaded file could not be moved to %s', $targetPath) |
|
| 188 | + ); |
|
| 189 | + } |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + public function getSize(): ?int |
|
| 193 | + { |
|
| 194 | + return $this->size; |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + public function getError(): int |
|
| 198 | + { |
|
| 199 | + return $this->error; |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + public function getClientFilename(): ?string |
|
| 203 | + { |
|
| 204 | + return $this->clientFilename; |
|
| 205 | + } |
|
| 206 | + |
|
| 207 | + public function getClientMediaType(): ?string |
|
| 208 | + { |
|
| 209 | + return $this->clientMediaType; |
|
| 210 | + } |
|
| 211 | 211 | } |
@@ -9,8 +9,7 @@ |
||
| 9 | 9 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\UploadedFileInterface; |
| 10 | 10 | use RuntimeException; |
| 11 | 11 | |
| 12 | -class UploadedFile implements UploadedFileInterface |
|
| 13 | -{ |
|
| 12 | +class UploadedFile implements UploadedFileInterface { |
|
| 14 | 13 | private const ERRORS = [ |
| 15 | 14 | UPLOAD_ERR_OK, |
| 16 | 15 | UPLOAD_ERR_INI_SIZE, |
@@ -6,1254 +6,1254 @@ |
||
| 6 | 6 | |
| 7 | 7 | final class MimeType |
| 8 | 8 | { |
| 9 | - private const MIME_TYPES = [ |
|
| 10 | - '1km' => 'application/vnd.1000minds.decision-model+xml', |
|
| 11 | - '3dml' => 'text/vnd.in3d.3dml', |
|
| 12 | - '3ds' => 'image/x-3ds', |
|
| 13 | - '3g2' => 'video/3gpp2', |
|
| 14 | - '3gp' => 'video/3gp', |
|
| 15 | - '3gpp' => 'video/3gpp', |
|
| 16 | - '3mf' => 'model/3mf', |
|
| 17 | - '7z' => 'application/x-7z-compressed', |
|
| 18 | - '7zip' => 'application/x-7z-compressed', |
|
| 19 | - '123' => 'application/vnd.lotus-1-2-3', |
|
| 20 | - 'aab' => 'application/x-authorware-bin', |
|
| 21 | - 'aac' => 'audio/aac', |
|
| 22 | - 'aam' => 'application/x-authorware-map', |
|
| 23 | - 'aas' => 'application/x-authorware-seg', |
|
| 24 | - 'abw' => 'application/x-abiword', |
|
| 25 | - 'ac' => 'application/vnd.nokia.n-gage.ac+xml', |
|
| 26 | - 'ac3' => 'audio/ac3', |
|
| 27 | - 'acc' => 'application/vnd.americandynamics.acc', |
|
| 28 | - 'ace' => 'application/x-ace-compressed', |
|
| 29 | - 'acu' => 'application/vnd.acucobol', |
|
| 30 | - 'acutc' => 'application/vnd.acucorp', |
|
| 31 | - 'adp' => 'audio/adpcm', |
|
| 32 | - 'adts' => 'audio/aac', |
|
| 33 | - 'aep' => 'application/vnd.audiograph', |
|
| 34 | - 'afm' => 'application/x-font-type1', |
|
| 35 | - 'afp' => 'application/vnd.ibm.modcap', |
|
| 36 | - 'age' => 'application/vnd.age', |
|
| 37 | - 'ahead' => 'application/vnd.ahead.space', |
|
| 38 | - 'ai' => 'application/pdf', |
|
| 39 | - 'aif' => 'audio/x-aiff', |
|
| 40 | - 'aifc' => 'audio/x-aiff', |
|
| 41 | - 'aiff' => 'audio/x-aiff', |
|
| 42 | - 'air' => 'application/vnd.adobe.air-application-installer-package+zip', |
|
| 43 | - 'ait' => 'application/vnd.dvb.ait', |
|
| 44 | - 'ami' => 'application/vnd.amiga.ami', |
|
| 45 | - 'aml' => 'application/automationml-aml+xml', |
|
| 46 | - 'amlx' => 'application/automationml-amlx+zip', |
|
| 47 | - 'amr' => 'audio/amr', |
|
| 48 | - 'apk' => 'application/vnd.android.package-archive', |
|
| 49 | - 'apng' => 'image/apng', |
|
| 50 | - 'appcache' => 'text/cache-manifest', |
|
| 51 | - 'appinstaller' => 'application/appinstaller', |
|
| 52 | - 'application' => 'application/x-ms-application', |
|
| 53 | - 'appx' => 'application/appx', |
|
| 54 | - 'appxbundle' => 'application/appxbundle', |
|
| 55 | - 'apr' => 'application/vnd.lotus-approach', |
|
| 56 | - 'arc' => 'application/x-freearc', |
|
| 57 | - 'arj' => 'application/x-arj', |
|
| 58 | - 'asc' => 'application/pgp-signature', |
|
| 59 | - 'asf' => 'video/x-ms-asf', |
|
| 60 | - 'asm' => 'text/x-asm', |
|
| 61 | - 'aso' => 'application/vnd.accpac.simply.aso', |
|
| 62 | - 'asx' => 'video/x-ms-asf', |
|
| 63 | - 'atc' => 'application/vnd.acucorp', |
|
| 64 | - 'atom' => 'application/atom+xml', |
|
| 65 | - 'atomcat' => 'application/atomcat+xml', |
|
| 66 | - 'atomdeleted' => 'application/atomdeleted+xml', |
|
| 67 | - 'atomsvc' => 'application/atomsvc+xml', |
|
| 68 | - 'atx' => 'application/vnd.antix.game-component', |
|
| 69 | - 'au' => 'audio/x-au', |
|
| 70 | - 'avci' => 'image/avci', |
|
| 71 | - 'avcs' => 'image/avcs', |
|
| 72 | - 'avi' => 'video/x-msvideo', |
|
| 73 | - 'avif' => 'image/avif', |
|
| 74 | - 'aw' => 'application/applixware', |
|
| 75 | - 'azf' => 'application/vnd.airzip.filesecure.azf', |
|
| 76 | - 'azs' => 'application/vnd.airzip.filesecure.azs', |
|
| 77 | - 'azv' => 'image/vnd.airzip.accelerator.azv', |
|
| 78 | - 'azw' => 'application/vnd.amazon.ebook', |
|
| 79 | - 'b16' => 'image/vnd.pco.b16', |
|
| 80 | - 'bat' => 'application/x-msdownload', |
|
| 81 | - 'bcpio' => 'application/x-bcpio', |
|
| 82 | - 'bdf' => 'application/x-font-bdf', |
|
| 83 | - 'bdm' => 'application/vnd.syncml.dm+wbxml', |
|
| 84 | - 'bdoc' => 'application/x-bdoc', |
|
| 85 | - 'bed' => 'application/vnd.realvnc.bed', |
|
| 86 | - 'bh2' => 'application/vnd.fujitsu.oasysprs', |
|
| 87 | - 'bin' => 'application/octet-stream', |
|
| 88 | - 'blb' => 'application/x-blorb', |
|
| 89 | - 'blorb' => 'application/x-blorb', |
|
| 90 | - 'bmi' => 'application/vnd.bmi', |
|
| 91 | - 'bmml' => 'application/vnd.balsamiq.bmml+xml', |
|
| 92 | - 'bmp' => 'image/bmp', |
|
| 93 | - 'book' => 'application/vnd.framemaker', |
|
| 94 | - 'box' => 'application/vnd.previewsystems.box', |
|
| 95 | - 'boz' => 'application/x-bzip2', |
|
| 96 | - 'bpk' => 'application/octet-stream', |
|
| 97 | - 'bpmn' => 'application/octet-stream', |
|
| 98 | - 'bsp' => 'model/vnd.valve.source.compiled-map', |
|
| 99 | - 'btf' => 'image/prs.btif', |
|
| 100 | - 'btif' => 'image/prs.btif', |
|
| 101 | - 'buffer' => 'application/octet-stream', |
|
| 102 | - 'bz' => 'application/x-bzip', |
|
| 103 | - 'bz2' => 'application/x-bzip2', |
|
| 104 | - 'c' => 'text/x-c', |
|
| 105 | - 'c4d' => 'application/vnd.clonk.c4group', |
|
| 106 | - 'c4f' => 'application/vnd.clonk.c4group', |
|
| 107 | - 'c4g' => 'application/vnd.clonk.c4group', |
|
| 108 | - 'c4p' => 'application/vnd.clonk.c4group', |
|
| 109 | - 'c4u' => 'application/vnd.clonk.c4group', |
|
| 110 | - 'c11amc' => 'application/vnd.cluetrust.cartomobile-config', |
|
| 111 | - 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg', |
|
| 112 | - 'cab' => 'application/vnd.ms-cab-compressed', |
|
| 113 | - 'caf' => 'audio/x-caf', |
|
| 114 | - 'cap' => 'application/vnd.tcpdump.pcap', |
|
| 115 | - 'car' => 'application/vnd.curl.car', |
|
| 116 | - 'cat' => 'application/vnd.ms-pki.seccat', |
|
| 117 | - 'cb7' => 'application/x-cbr', |
|
| 118 | - 'cba' => 'application/x-cbr', |
|
| 119 | - 'cbr' => 'application/x-cbr', |
|
| 120 | - 'cbt' => 'application/x-cbr', |
|
| 121 | - 'cbz' => 'application/x-cbr', |
|
| 122 | - 'cc' => 'text/x-c', |
|
| 123 | - 'cco' => 'application/x-cocoa', |
|
| 124 | - 'cct' => 'application/x-director', |
|
| 125 | - 'ccxml' => 'application/ccxml+xml', |
|
| 126 | - 'cdbcmsg' => 'application/vnd.contact.cmsg', |
|
| 127 | - 'cdf' => 'application/x-netcdf', |
|
| 128 | - 'cdfx' => 'application/cdfx+xml', |
|
| 129 | - 'cdkey' => 'application/vnd.mediastation.cdkey', |
|
| 130 | - 'cdmia' => 'application/cdmi-capability', |
|
| 131 | - 'cdmic' => 'application/cdmi-container', |
|
| 132 | - 'cdmid' => 'application/cdmi-domain', |
|
| 133 | - 'cdmio' => 'application/cdmi-object', |
|
| 134 | - 'cdmiq' => 'application/cdmi-queue', |
|
| 135 | - 'cdr' => 'application/cdr', |
|
| 136 | - 'cdx' => 'chemical/x-cdx', |
|
| 137 | - 'cdxml' => 'application/vnd.chemdraw+xml', |
|
| 138 | - 'cdy' => 'application/vnd.cinderella', |
|
| 139 | - 'cer' => 'application/pkix-cert', |
|
| 140 | - 'cfs' => 'application/x-cfs-compressed', |
|
| 141 | - 'cgm' => 'image/cgm', |
|
| 142 | - 'chat' => 'application/x-chat', |
|
| 143 | - 'chm' => 'application/vnd.ms-htmlhelp', |
|
| 144 | - 'chrt' => 'application/vnd.kde.kchart', |
|
| 145 | - 'cif' => 'chemical/x-cif', |
|
| 146 | - 'cii' => 'application/vnd.anser-web-certificate-issue-initiation', |
|
| 147 | - 'cil' => 'application/vnd.ms-artgalry', |
|
| 148 | - 'cjs' => 'application/node', |
|
| 149 | - 'cla' => 'application/vnd.claymore', |
|
| 150 | - 'class' => 'application/octet-stream', |
|
| 151 | - 'cld' => 'model/vnd.cld', |
|
| 152 | - 'clkk' => 'application/vnd.crick.clicker.keyboard', |
|
| 153 | - 'clkp' => 'application/vnd.crick.clicker.palette', |
|
| 154 | - 'clkt' => 'application/vnd.crick.clicker.template', |
|
| 155 | - 'clkw' => 'application/vnd.crick.clicker.wordbank', |
|
| 156 | - 'clkx' => 'application/vnd.crick.clicker', |
|
| 157 | - 'clp' => 'application/x-msclip', |
|
| 158 | - 'cmc' => 'application/vnd.cosmocaller', |
|
| 159 | - 'cmdf' => 'chemical/x-cmdf', |
|
| 160 | - 'cml' => 'chemical/x-cml', |
|
| 161 | - 'cmp' => 'application/vnd.yellowriver-custom-menu', |
|
| 162 | - 'cmx' => 'image/x-cmx', |
|
| 163 | - 'cod' => 'application/vnd.rim.cod', |
|
| 164 | - 'coffee' => 'text/coffeescript', |
|
| 165 | - 'com' => 'application/x-msdownload', |
|
| 166 | - 'conf' => 'text/plain', |
|
| 167 | - 'cpio' => 'application/x-cpio', |
|
| 168 | - 'cpl' => 'application/cpl+xml', |
|
| 169 | - 'cpp' => 'text/x-c', |
|
| 170 | - 'cpt' => 'application/mac-compactpro', |
|
| 171 | - 'crd' => 'application/x-mscardfile', |
|
| 172 | - 'crl' => 'application/pkix-crl', |
|
| 173 | - 'crt' => 'application/x-x509-ca-cert', |
|
| 174 | - 'crx' => 'application/x-chrome-extension', |
|
| 175 | - 'cryptonote' => 'application/vnd.rig.cryptonote', |
|
| 176 | - 'csh' => 'application/x-csh', |
|
| 177 | - 'csl' => 'application/vnd.citationstyles.style+xml', |
|
| 178 | - 'csml' => 'chemical/x-csml', |
|
| 179 | - 'csp' => 'application/vnd.commonspace', |
|
| 180 | - 'csr' => 'application/octet-stream', |
|
| 181 | - 'css' => 'text/css', |
|
| 182 | - 'cst' => 'application/x-director', |
|
| 183 | - 'csv' => 'text/csv', |
|
| 184 | - 'cu' => 'application/cu-seeme', |
|
| 185 | - 'curl' => 'text/vnd.curl', |
|
| 186 | - 'cwl' => 'application/cwl', |
|
| 187 | - 'cww' => 'application/prs.cww', |
|
| 188 | - 'cxt' => 'application/x-director', |
|
| 189 | - 'cxx' => 'text/x-c', |
|
| 190 | - 'dae' => 'model/vnd.collada+xml', |
|
| 191 | - 'daf' => 'application/vnd.mobius.daf', |
|
| 192 | - 'dart' => 'application/vnd.dart', |
|
| 193 | - 'dataless' => 'application/vnd.fdsn.seed', |
|
| 194 | - 'davmount' => 'application/davmount+xml', |
|
| 195 | - 'dbf' => 'application/vnd.dbf', |
|
| 196 | - 'dbk' => 'application/docbook+xml', |
|
| 197 | - 'dcr' => 'application/x-director', |
|
| 198 | - 'dcurl' => 'text/vnd.curl.dcurl', |
|
| 199 | - 'dd2' => 'application/vnd.oma.dd2+xml', |
|
| 200 | - 'ddd' => 'application/vnd.fujixerox.ddd', |
|
| 201 | - 'ddf' => 'application/vnd.syncml.dmddf+xml', |
|
| 202 | - 'dds' => 'image/vnd.ms-dds', |
|
| 203 | - 'deb' => 'application/x-debian-package', |
|
| 204 | - 'def' => 'text/plain', |
|
| 205 | - 'deploy' => 'application/octet-stream', |
|
| 206 | - 'der' => 'application/x-x509-ca-cert', |
|
| 207 | - 'dfac' => 'application/vnd.dreamfactory', |
|
| 208 | - 'dgc' => 'application/x-dgc-compressed', |
|
| 209 | - 'dib' => 'image/bmp', |
|
| 210 | - 'dic' => 'text/x-c', |
|
| 211 | - 'dir' => 'application/x-director', |
|
| 212 | - 'dis' => 'application/vnd.mobius.dis', |
|
| 213 | - 'disposition-notification' => 'message/disposition-notification', |
|
| 214 | - 'dist' => 'application/octet-stream', |
|
| 215 | - 'distz' => 'application/octet-stream', |
|
| 216 | - 'djv' => 'image/vnd.djvu', |
|
| 217 | - 'djvu' => 'image/vnd.djvu', |
|
| 218 | - 'dll' => 'application/octet-stream', |
|
| 219 | - 'dmg' => 'application/x-apple-diskimage', |
|
| 220 | - 'dmn' => 'application/octet-stream', |
|
| 221 | - 'dmp' => 'application/vnd.tcpdump.pcap', |
|
| 222 | - 'dms' => 'application/octet-stream', |
|
| 223 | - 'dna' => 'application/vnd.dna', |
|
| 224 | - 'doc' => 'application/msword', |
|
| 225 | - 'docm' => 'application/vnd.ms-word.template.macroEnabled.12', |
|
| 226 | - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', |
|
| 227 | - 'dot' => 'application/msword', |
|
| 228 | - 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', |
|
| 229 | - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', |
|
| 230 | - 'dp' => 'application/vnd.osgi.dp', |
|
| 231 | - 'dpg' => 'application/vnd.dpgraph', |
|
| 232 | - 'dpx' => 'image/dpx', |
|
| 233 | - 'dra' => 'audio/vnd.dra', |
|
| 234 | - 'drle' => 'image/dicom-rle', |
|
| 235 | - 'dsc' => 'text/prs.lines.tag', |
|
| 236 | - 'dssc' => 'application/dssc+der', |
|
| 237 | - 'dtb' => 'application/x-dtbook+xml', |
|
| 238 | - 'dtd' => 'application/xml-dtd', |
|
| 239 | - 'dts' => 'audio/vnd.dts', |
|
| 240 | - 'dtshd' => 'audio/vnd.dts.hd', |
|
| 241 | - 'dump' => 'application/octet-stream', |
|
| 242 | - 'dvb' => 'video/vnd.dvb.file', |
|
| 243 | - 'dvi' => 'application/x-dvi', |
|
| 244 | - 'dwd' => 'application/atsc-dwd+xml', |
|
| 245 | - 'dwf' => 'model/vnd.dwf', |
|
| 246 | - 'dwg' => 'image/vnd.dwg', |
|
| 247 | - 'dxf' => 'image/vnd.dxf', |
|
| 248 | - 'dxp' => 'application/vnd.spotfire.dxp', |
|
| 249 | - 'dxr' => 'application/x-director', |
|
| 250 | - 'ear' => 'application/java-archive', |
|
| 251 | - 'ecelp4800' => 'audio/vnd.nuera.ecelp4800', |
|
| 252 | - 'ecelp7470' => 'audio/vnd.nuera.ecelp7470', |
|
| 253 | - 'ecelp9600' => 'audio/vnd.nuera.ecelp9600', |
|
| 254 | - 'ecma' => 'application/ecmascript', |
|
| 255 | - 'edm' => 'application/vnd.novadigm.edm', |
|
| 256 | - 'edx' => 'application/vnd.novadigm.edx', |
|
| 257 | - 'efif' => 'application/vnd.picsel', |
|
| 258 | - 'ei6' => 'application/vnd.pg.osasli', |
|
| 259 | - 'elc' => 'application/octet-stream', |
|
| 260 | - 'emf' => 'image/emf', |
|
| 261 | - 'eml' => 'message/rfc822', |
|
| 262 | - 'emma' => 'application/emma+xml', |
|
| 263 | - 'emotionml' => 'application/emotionml+xml', |
|
| 264 | - 'emz' => 'application/x-msmetafile', |
|
| 265 | - 'eol' => 'audio/vnd.digital-winds', |
|
| 266 | - 'eot' => 'application/vnd.ms-fontobject', |
|
| 267 | - 'eps' => 'application/postscript', |
|
| 268 | - 'epub' => 'application/epub+zip', |
|
| 269 | - 'es3' => 'application/vnd.eszigno3+xml', |
|
| 270 | - 'esa' => 'application/vnd.osgi.subsystem', |
|
| 271 | - 'esf' => 'application/vnd.epson.esf', |
|
| 272 | - 'et3' => 'application/vnd.eszigno3+xml', |
|
| 273 | - 'etx' => 'text/x-setext', |
|
| 274 | - 'eva' => 'application/x-eva', |
|
| 275 | - 'evy' => 'application/x-envoy', |
|
| 276 | - 'exe' => 'application/octet-stream', |
|
| 277 | - 'exi' => 'application/exi', |
|
| 278 | - 'exp' => 'application/express', |
|
| 279 | - 'exr' => 'image/aces', |
|
| 280 | - 'ext' => 'application/vnd.novadigm.ext', |
|
| 281 | - 'ez' => 'application/andrew-inset', |
|
| 282 | - 'ez2' => 'application/vnd.ezpix-album', |
|
| 283 | - 'ez3' => 'application/vnd.ezpix-package', |
|
| 284 | - 'f' => 'text/x-fortran', |
|
| 285 | - 'f4v' => 'video/mp4', |
|
| 286 | - 'f77' => 'text/x-fortran', |
|
| 287 | - 'f90' => 'text/x-fortran', |
|
| 288 | - 'fbs' => 'image/vnd.fastbidsheet', |
|
| 289 | - 'fcdt' => 'application/vnd.adobe.formscentral.fcdt', |
|
| 290 | - 'fcs' => 'application/vnd.isac.fcs', |
|
| 291 | - 'fdf' => 'application/vnd.fdf', |
|
| 292 | - 'fdt' => 'application/fdt+xml', |
|
| 293 | - 'fe_launch' => 'application/vnd.denovo.fcselayout-link', |
|
| 294 | - 'fg5' => 'application/vnd.fujitsu.oasysgp', |
|
| 295 | - 'fgd' => 'application/x-director', |
|
| 296 | - 'fh' => 'image/x-freehand', |
|
| 297 | - 'fh4' => 'image/x-freehand', |
|
| 298 | - 'fh5' => 'image/x-freehand', |
|
| 299 | - 'fh7' => 'image/x-freehand', |
|
| 300 | - 'fhc' => 'image/x-freehand', |
|
| 301 | - 'fig' => 'application/x-xfig', |
|
| 302 | - 'fits' => 'image/fits', |
|
| 303 | - 'flac' => 'audio/x-flac', |
|
| 304 | - 'fli' => 'video/x-fli', |
|
| 305 | - 'flo' => 'application/vnd.micrografx.flo', |
|
| 306 | - 'flv' => 'video/x-flv', |
|
| 307 | - 'flw' => 'application/vnd.kde.kivio', |
|
| 308 | - 'flx' => 'text/vnd.fmi.flexstor', |
|
| 309 | - 'fly' => 'text/vnd.fly', |
|
| 310 | - 'fm' => 'application/vnd.framemaker', |
|
| 311 | - 'fnc' => 'application/vnd.frogans.fnc', |
|
| 312 | - 'fo' => 'application/vnd.software602.filler.form+xml', |
|
| 313 | - 'for' => 'text/x-fortran', |
|
| 314 | - 'fpx' => 'image/vnd.fpx', |
|
| 315 | - 'frame' => 'application/vnd.framemaker', |
|
| 316 | - 'fsc' => 'application/vnd.fsc.weblaunch', |
|
| 317 | - 'fst' => 'image/vnd.fst', |
|
| 318 | - 'ftc' => 'application/vnd.fluxtime.clip', |
|
| 319 | - 'fti' => 'application/vnd.anser-web-funds-transfer-initiation', |
|
| 320 | - 'fvt' => 'video/vnd.fvt', |
|
| 321 | - 'fxp' => 'application/vnd.adobe.fxp', |
|
| 322 | - 'fxpl' => 'application/vnd.adobe.fxp', |
|
| 323 | - 'fzs' => 'application/vnd.fuzzysheet', |
|
| 324 | - 'g2w' => 'application/vnd.geoplan', |
|
| 325 | - 'g3' => 'image/g3fax', |
|
| 326 | - 'g3w' => 'application/vnd.geospace', |
|
| 327 | - 'gac' => 'application/vnd.groove-account', |
|
| 328 | - 'gam' => 'application/x-tads', |
|
| 329 | - 'gbr' => 'application/rpki-ghostbusters', |
|
| 330 | - 'gca' => 'application/x-gca-compressed', |
|
| 331 | - 'gdl' => 'model/vnd.gdl', |
|
| 332 | - 'gdoc' => 'application/vnd.google-apps.document', |
|
| 333 | - 'ged' => 'text/vnd.familysearch.gedcom', |
|
| 334 | - 'geo' => 'application/vnd.dynageo', |
|
| 335 | - 'geojson' => 'application/geo+json', |
|
| 336 | - 'gex' => 'application/vnd.geometry-explorer', |
|
| 337 | - 'ggb' => 'application/vnd.geogebra.file', |
|
| 338 | - 'ggt' => 'application/vnd.geogebra.tool', |
|
| 339 | - 'ghf' => 'application/vnd.groove-help', |
|
| 340 | - 'gif' => 'image/gif', |
|
| 341 | - 'gim' => 'application/vnd.groove-identity-message', |
|
| 342 | - 'glb' => 'model/gltf-binary', |
|
| 343 | - 'gltf' => 'model/gltf+json', |
|
| 344 | - 'gml' => 'application/gml+xml', |
|
| 345 | - 'gmx' => 'application/vnd.gmx', |
|
| 346 | - 'gnumeric' => 'application/x-gnumeric', |
|
| 347 | - 'gpg' => 'application/gpg-keys', |
|
| 348 | - 'gph' => 'application/vnd.flographit', |
|
| 349 | - 'gpx' => 'application/gpx+xml', |
|
| 350 | - 'gqf' => 'application/vnd.grafeq', |
|
| 351 | - 'gqs' => 'application/vnd.grafeq', |
|
| 352 | - 'gram' => 'application/srgs', |
|
| 353 | - 'gramps' => 'application/x-gramps-xml', |
|
| 354 | - 'gre' => 'application/vnd.geometry-explorer', |
|
| 355 | - 'grv' => 'application/vnd.groove-injector', |
|
| 356 | - 'grxml' => 'application/srgs+xml', |
|
| 357 | - 'gsf' => 'application/x-font-ghostscript', |
|
| 358 | - 'gsheet' => 'application/vnd.google-apps.spreadsheet', |
|
| 359 | - 'gslides' => 'application/vnd.google-apps.presentation', |
|
| 360 | - 'gtar' => 'application/x-gtar', |
|
| 361 | - 'gtm' => 'application/vnd.groove-tool-message', |
|
| 362 | - 'gtw' => 'model/vnd.gtw', |
|
| 363 | - 'gv' => 'text/vnd.graphviz', |
|
| 364 | - 'gxf' => 'application/gxf', |
|
| 365 | - 'gxt' => 'application/vnd.geonext', |
|
| 366 | - 'gz' => 'application/gzip', |
|
| 367 | - 'gzip' => 'application/gzip', |
|
| 368 | - 'h' => 'text/x-c', |
|
| 369 | - 'h261' => 'video/h261', |
|
| 370 | - 'h263' => 'video/h263', |
|
| 371 | - 'h264' => 'video/h264', |
|
| 372 | - 'hal' => 'application/vnd.hal+xml', |
|
| 373 | - 'hbci' => 'application/vnd.hbci', |
|
| 374 | - 'hbs' => 'text/x-handlebars-template', |
|
| 375 | - 'hdd' => 'application/x-virtualbox-hdd', |
|
| 376 | - 'hdf' => 'application/x-hdf', |
|
| 377 | - 'heic' => 'image/heic', |
|
| 378 | - 'heics' => 'image/heic-sequence', |
|
| 379 | - 'heif' => 'image/heif', |
|
| 380 | - 'heifs' => 'image/heif-sequence', |
|
| 381 | - 'hej2' => 'image/hej2k', |
|
| 382 | - 'held' => 'application/atsc-held+xml', |
|
| 383 | - 'hh' => 'text/x-c', |
|
| 384 | - 'hjson' => 'application/hjson', |
|
| 385 | - 'hlp' => 'application/winhlp', |
|
| 386 | - 'hpgl' => 'application/vnd.hp-hpgl', |
|
| 387 | - 'hpid' => 'application/vnd.hp-hpid', |
|
| 388 | - 'hps' => 'application/vnd.hp-hps', |
|
| 389 | - 'hqx' => 'application/mac-binhex40', |
|
| 390 | - 'hsj2' => 'image/hsj2', |
|
| 391 | - 'htc' => 'text/x-component', |
|
| 392 | - 'htke' => 'application/vnd.kenameaapp', |
|
| 393 | - 'htm' => 'text/html', |
|
| 394 | - 'html' => 'text/html', |
|
| 395 | - 'hvd' => 'application/vnd.yamaha.hv-dic', |
|
| 396 | - 'hvp' => 'application/vnd.yamaha.hv-voice', |
|
| 397 | - 'hvs' => 'application/vnd.yamaha.hv-script', |
|
| 398 | - 'i2g' => 'application/vnd.intergeo', |
|
| 399 | - 'icc' => 'application/vnd.iccprofile', |
|
| 400 | - 'ice' => 'x-conference/x-cooltalk', |
|
| 401 | - 'icm' => 'application/vnd.iccprofile', |
|
| 402 | - 'ico' => 'image/x-icon', |
|
| 403 | - 'ics' => 'text/calendar', |
|
| 404 | - 'ief' => 'image/ief', |
|
| 405 | - 'ifb' => 'text/calendar', |
|
| 406 | - 'ifm' => 'application/vnd.shana.informed.formdata', |
|
| 407 | - 'iges' => 'model/iges', |
|
| 408 | - 'igl' => 'application/vnd.igloader', |
|
| 409 | - 'igm' => 'application/vnd.insors.igm', |
|
| 410 | - 'igs' => 'model/iges', |
|
| 411 | - 'igx' => 'application/vnd.micrografx.igx', |
|
| 412 | - 'iif' => 'application/vnd.shana.informed.interchange', |
|
| 413 | - 'img' => 'application/octet-stream', |
|
| 414 | - 'imp' => 'application/vnd.accpac.simply.imp', |
|
| 415 | - 'ims' => 'application/vnd.ms-ims', |
|
| 416 | - 'in' => 'text/plain', |
|
| 417 | - 'ini' => 'text/plain', |
|
| 418 | - 'ink' => 'application/inkml+xml', |
|
| 419 | - 'inkml' => 'application/inkml+xml', |
|
| 420 | - 'install' => 'application/x-install-instructions', |
|
| 421 | - 'iota' => 'application/vnd.astraea-software.iota', |
|
| 422 | - 'ipfix' => 'application/ipfix', |
|
| 423 | - 'ipk' => 'application/vnd.shana.informed.package', |
|
| 424 | - 'irm' => 'application/vnd.ibm.rights-management', |
|
| 425 | - 'irp' => 'application/vnd.irepository.package+xml', |
|
| 426 | - 'iso' => 'application/x-iso9660-image', |
|
| 427 | - 'itp' => 'application/vnd.shana.informed.formtemplate', |
|
| 428 | - 'its' => 'application/its+xml', |
|
| 429 | - 'ivp' => 'application/vnd.immervision-ivp', |
|
| 430 | - 'ivu' => 'application/vnd.immervision-ivu', |
|
| 431 | - 'jad' => 'text/vnd.sun.j2me.app-descriptor', |
|
| 432 | - 'jade' => 'text/jade', |
|
| 433 | - 'jam' => 'application/vnd.jam', |
|
| 434 | - 'jar' => 'application/java-archive', |
|
| 435 | - 'jardiff' => 'application/x-java-archive-diff', |
|
| 436 | - 'java' => 'text/x-java-source', |
|
| 437 | - 'jhc' => 'image/jphc', |
|
| 438 | - 'jisp' => 'application/vnd.jisp', |
|
| 439 | - 'jls' => 'image/jls', |
|
| 440 | - 'jlt' => 'application/vnd.hp-jlyt', |
|
| 441 | - 'jng' => 'image/x-jng', |
|
| 442 | - 'jnlp' => 'application/x-java-jnlp-file', |
|
| 443 | - 'joda' => 'application/vnd.joost.joda-archive', |
|
| 444 | - 'jp2' => 'image/jp2', |
|
| 445 | - 'jpe' => 'image/jpeg', |
|
| 446 | - 'jpeg' => 'image/jpeg', |
|
| 447 | - 'jpf' => 'image/jpx', |
|
| 448 | - 'jpg' => 'image/jpeg', |
|
| 449 | - 'jpg2' => 'image/jp2', |
|
| 450 | - 'jpgm' => 'video/jpm', |
|
| 451 | - 'jpgv' => 'video/jpeg', |
|
| 452 | - 'jph' => 'image/jph', |
|
| 453 | - 'jpm' => 'video/jpm', |
|
| 454 | - 'jpx' => 'image/jpx', |
|
| 455 | - 'js' => 'application/javascript', |
|
| 456 | - 'json' => 'application/json', |
|
| 457 | - 'json5' => 'application/json5', |
|
| 458 | - 'jsonld' => 'application/ld+json', |
|
| 459 | - 'jsonml' => 'application/jsonml+json', |
|
| 460 | - 'jsx' => 'text/jsx', |
|
| 461 | - 'jt' => 'model/jt', |
|
| 462 | - 'jxr' => 'image/jxr', |
|
| 463 | - 'jxra' => 'image/jxra', |
|
| 464 | - 'jxrs' => 'image/jxrs', |
|
| 465 | - 'jxs' => 'image/jxs', |
|
| 466 | - 'jxsc' => 'image/jxsc', |
|
| 467 | - 'jxsi' => 'image/jxsi', |
|
| 468 | - 'jxss' => 'image/jxss', |
|
| 469 | - 'kar' => 'audio/midi', |
|
| 470 | - 'karbon' => 'application/vnd.kde.karbon', |
|
| 471 | - 'kdb' => 'application/octet-stream', |
|
| 472 | - 'kdbx' => 'application/x-keepass2', |
|
| 473 | - 'key' => 'application/x-iwork-keynote-sffkey', |
|
| 474 | - 'kfo' => 'application/vnd.kde.kformula', |
|
| 475 | - 'kia' => 'application/vnd.kidspiration', |
|
| 476 | - 'kml' => 'application/vnd.google-earth.kml+xml', |
|
| 477 | - 'kmz' => 'application/vnd.google-earth.kmz', |
|
| 478 | - 'kne' => 'application/vnd.kinar', |
|
| 479 | - 'knp' => 'application/vnd.kinar', |
|
| 480 | - 'kon' => 'application/vnd.kde.kontour', |
|
| 481 | - 'kpr' => 'application/vnd.kde.kpresenter', |
|
| 482 | - 'kpt' => 'application/vnd.kde.kpresenter', |
|
| 483 | - 'kpxx' => 'application/vnd.ds-keypoint', |
|
| 484 | - 'ksp' => 'application/vnd.kde.kspread', |
|
| 485 | - 'ktr' => 'application/vnd.kahootz', |
|
| 486 | - 'ktx' => 'image/ktx', |
|
| 487 | - 'ktx2' => 'image/ktx2', |
|
| 488 | - 'ktz' => 'application/vnd.kahootz', |
|
| 489 | - 'kwd' => 'application/vnd.kde.kword', |
|
| 490 | - 'kwt' => 'application/vnd.kde.kword', |
|
| 491 | - 'lasxml' => 'application/vnd.las.las+xml', |
|
| 492 | - 'latex' => 'application/x-latex', |
|
| 493 | - 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop', |
|
| 494 | - 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml', |
|
| 495 | - 'les' => 'application/vnd.hhe.lesson-player', |
|
| 496 | - 'less' => 'text/less', |
|
| 497 | - 'lgr' => 'application/lgr+xml', |
|
| 498 | - 'lha' => 'application/octet-stream', |
|
| 499 | - 'link66' => 'application/vnd.route66.link66+xml', |
|
| 500 | - 'list' => 'text/plain', |
|
| 501 | - 'list3820' => 'application/vnd.ibm.modcap', |
|
| 502 | - 'listafp' => 'application/vnd.ibm.modcap', |
|
| 503 | - 'litcoffee' => 'text/coffeescript', |
|
| 504 | - 'lnk' => 'application/x-ms-shortcut', |
|
| 505 | - 'log' => 'text/plain', |
|
| 506 | - 'lostxml' => 'application/lost+xml', |
|
| 507 | - 'lrf' => 'application/octet-stream', |
|
| 508 | - 'lrm' => 'application/vnd.ms-lrm', |
|
| 509 | - 'ltf' => 'application/vnd.frogans.ltf', |
|
| 510 | - 'lua' => 'text/x-lua', |
|
| 511 | - 'luac' => 'application/x-lua-bytecode', |
|
| 512 | - 'lvp' => 'audio/vnd.lucent.voice', |
|
| 513 | - 'lwp' => 'application/vnd.lotus-wordpro', |
|
| 514 | - 'lzh' => 'application/octet-stream', |
|
| 515 | - 'm1v' => 'video/mpeg', |
|
| 516 | - 'm2a' => 'audio/mpeg', |
|
| 517 | - 'm2v' => 'video/mpeg', |
|
| 518 | - 'm3a' => 'audio/mpeg', |
|
| 519 | - 'm3u' => 'text/plain', |
|
| 520 | - 'm3u8' => 'application/vnd.apple.mpegurl', |
|
| 521 | - 'm4a' => 'audio/x-m4a', |
|
| 522 | - 'm4p' => 'application/mp4', |
|
| 523 | - 'm4s' => 'video/iso.segment', |
|
| 524 | - 'm4u' => 'application/vnd.mpegurl', |
|
| 525 | - 'm4v' => 'video/x-m4v', |
|
| 526 | - 'm13' => 'application/x-msmediaview', |
|
| 527 | - 'm14' => 'application/x-msmediaview', |
|
| 528 | - 'm21' => 'application/mp21', |
|
| 529 | - 'ma' => 'application/mathematica', |
|
| 530 | - 'mads' => 'application/mads+xml', |
|
| 531 | - 'maei' => 'application/mmt-aei+xml', |
|
| 532 | - 'mag' => 'application/vnd.ecowin.chart', |
|
| 533 | - 'maker' => 'application/vnd.framemaker', |
|
| 534 | - 'man' => 'text/troff', |
|
| 535 | - 'manifest' => 'text/cache-manifest', |
|
| 536 | - 'map' => 'application/json', |
|
| 537 | - 'mar' => 'application/octet-stream', |
|
| 538 | - 'markdown' => 'text/markdown', |
|
| 539 | - 'mathml' => 'application/mathml+xml', |
|
| 540 | - 'mb' => 'application/mathematica', |
|
| 541 | - 'mbk' => 'application/vnd.mobius.mbk', |
|
| 542 | - 'mbox' => 'application/mbox', |
|
| 543 | - 'mc1' => 'application/vnd.medcalcdata', |
|
| 544 | - 'mcd' => 'application/vnd.mcd', |
|
| 545 | - 'mcurl' => 'text/vnd.curl.mcurl', |
|
| 546 | - 'md' => 'text/markdown', |
|
| 547 | - 'mdb' => 'application/x-msaccess', |
|
| 548 | - 'mdi' => 'image/vnd.ms-modi', |
|
| 549 | - 'mdx' => 'text/mdx', |
|
| 550 | - 'me' => 'text/troff', |
|
| 551 | - 'mesh' => 'model/mesh', |
|
| 552 | - 'meta4' => 'application/metalink4+xml', |
|
| 553 | - 'metalink' => 'application/metalink+xml', |
|
| 554 | - 'mets' => 'application/mets+xml', |
|
| 555 | - 'mfm' => 'application/vnd.mfmp', |
|
| 556 | - 'mft' => 'application/rpki-manifest', |
|
| 557 | - 'mgp' => 'application/vnd.osgeo.mapguide.package', |
|
| 558 | - 'mgz' => 'application/vnd.proteus.magazine', |
|
| 559 | - 'mid' => 'audio/midi', |
|
| 560 | - 'midi' => 'audio/midi', |
|
| 561 | - 'mie' => 'application/x-mie', |
|
| 562 | - 'mif' => 'application/vnd.mif', |
|
| 563 | - 'mime' => 'message/rfc822', |
|
| 564 | - 'mj2' => 'video/mj2', |
|
| 565 | - 'mjp2' => 'video/mj2', |
|
| 566 | - 'mjs' => 'text/javascript', |
|
| 567 | - 'mk3d' => 'video/x-matroska', |
|
| 568 | - 'mka' => 'audio/x-matroska', |
|
| 569 | - 'mkd' => 'text/x-markdown', |
|
| 570 | - 'mks' => 'video/x-matroska', |
|
| 571 | - 'mkv' => 'video/x-matroska', |
|
| 572 | - 'mlp' => 'application/vnd.dolby.mlp', |
|
| 573 | - 'mmd' => 'application/vnd.chipnuts.karaoke-mmd', |
|
| 574 | - 'mmf' => 'application/vnd.smaf', |
|
| 575 | - 'mml' => 'text/mathml', |
|
| 576 | - 'mmr' => 'image/vnd.fujixerox.edmics-mmr', |
|
| 577 | - 'mng' => 'video/x-mng', |
|
| 578 | - 'mny' => 'application/x-msmoney', |
|
| 579 | - 'mobi' => 'application/x-mobipocket-ebook', |
|
| 580 | - 'mods' => 'application/mods+xml', |
|
| 581 | - 'mov' => 'video/quicktime', |
|
| 582 | - 'movie' => 'video/x-sgi-movie', |
|
| 583 | - 'mp2' => 'audio/mpeg', |
|
| 584 | - 'mp2a' => 'audio/mpeg', |
|
| 585 | - 'mp3' => 'audio/mpeg', |
|
| 586 | - 'mp4' => 'video/mp4', |
|
| 587 | - 'mp4a' => 'audio/mp4', |
|
| 588 | - 'mp4s' => 'application/mp4', |
|
| 589 | - 'mp4v' => 'video/mp4', |
|
| 590 | - 'mp21' => 'application/mp21', |
|
| 591 | - 'mpc' => 'application/vnd.mophun.certificate', |
|
| 592 | - 'mpd' => 'application/dash+xml', |
|
| 593 | - 'mpe' => 'video/mpeg', |
|
| 594 | - 'mpeg' => 'video/mpeg', |
|
| 595 | - 'mpf' => 'application/media-policy-dataset+xml', |
|
| 596 | - 'mpg' => 'video/mpeg', |
|
| 597 | - 'mpg4' => 'video/mp4', |
|
| 598 | - 'mpga' => 'audio/mpeg', |
|
| 599 | - 'mpkg' => 'application/vnd.apple.installer+xml', |
|
| 600 | - 'mpm' => 'application/vnd.blueice.multipass', |
|
| 601 | - 'mpn' => 'application/vnd.mophun.application', |
|
| 602 | - 'mpp' => 'application/vnd.ms-project', |
|
| 603 | - 'mpt' => 'application/vnd.ms-project', |
|
| 604 | - 'mpy' => 'application/vnd.ibm.minipay', |
|
| 605 | - 'mqy' => 'application/vnd.mobius.mqy', |
|
| 606 | - 'mrc' => 'application/marc', |
|
| 607 | - 'mrcx' => 'application/marcxml+xml', |
|
| 608 | - 'ms' => 'text/troff', |
|
| 609 | - 'mscml' => 'application/mediaservercontrol+xml', |
|
| 610 | - 'mseed' => 'application/vnd.fdsn.mseed', |
|
| 611 | - 'mseq' => 'application/vnd.mseq', |
|
| 612 | - 'msf' => 'application/vnd.epson.msf', |
|
| 613 | - 'msg' => 'application/vnd.ms-outlook', |
|
| 614 | - 'msh' => 'model/mesh', |
|
| 615 | - 'msi' => 'application/x-msdownload', |
|
| 616 | - 'msix' => 'application/msix', |
|
| 617 | - 'msixbundle' => 'application/msixbundle', |
|
| 618 | - 'msl' => 'application/vnd.mobius.msl', |
|
| 619 | - 'msm' => 'application/octet-stream', |
|
| 620 | - 'msp' => 'application/octet-stream', |
|
| 621 | - 'msty' => 'application/vnd.muvee.style', |
|
| 622 | - 'mtl' => 'model/mtl', |
|
| 623 | - 'mts' => 'model/vnd.mts', |
|
| 624 | - 'mus' => 'application/vnd.musician', |
|
| 625 | - 'musd' => 'application/mmt-usd+xml', |
|
| 626 | - 'musicxml' => 'application/vnd.recordare.musicxml+xml', |
|
| 627 | - 'mvb' => 'application/x-msmediaview', |
|
| 628 | - 'mvt' => 'application/vnd.mapbox-vector-tile', |
|
| 629 | - 'mwf' => 'application/vnd.mfer', |
|
| 630 | - 'mxf' => 'application/mxf', |
|
| 631 | - 'mxl' => 'application/vnd.recordare.musicxml', |
|
| 632 | - 'mxmf' => 'audio/mobile-xmf', |
|
| 633 | - 'mxml' => 'application/xv+xml', |
|
| 634 | - 'mxs' => 'application/vnd.triscape.mxs', |
|
| 635 | - 'mxu' => 'video/vnd.mpegurl', |
|
| 636 | - 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install', |
|
| 637 | - 'n3' => 'text/n3', |
|
| 638 | - 'nb' => 'application/mathematica', |
|
| 639 | - 'nbp' => 'application/vnd.wolfram.player', |
|
| 640 | - 'nc' => 'application/x-netcdf', |
|
| 641 | - 'ncx' => 'application/x-dtbncx+xml', |
|
| 642 | - 'nfo' => 'text/x-nfo', |
|
| 643 | - 'ngdat' => 'application/vnd.nokia.n-gage.data', |
|
| 644 | - 'nitf' => 'application/vnd.nitf', |
|
| 645 | - 'nlu' => 'application/vnd.neurolanguage.nlu', |
|
| 646 | - 'nml' => 'application/vnd.enliven', |
|
| 647 | - 'nnd' => 'application/vnd.noblenet-directory', |
|
| 648 | - 'nns' => 'application/vnd.noblenet-sealer', |
|
| 649 | - 'nnw' => 'application/vnd.noblenet-web', |
|
| 650 | - 'npx' => 'image/vnd.net-fpx', |
|
| 651 | - 'nq' => 'application/n-quads', |
|
| 652 | - 'nsc' => 'application/x-conference', |
|
| 653 | - 'nsf' => 'application/vnd.lotus-notes', |
|
| 654 | - 'nt' => 'application/n-triples', |
|
| 655 | - 'ntf' => 'application/vnd.nitf', |
|
| 656 | - 'numbers' => 'application/x-iwork-numbers-sffnumbers', |
|
| 657 | - 'nzb' => 'application/x-nzb', |
|
| 658 | - 'oa2' => 'application/vnd.fujitsu.oasys2', |
|
| 659 | - 'oa3' => 'application/vnd.fujitsu.oasys3', |
|
| 660 | - 'oas' => 'application/vnd.fujitsu.oasys', |
|
| 661 | - 'obd' => 'application/x-msbinder', |
|
| 662 | - 'obgx' => 'application/vnd.openblox.game+xml', |
|
| 663 | - 'obj' => 'model/obj', |
|
| 664 | - 'oda' => 'application/oda', |
|
| 665 | - 'odb' => 'application/vnd.oasis.opendocument.database', |
|
| 666 | - 'odc' => 'application/vnd.oasis.opendocument.chart', |
|
| 667 | - 'odf' => 'application/vnd.oasis.opendocument.formula', |
|
| 668 | - 'odft' => 'application/vnd.oasis.opendocument.formula-template', |
|
| 669 | - 'odg' => 'application/vnd.oasis.opendocument.graphics', |
|
| 670 | - 'odi' => 'application/vnd.oasis.opendocument.image', |
|
| 671 | - 'odm' => 'application/vnd.oasis.opendocument.text-master', |
|
| 672 | - 'odp' => 'application/vnd.oasis.opendocument.presentation', |
|
| 673 | - 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', |
|
| 674 | - 'odt' => 'application/vnd.oasis.opendocument.text', |
|
| 675 | - 'oga' => 'audio/ogg', |
|
| 676 | - 'ogex' => 'model/vnd.opengex', |
|
| 677 | - 'ogg' => 'audio/ogg', |
|
| 678 | - 'ogv' => 'video/ogg', |
|
| 679 | - 'ogx' => 'application/ogg', |
|
| 680 | - 'omdoc' => 'application/omdoc+xml', |
|
| 681 | - 'onepkg' => 'application/onenote', |
|
| 682 | - 'onetmp' => 'application/onenote', |
|
| 683 | - 'onetoc' => 'application/onenote', |
|
| 684 | - 'onetoc2' => 'application/onenote', |
|
| 685 | - 'opf' => 'application/oebps-package+xml', |
|
| 686 | - 'opml' => 'text/x-opml', |
|
| 687 | - 'oprc' => 'application/vnd.palm', |
|
| 688 | - 'opus' => 'audio/ogg', |
|
| 689 | - 'org' => 'text/x-org', |
|
| 690 | - 'osf' => 'application/vnd.yamaha.openscoreformat', |
|
| 691 | - 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml', |
|
| 692 | - 'osm' => 'application/vnd.openstreetmap.data+xml', |
|
| 693 | - 'otc' => 'application/vnd.oasis.opendocument.chart-template', |
|
| 694 | - 'otf' => 'font/otf', |
|
| 695 | - 'otg' => 'application/vnd.oasis.opendocument.graphics-template', |
|
| 696 | - 'oth' => 'application/vnd.oasis.opendocument.text-web', |
|
| 697 | - 'oti' => 'application/vnd.oasis.opendocument.image-template', |
|
| 698 | - 'otp' => 'application/vnd.oasis.opendocument.presentation-template', |
|
| 699 | - 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', |
|
| 700 | - 'ott' => 'application/vnd.oasis.opendocument.text-template', |
|
| 701 | - 'ova' => 'application/x-virtualbox-ova', |
|
| 702 | - 'ovf' => 'application/x-virtualbox-ovf', |
|
| 703 | - 'owl' => 'application/rdf+xml', |
|
| 704 | - 'oxps' => 'application/oxps', |
|
| 705 | - 'oxt' => 'application/vnd.openofficeorg.extension', |
|
| 706 | - 'p' => 'text/x-pascal', |
|
| 707 | - 'p7a' => 'application/x-pkcs7-signature', |
|
| 708 | - 'p7b' => 'application/x-pkcs7-certificates', |
|
| 709 | - 'p7c' => 'application/pkcs7-mime', |
|
| 710 | - 'p7m' => 'application/pkcs7-mime', |
|
| 711 | - 'p7r' => 'application/x-pkcs7-certreqresp', |
|
| 712 | - 'p7s' => 'application/pkcs7-signature', |
|
| 713 | - 'p8' => 'application/pkcs8', |
|
| 714 | - 'p10' => 'application/x-pkcs10', |
|
| 715 | - 'p12' => 'application/x-pkcs12', |
|
| 716 | - 'pac' => 'application/x-ns-proxy-autoconfig', |
|
| 717 | - 'pages' => 'application/x-iwork-pages-sffpages', |
|
| 718 | - 'pas' => 'text/x-pascal', |
|
| 719 | - 'paw' => 'application/vnd.pawaafile', |
|
| 720 | - 'pbd' => 'application/vnd.powerbuilder6', |
|
| 721 | - 'pbm' => 'image/x-portable-bitmap', |
|
| 722 | - 'pcap' => 'application/vnd.tcpdump.pcap', |
|
| 723 | - 'pcf' => 'application/x-font-pcf', |
|
| 724 | - 'pcl' => 'application/vnd.hp-pcl', |
|
| 725 | - 'pclxl' => 'application/vnd.hp-pclxl', |
|
| 726 | - 'pct' => 'image/x-pict', |
|
| 727 | - 'pcurl' => 'application/vnd.curl.pcurl', |
|
| 728 | - 'pcx' => 'image/x-pcx', |
|
| 729 | - 'pdb' => 'application/x-pilot', |
|
| 730 | - 'pde' => 'text/x-processing', |
|
| 731 | - 'pdf' => 'application/pdf', |
|
| 732 | - 'pem' => 'application/x-x509-user-cert', |
|
| 733 | - 'pfa' => 'application/x-font-type1', |
|
| 734 | - 'pfb' => 'application/x-font-type1', |
|
| 735 | - 'pfm' => 'application/x-font-type1', |
|
| 736 | - 'pfr' => 'application/font-tdpfr', |
|
| 737 | - 'pfx' => 'application/x-pkcs12', |
|
| 738 | - 'pgm' => 'image/x-portable-graymap', |
|
| 739 | - 'pgn' => 'application/x-chess-pgn', |
|
| 740 | - 'pgp' => 'application/pgp', |
|
| 741 | - 'phar' => 'application/octet-stream', |
|
| 742 | - 'php' => 'application/x-httpd-php', |
|
| 743 | - 'php3' => 'application/x-httpd-php', |
|
| 744 | - 'php4' => 'application/x-httpd-php', |
|
| 745 | - 'phps' => 'application/x-httpd-php-source', |
|
| 746 | - 'phtml' => 'application/x-httpd-php', |
|
| 747 | - 'pic' => 'image/x-pict', |
|
| 748 | - 'pkg' => 'application/octet-stream', |
|
| 749 | - 'pki' => 'application/pkixcmp', |
|
| 750 | - 'pkipath' => 'application/pkix-pkipath', |
|
| 751 | - 'pkpass' => 'application/vnd.apple.pkpass', |
|
| 752 | - 'pl' => 'application/x-perl', |
|
| 753 | - 'plb' => 'application/vnd.3gpp.pic-bw-large', |
|
| 754 | - 'plc' => 'application/vnd.mobius.plc', |
|
| 755 | - 'plf' => 'application/vnd.pocketlearn', |
|
| 756 | - 'pls' => 'application/pls+xml', |
|
| 757 | - 'pm' => 'application/x-perl', |
|
| 758 | - 'pml' => 'application/vnd.ctc-posml', |
|
| 759 | - 'png' => 'image/png', |
|
| 760 | - 'pnm' => 'image/x-portable-anymap', |
|
| 761 | - 'portpkg' => 'application/vnd.macports.portpkg', |
|
| 762 | - 'pot' => 'application/vnd.ms-powerpoint', |
|
| 763 | - 'potm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', |
|
| 764 | - 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', |
|
| 765 | - 'ppa' => 'application/vnd.ms-powerpoint', |
|
| 766 | - 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', |
|
| 767 | - 'ppd' => 'application/vnd.cups-ppd', |
|
| 768 | - 'ppm' => 'image/x-portable-pixmap', |
|
| 769 | - 'pps' => 'application/vnd.ms-powerpoint', |
|
| 770 | - 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', |
|
| 771 | - 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', |
|
| 772 | - 'ppt' => 'application/powerpoint', |
|
| 773 | - 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', |
|
| 774 | - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', |
|
| 775 | - 'pqa' => 'application/vnd.palm', |
|
| 776 | - 'prc' => 'model/prc', |
|
| 777 | - 'pre' => 'application/vnd.lotus-freelance', |
|
| 778 | - 'prf' => 'application/pics-rules', |
|
| 779 | - 'provx' => 'application/provenance+xml', |
|
| 780 | - 'ps' => 'application/postscript', |
|
| 781 | - 'psb' => 'application/vnd.3gpp.pic-bw-small', |
|
| 782 | - 'psd' => 'application/x-photoshop', |
|
| 783 | - 'psf' => 'application/x-font-linux-psf', |
|
| 784 | - 'pskcxml' => 'application/pskc+xml', |
|
| 785 | - 'pti' => 'image/prs.pti', |
|
| 786 | - 'ptid' => 'application/vnd.pvi.ptid1', |
|
| 787 | - 'pub' => 'application/x-mspublisher', |
|
| 788 | - 'pvb' => 'application/vnd.3gpp.pic-bw-var', |
|
| 789 | - 'pwn' => 'application/vnd.3m.post-it-notes', |
|
| 790 | - 'pya' => 'audio/vnd.ms-playready.media.pya', |
|
| 791 | - 'pyo' => 'model/vnd.pytha.pyox', |
|
| 792 | - 'pyox' => 'model/vnd.pytha.pyox', |
|
| 793 | - 'pyv' => 'video/vnd.ms-playready.media.pyv', |
|
| 794 | - 'qam' => 'application/vnd.epson.quickanime', |
|
| 795 | - 'qbo' => 'application/vnd.intu.qbo', |
|
| 796 | - 'qfx' => 'application/vnd.intu.qfx', |
|
| 797 | - 'qps' => 'application/vnd.publishare-delta-tree', |
|
| 798 | - 'qt' => 'video/quicktime', |
|
| 799 | - 'qwd' => 'application/vnd.quark.quarkxpress', |
|
| 800 | - 'qwt' => 'application/vnd.quark.quarkxpress', |
|
| 801 | - 'qxb' => 'application/vnd.quark.quarkxpress', |
|
| 802 | - 'qxd' => 'application/vnd.quark.quarkxpress', |
|
| 803 | - 'qxl' => 'application/vnd.quark.quarkxpress', |
|
| 804 | - 'qxt' => 'application/vnd.quark.quarkxpress', |
|
| 805 | - 'ra' => 'audio/x-realaudio', |
|
| 806 | - 'ram' => 'audio/x-pn-realaudio', |
|
| 807 | - 'raml' => 'application/raml+yaml', |
|
| 808 | - 'rapd' => 'application/route-apd+xml', |
|
| 809 | - 'rar' => 'application/x-rar', |
|
| 810 | - 'ras' => 'image/x-cmu-raster', |
|
| 811 | - 'rcprofile' => 'application/vnd.ipunplugged.rcprofile', |
|
| 812 | - 'rdf' => 'application/rdf+xml', |
|
| 813 | - 'rdz' => 'application/vnd.data-vision.rdz', |
|
| 814 | - 'relo' => 'application/p2p-overlay+xml', |
|
| 815 | - 'rep' => 'application/vnd.businessobjects', |
|
| 816 | - 'res' => 'application/x-dtbresource+xml', |
|
| 817 | - 'rgb' => 'image/x-rgb', |
|
| 818 | - 'rif' => 'application/reginfo+xml', |
|
| 819 | - 'rip' => 'audio/vnd.rip', |
|
| 820 | - 'ris' => 'application/x-research-info-systems', |
|
| 821 | - 'rl' => 'application/resource-lists+xml', |
|
| 822 | - 'rlc' => 'image/vnd.fujixerox.edmics-rlc', |
|
| 823 | - 'rld' => 'application/resource-lists-diff+xml', |
|
| 824 | - 'rm' => 'audio/x-pn-realaudio', |
|
| 825 | - 'rmi' => 'audio/midi', |
|
| 826 | - 'rmp' => 'audio/x-pn-realaudio-plugin', |
|
| 827 | - 'rms' => 'application/vnd.jcp.javame.midlet-rms', |
|
| 828 | - 'rmvb' => 'application/vnd.rn-realmedia-vbr', |
|
| 829 | - 'rnc' => 'application/relax-ng-compact-syntax', |
|
| 830 | - 'rng' => 'application/xml', |
|
| 831 | - 'roa' => 'application/rpki-roa', |
|
| 832 | - 'roff' => 'text/troff', |
|
| 833 | - 'rp9' => 'application/vnd.cloanto.rp9', |
|
| 834 | - 'rpm' => 'audio/x-pn-realaudio-plugin', |
|
| 835 | - 'rpss' => 'application/vnd.nokia.radio-presets', |
|
| 836 | - 'rpst' => 'application/vnd.nokia.radio-preset', |
|
| 837 | - 'rq' => 'application/sparql-query', |
|
| 838 | - 'rs' => 'application/rls-services+xml', |
|
| 839 | - 'rsa' => 'application/x-pkcs7', |
|
| 840 | - 'rsat' => 'application/atsc-rsat+xml', |
|
| 841 | - 'rsd' => 'application/rsd+xml', |
|
| 842 | - 'rsheet' => 'application/urc-ressheet+xml', |
|
| 843 | - 'rss' => 'application/rss+xml', |
|
| 844 | - 'rtf' => 'text/rtf', |
|
| 845 | - 'rtx' => 'text/richtext', |
|
| 846 | - 'run' => 'application/x-makeself', |
|
| 847 | - 'rusd' => 'application/route-usd+xml', |
|
| 848 | - 'rv' => 'video/vnd.rn-realvideo', |
|
| 849 | - 's' => 'text/x-asm', |
|
| 850 | - 's3m' => 'audio/s3m', |
|
| 851 | - 'saf' => 'application/vnd.yamaha.smaf-audio', |
|
| 852 | - 'sass' => 'text/x-sass', |
|
| 853 | - 'sbml' => 'application/sbml+xml', |
|
| 854 | - 'sc' => 'application/vnd.ibm.secure-container', |
|
| 855 | - 'scd' => 'application/x-msschedule', |
|
| 856 | - 'scm' => 'application/vnd.lotus-screencam', |
|
| 857 | - 'scq' => 'application/scvp-cv-request', |
|
| 858 | - 'scs' => 'application/scvp-cv-response', |
|
| 859 | - 'scss' => 'text/x-scss', |
|
| 860 | - 'scurl' => 'text/vnd.curl.scurl', |
|
| 861 | - 'sda' => 'application/vnd.stardivision.draw', |
|
| 862 | - 'sdc' => 'application/vnd.stardivision.calc', |
|
| 863 | - 'sdd' => 'application/vnd.stardivision.impress', |
|
| 864 | - 'sdkd' => 'application/vnd.solent.sdkm+xml', |
|
| 865 | - 'sdkm' => 'application/vnd.solent.sdkm+xml', |
|
| 866 | - 'sdp' => 'application/sdp', |
|
| 867 | - 'sdw' => 'application/vnd.stardivision.writer', |
|
| 868 | - 'sea' => 'application/octet-stream', |
|
| 869 | - 'see' => 'application/vnd.seemail', |
|
| 870 | - 'seed' => 'application/vnd.fdsn.seed', |
|
| 871 | - 'sema' => 'application/vnd.sema', |
|
| 872 | - 'semd' => 'application/vnd.semd', |
|
| 873 | - 'semf' => 'application/vnd.semf', |
|
| 874 | - 'senmlx' => 'application/senml+xml', |
|
| 875 | - 'sensmlx' => 'application/sensml+xml', |
|
| 876 | - 'ser' => 'application/java-serialized-object', |
|
| 877 | - 'setpay' => 'application/set-payment-initiation', |
|
| 878 | - 'setreg' => 'application/set-registration-initiation', |
|
| 879 | - 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data', |
|
| 880 | - 'sfs' => 'application/vnd.spotfire.sfs', |
|
| 881 | - 'sfv' => 'text/x-sfv', |
|
| 882 | - 'sgi' => 'image/sgi', |
|
| 883 | - 'sgl' => 'application/vnd.stardivision.writer-global', |
|
| 884 | - 'sgm' => 'text/sgml', |
|
| 885 | - 'sgml' => 'text/sgml', |
|
| 886 | - 'sh' => 'application/x-sh', |
|
| 887 | - 'shar' => 'application/x-shar', |
|
| 888 | - 'shex' => 'text/shex', |
|
| 889 | - 'shf' => 'application/shf+xml', |
|
| 890 | - 'shtml' => 'text/html', |
|
| 891 | - 'sid' => 'image/x-mrsid-image', |
|
| 892 | - 'sieve' => 'application/sieve', |
|
| 893 | - 'sig' => 'application/pgp-signature', |
|
| 894 | - 'sil' => 'audio/silk', |
|
| 895 | - 'silo' => 'model/mesh', |
|
| 896 | - 'sis' => 'application/vnd.symbian.install', |
|
| 897 | - 'sisx' => 'application/vnd.symbian.install', |
|
| 898 | - 'sit' => 'application/x-stuffit', |
|
| 899 | - 'sitx' => 'application/x-stuffitx', |
|
| 900 | - 'siv' => 'application/sieve', |
|
| 901 | - 'skd' => 'application/vnd.koan', |
|
| 902 | - 'skm' => 'application/vnd.koan', |
|
| 903 | - 'skp' => 'application/vnd.koan', |
|
| 904 | - 'skt' => 'application/vnd.koan', |
|
| 905 | - 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12', |
|
| 906 | - 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', |
|
| 907 | - 'slim' => 'text/slim', |
|
| 908 | - 'slm' => 'text/slim', |
|
| 909 | - 'sls' => 'application/route-s-tsid+xml', |
|
| 910 | - 'slt' => 'application/vnd.epson.salt', |
|
| 911 | - 'sm' => 'application/vnd.stepmania.stepchart', |
|
| 912 | - 'smf' => 'application/vnd.stardivision.math', |
|
| 913 | - 'smi' => 'application/smil', |
|
| 914 | - 'smil' => 'application/smil', |
|
| 915 | - 'smv' => 'video/x-smv', |
|
| 916 | - 'smzip' => 'application/vnd.stepmania.package', |
|
| 917 | - 'snd' => 'audio/basic', |
|
| 918 | - 'snf' => 'application/x-font-snf', |
|
| 919 | - 'so' => 'application/octet-stream', |
|
| 920 | - 'spc' => 'application/x-pkcs7-certificates', |
|
| 921 | - 'spdx' => 'text/spdx', |
|
| 922 | - 'spf' => 'application/vnd.yamaha.smaf-phrase', |
|
| 923 | - 'spl' => 'application/x-futuresplash', |
|
| 924 | - 'spot' => 'text/vnd.in3d.spot', |
|
| 925 | - 'spp' => 'application/scvp-vp-response', |
|
| 926 | - 'spq' => 'application/scvp-vp-request', |
|
| 927 | - 'spx' => 'audio/ogg', |
|
| 928 | - 'sql' => 'application/x-sql', |
|
| 929 | - 'src' => 'application/x-wais-source', |
|
| 930 | - 'srt' => 'application/x-subrip', |
|
| 931 | - 'sru' => 'application/sru+xml', |
|
| 932 | - 'srx' => 'application/sparql-results+xml', |
|
| 933 | - 'ssdl' => 'application/ssdl+xml', |
|
| 934 | - 'sse' => 'application/vnd.kodak-descriptor', |
|
| 935 | - 'ssf' => 'application/vnd.epson.ssf', |
|
| 936 | - 'ssml' => 'application/ssml+xml', |
|
| 937 | - 'sst' => 'application/octet-stream', |
|
| 938 | - 'st' => 'application/vnd.sailingtracker.track', |
|
| 939 | - 'stc' => 'application/vnd.sun.xml.calc.template', |
|
| 940 | - 'std' => 'application/vnd.sun.xml.draw.template', |
|
| 941 | - 'step' => 'application/STEP', |
|
| 942 | - 'stf' => 'application/vnd.wt.stf', |
|
| 943 | - 'sti' => 'application/vnd.sun.xml.impress.template', |
|
| 944 | - 'stk' => 'application/hyperstudio', |
|
| 945 | - 'stl' => 'model/stl', |
|
| 946 | - 'stp' => 'application/STEP', |
|
| 947 | - 'stpx' => 'model/step+xml', |
|
| 948 | - 'stpxz' => 'model/step-xml+zip', |
|
| 949 | - 'stpz' => 'model/step+zip', |
|
| 950 | - 'str' => 'application/vnd.pg.format', |
|
| 951 | - 'stw' => 'application/vnd.sun.xml.writer.template', |
|
| 952 | - 'styl' => 'text/stylus', |
|
| 953 | - 'stylus' => 'text/stylus', |
|
| 954 | - 'sub' => 'text/vnd.dvb.subtitle', |
|
| 955 | - 'sus' => 'application/vnd.sus-calendar', |
|
| 956 | - 'susp' => 'application/vnd.sus-calendar', |
|
| 957 | - 'sv4cpio' => 'application/x-sv4cpio', |
|
| 958 | - 'sv4crc' => 'application/x-sv4crc', |
|
| 959 | - 'svc' => 'application/vnd.dvb.service', |
|
| 960 | - 'svd' => 'application/vnd.svd', |
|
| 961 | - 'svg' => 'image/svg+xml', |
|
| 962 | - 'svgz' => 'image/svg+xml', |
|
| 963 | - 'swa' => 'application/x-director', |
|
| 964 | - 'swf' => 'application/x-shockwave-flash', |
|
| 965 | - 'swi' => 'application/vnd.aristanetworks.swi', |
|
| 966 | - 'swidtag' => 'application/swid+xml', |
|
| 967 | - 'sxc' => 'application/vnd.sun.xml.calc', |
|
| 968 | - 'sxd' => 'application/vnd.sun.xml.draw', |
|
| 969 | - 'sxg' => 'application/vnd.sun.xml.writer.global', |
|
| 970 | - 'sxi' => 'application/vnd.sun.xml.impress', |
|
| 971 | - 'sxm' => 'application/vnd.sun.xml.math', |
|
| 972 | - 'sxw' => 'application/vnd.sun.xml.writer', |
|
| 973 | - 't' => 'text/troff', |
|
| 974 | - 't3' => 'application/x-t3vm-image', |
|
| 975 | - 't38' => 'image/t38', |
|
| 976 | - 'taglet' => 'application/vnd.mynfc', |
|
| 977 | - 'tao' => 'application/vnd.tao.intent-module-archive', |
|
| 978 | - 'tap' => 'image/vnd.tencent.tap', |
|
| 979 | - 'tar' => 'application/x-tar', |
|
| 980 | - 'tcap' => 'application/vnd.3gpp2.tcap', |
|
| 981 | - 'tcl' => 'application/x-tcl', |
|
| 982 | - 'td' => 'application/urc-targetdesc+xml', |
|
| 983 | - 'teacher' => 'application/vnd.smart.teacher', |
|
| 984 | - 'tei' => 'application/tei+xml', |
|
| 985 | - 'teicorpus' => 'application/tei+xml', |
|
| 986 | - 'tex' => 'application/x-tex', |
|
| 987 | - 'texi' => 'application/x-texinfo', |
|
| 988 | - 'texinfo' => 'application/x-texinfo', |
|
| 989 | - 'text' => 'text/plain', |
|
| 990 | - 'tfi' => 'application/thraud+xml', |
|
| 991 | - 'tfm' => 'application/x-tex-tfm', |
|
| 992 | - 'tfx' => 'image/tiff-fx', |
|
| 993 | - 'tga' => 'image/x-tga', |
|
| 994 | - 'tgz' => 'application/x-tar', |
|
| 995 | - 'thmx' => 'application/vnd.ms-officetheme', |
|
| 996 | - 'tif' => 'image/tiff', |
|
| 997 | - 'tiff' => 'image/tiff', |
|
| 998 | - 'tk' => 'application/x-tcl', |
|
| 999 | - 'tmo' => 'application/vnd.tmobile-livetv', |
|
| 1000 | - 'toml' => 'application/toml', |
|
| 1001 | - 'torrent' => 'application/x-bittorrent', |
|
| 1002 | - 'tpl' => 'application/vnd.groove-tool-template', |
|
| 1003 | - 'tpt' => 'application/vnd.trid.tpt', |
|
| 1004 | - 'tr' => 'text/troff', |
|
| 1005 | - 'tra' => 'application/vnd.trueapp', |
|
| 1006 | - 'trig' => 'application/trig', |
|
| 1007 | - 'trm' => 'application/x-msterminal', |
|
| 1008 | - 'ts' => 'video/mp2t', |
|
| 1009 | - 'tsd' => 'application/timestamped-data', |
|
| 1010 | - 'tsv' => 'text/tab-separated-values', |
|
| 1011 | - 'ttc' => 'font/collection', |
|
| 1012 | - 'ttf' => 'font/ttf', |
|
| 1013 | - 'ttl' => 'text/turtle', |
|
| 1014 | - 'ttml' => 'application/ttml+xml', |
|
| 1015 | - 'twd' => 'application/vnd.simtech-mindmapper', |
|
| 1016 | - 'twds' => 'application/vnd.simtech-mindmapper', |
|
| 1017 | - 'txd' => 'application/vnd.genomatix.tuxedo', |
|
| 1018 | - 'txf' => 'application/vnd.mobius.txf', |
|
| 1019 | - 'txt' => 'text/plain', |
|
| 1020 | - 'u3d' => 'model/u3d', |
|
| 1021 | - 'u8dsn' => 'message/global-delivery-status', |
|
| 1022 | - 'u8hdr' => 'message/global-headers', |
|
| 1023 | - 'u8mdn' => 'message/global-disposition-notification', |
|
| 1024 | - 'u8msg' => 'message/global', |
|
| 1025 | - 'u32' => 'application/x-authorware-bin', |
|
| 1026 | - 'ubj' => 'application/ubjson', |
|
| 1027 | - 'udeb' => 'application/x-debian-package', |
|
| 1028 | - 'ufd' => 'application/vnd.ufdl', |
|
| 1029 | - 'ufdl' => 'application/vnd.ufdl', |
|
| 1030 | - 'ulx' => 'application/x-glulx', |
|
| 1031 | - 'umj' => 'application/vnd.umajin', |
|
| 1032 | - 'unityweb' => 'application/vnd.unity', |
|
| 1033 | - 'uo' => 'application/vnd.uoml+xml', |
|
| 1034 | - 'uoml' => 'application/vnd.uoml+xml', |
|
| 1035 | - 'uri' => 'text/uri-list', |
|
| 1036 | - 'uris' => 'text/uri-list', |
|
| 1037 | - 'urls' => 'text/uri-list', |
|
| 1038 | - 'usda' => 'model/vnd.usda', |
|
| 1039 | - 'usdz' => 'model/vnd.usdz+zip', |
|
| 1040 | - 'ustar' => 'application/x-ustar', |
|
| 1041 | - 'utz' => 'application/vnd.uiq.theme', |
|
| 1042 | - 'uu' => 'text/x-uuencode', |
|
| 1043 | - 'uva' => 'audio/vnd.dece.audio', |
|
| 1044 | - 'uvd' => 'application/vnd.dece.data', |
|
| 1045 | - 'uvf' => 'application/vnd.dece.data', |
|
| 1046 | - 'uvg' => 'image/vnd.dece.graphic', |
|
| 1047 | - 'uvh' => 'video/vnd.dece.hd', |
|
| 1048 | - 'uvi' => 'image/vnd.dece.graphic', |
|
| 1049 | - 'uvm' => 'video/vnd.dece.mobile', |
|
| 1050 | - 'uvp' => 'video/vnd.dece.pd', |
|
| 1051 | - 'uvs' => 'video/vnd.dece.sd', |
|
| 1052 | - 'uvt' => 'application/vnd.dece.ttml+xml', |
|
| 1053 | - 'uvu' => 'video/vnd.uvvu.mp4', |
|
| 1054 | - 'uvv' => 'video/vnd.dece.video', |
|
| 1055 | - 'uvva' => 'audio/vnd.dece.audio', |
|
| 1056 | - 'uvvd' => 'application/vnd.dece.data', |
|
| 1057 | - 'uvvf' => 'application/vnd.dece.data', |
|
| 1058 | - 'uvvg' => 'image/vnd.dece.graphic', |
|
| 1059 | - 'uvvh' => 'video/vnd.dece.hd', |
|
| 1060 | - 'uvvi' => 'image/vnd.dece.graphic', |
|
| 1061 | - 'uvvm' => 'video/vnd.dece.mobile', |
|
| 1062 | - 'uvvp' => 'video/vnd.dece.pd', |
|
| 1063 | - 'uvvs' => 'video/vnd.dece.sd', |
|
| 1064 | - 'uvvt' => 'application/vnd.dece.ttml+xml', |
|
| 1065 | - 'uvvu' => 'video/vnd.uvvu.mp4', |
|
| 1066 | - 'uvvv' => 'video/vnd.dece.video', |
|
| 1067 | - 'uvvx' => 'application/vnd.dece.unspecified', |
|
| 1068 | - 'uvvz' => 'application/vnd.dece.zip', |
|
| 1069 | - 'uvx' => 'application/vnd.dece.unspecified', |
|
| 1070 | - 'uvz' => 'application/vnd.dece.zip', |
|
| 1071 | - 'vbox' => 'application/x-virtualbox-vbox', |
|
| 1072 | - 'vbox-extpack' => 'application/x-virtualbox-vbox-extpack', |
|
| 1073 | - 'vcard' => 'text/vcard', |
|
| 1074 | - 'vcd' => 'application/x-cdlink', |
|
| 1075 | - 'vcf' => 'text/x-vcard', |
|
| 1076 | - 'vcg' => 'application/vnd.groove-vcard', |
|
| 1077 | - 'vcs' => 'text/x-vcalendar', |
|
| 1078 | - 'vcx' => 'application/vnd.vcx', |
|
| 1079 | - 'vdi' => 'application/x-virtualbox-vdi', |
|
| 1080 | - 'vds' => 'model/vnd.sap.vds', |
|
| 1081 | - 'vhd' => 'application/x-virtualbox-vhd', |
|
| 1082 | - 'vis' => 'application/vnd.visionary', |
|
| 1083 | - 'viv' => 'video/vnd.vivo', |
|
| 1084 | - 'vlc' => 'application/videolan', |
|
| 1085 | - 'vmdk' => 'application/x-virtualbox-vmdk', |
|
| 1086 | - 'vob' => 'video/x-ms-vob', |
|
| 1087 | - 'vor' => 'application/vnd.stardivision.writer', |
|
| 1088 | - 'vox' => 'application/x-authorware-bin', |
|
| 1089 | - 'vrml' => 'model/vrml', |
|
| 1090 | - 'vsd' => 'application/vnd.visio', |
|
| 1091 | - 'vsf' => 'application/vnd.vsf', |
|
| 1092 | - 'vss' => 'application/vnd.visio', |
|
| 1093 | - 'vst' => 'application/vnd.visio', |
|
| 1094 | - 'vsw' => 'application/vnd.visio', |
|
| 1095 | - 'vtf' => 'image/vnd.valve.source.texture', |
|
| 1096 | - 'vtt' => 'text/vtt', |
|
| 1097 | - 'vtu' => 'model/vnd.vtu', |
|
| 1098 | - 'vxml' => 'application/voicexml+xml', |
|
| 1099 | - 'w3d' => 'application/x-director', |
|
| 1100 | - 'wad' => 'application/x-doom', |
|
| 1101 | - 'wadl' => 'application/vnd.sun.wadl+xml', |
|
| 1102 | - 'war' => 'application/java-archive', |
|
| 1103 | - 'wasm' => 'application/wasm', |
|
| 1104 | - 'wav' => 'audio/x-wav', |
|
| 1105 | - 'wax' => 'audio/x-ms-wax', |
|
| 1106 | - 'wbmp' => 'image/vnd.wap.wbmp', |
|
| 1107 | - 'wbs' => 'application/vnd.criticaltools.wbs+xml', |
|
| 1108 | - 'wbxml' => 'application/wbxml', |
|
| 1109 | - 'wcm' => 'application/vnd.ms-works', |
|
| 1110 | - 'wdb' => 'application/vnd.ms-works', |
|
| 1111 | - 'wdp' => 'image/vnd.ms-photo', |
|
| 1112 | - 'weba' => 'audio/webm', |
|
| 1113 | - 'webapp' => 'application/x-web-app-manifest+json', |
|
| 1114 | - 'webm' => 'video/webm', |
|
| 1115 | - 'webmanifest' => 'application/manifest+json', |
|
| 1116 | - 'webp' => 'image/webp', |
|
| 1117 | - 'wg' => 'application/vnd.pmi.widget', |
|
| 1118 | - 'wgsl' => 'text/wgsl', |
|
| 1119 | - 'wgt' => 'application/widget', |
|
| 1120 | - 'wif' => 'application/watcherinfo+xml', |
|
| 1121 | - 'wks' => 'application/vnd.ms-works', |
|
| 1122 | - 'wm' => 'video/x-ms-wm', |
|
| 1123 | - 'wma' => 'audio/x-ms-wma', |
|
| 1124 | - 'wmd' => 'application/x-ms-wmd', |
|
| 1125 | - 'wmf' => 'image/wmf', |
|
| 1126 | - 'wml' => 'text/vnd.wap.wml', |
|
| 1127 | - 'wmlc' => 'application/wmlc', |
|
| 1128 | - 'wmls' => 'text/vnd.wap.wmlscript', |
|
| 1129 | - 'wmlsc' => 'application/vnd.wap.wmlscriptc', |
|
| 1130 | - 'wmv' => 'video/x-ms-wmv', |
|
| 1131 | - 'wmx' => 'video/x-ms-wmx', |
|
| 1132 | - 'wmz' => 'application/x-msmetafile', |
|
| 1133 | - 'woff' => 'font/woff', |
|
| 1134 | - 'woff2' => 'font/woff2', |
|
| 1135 | - 'word' => 'application/msword', |
|
| 1136 | - 'wpd' => 'application/vnd.wordperfect', |
|
| 1137 | - 'wpl' => 'application/vnd.ms-wpl', |
|
| 1138 | - 'wps' => 'application/vnd.ms-works', |
|
| 1139 | - 'wqd' => 'application/vnd.wqd', |
|
| 1140 | - 'wri' => 'application/x-mswrite', |
|
| 1141 | - 'wrl' => 'model/vrml', |
|
| 1142 | - 'wsc' => 'message/vnd.wfa.wsc', |
|
| 1143 | - 'wsdl' => 'application/wsdl+xml', |
|
| 1144 | - 'wspolicy' => 'application/wspolicy+xml', |
|
| 1145 | - 'wtb' => 'application/vnd.webturbo', |
|
| 1146 | - 'wvx' => 'video/x-ms-wvx', |
|
| 1147 | - 'x3d' => 'model/x3d+xml', |
|
| 1148 | - 'x3db' => 'model/x3d+fastinfoset', |
|
| 1149 | - 'x3dbz' => 'model/x3d+binary', |
|
| 1150 | - 'x3dv' => 'model/x3d-vrml', |
|
| 1151 | - 'x3dvz' => 'model/x3d+vrml', |
|
| 1152 | - 'x3dz' => 'model/x3d+xml', |
|
| 1153 | - 'x32' => 'application/x-authorware-bin', |
|
| 1154 | - 'x_b' => 'model/vnd.parasolid.transmit.binary', |
|
| 1155 | - 'x_t' => 'model/vnd.parasolid.transmit.text', |
|
| 1156 | - 'xaml' => 'application/xaml+xml', |
|
| 1157 | - 'xap' => 'application/x-silverlight-app', |
|
| 1158 | - 'xar' => 'application/vnd.xara', |
|
| 1159 | - 'xav' => 'application/xcap-att+xml', |
|
| 1160 | - 'xbap' => 'application/x-ms-xbap', |
|
| 1161 | - 'xbd' => 'application/vnd.fujixerox.docuworks.binder', |
|
| 1162 | - 'xbm' => 'image/x-xbitmap', |
|
| 1163 | - 'xca' => 'application/xcap-caps+xml', |
|
| 1164 | - 'xcs' => 'application/calendar+xml', |
|
| 1165 | - 'xdf' => 'application/xcap-diff+xml', |
|
| 1166 | - 'xdm' => 'application/vnd.syncml.dm+xml', |
|
| 1167 | - 'xdp' => 'application/vnd.adobe.xdp+xml', |
|
| 1168 | - 'xdssc' => 'application/dssc+xml', |
|
| 1169 | - 'xdw' => 'application/vnd.fujixerox.docuworks', |
|
| 1170 | - 'xel' => 'application/xcap-el+xml', |
|
| 1171 | - 'xenc' => 'application/xenc+xml', |
|
| 1172 | - 'xer' => 'application/patch-ops-error+xml', |
|
| 1173 | - 'xfdf' => 'application/xfdf', |
|
| 1174 | - 'xfdl' => 'application/vnd.xfdl', |
|
| 1175 | - 'xht' => 'application/xhtml+xml', |
|
| 1176 | - 'xhtm' => 'application/vnd.pwg-xhtml-print+xml', |
|
| 1177 | - 'xhtml' => 'application/xhtml+xml', |
|
| 1178 | - 'xhvml' => 'application/xv+xml', |
|
| 1179 | - 'xif' => 'image/vnd.xiff', |
|
| 1180 | - 'xl' => 'application/excel', |
|
| 1181 | - 'xla' => 'application/vnd.ms-excel', |
|
| 1182 | - 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', |
|
| 1183 | - 'xlc' => 'application/vnd.ms-excel', |
|
| 1184 | - 'xlf' => 'application/xliff+xml', |
|
| 1185 | - 'xlm' => 'application/vnd.ms-excel', |
|
| 1186 | - 'xls' => 'application/vnd.ms-excel', |
|
| 1187 | - 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', |
|
| 1188 | - 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', |
|
| 1189 | - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', |
|
| 1190 | - 'xlt' => 'application/vnd.ms-excel', |
|
| 1191 | - 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', |
|
| 1192 | - 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', |
|
| 1193 | - 'xlw' => 'application/vnd.ms-excel', |
|
| 1194 | - 'xm' => 'audio/xm', |
|
| 1195 | - 'xml' => 'application/xml', |
|
| 1196 | - 'xns' => 'application/xcap-ns+xml', |
|
| 1197 | - 'xo' => 'application/vnd.olpc-sugar', |
|
| 1198 | - 'xop' => 'application/xop+xml', |
|
| 1199 | - 'xpi' => 'application/x-xpinstall', |
|
| 1200 | - 'xpl' => 'application/xproc+xml', |
|
| 1201 | - 'xpm' => 'image/x-xpixmap', |
|
| 1202 | - 'xpr' => 'application/vnd.is-xpr', |
|
| 1203 | - 'xps' => 'application/vnd.ms-xpsdocument', |
|
| 1204 | - 'xpw' => 'application/vnd.intercon.formnet', |
|
| 1205 | - 'xpx' => 'application/vnd.intercon.formnet', |
|
| 1206 | - 'xsd' => 'application/xml', |
|
| 1207 | - 'xsf' => 'application/prs.xsf+xml', |
|
| 1208 | - 'xsl' => 'application/xml', |
|
| 1209 | - 'xslt' => 'application/xslt+xml', |
|
| 1210 | - 'xsm' => 'application/vnd.syncml+xml', |
|
| 1211 | - 'xspf' => 'application/xspf+xml', |
|
| 1212 | - 'xul' => 'application/vnd.mozilla.xul+xml', |
|
| 1213 | - 'xvm' => 'application/xv+xml', |
|
| 1214 | - 'xvml' => 'application/xv+xml', |
|
| 1215 | - 'xwd' => 'image/x-xwindowdump', |
|
| 1216 | - 'xyz' => 'chemical/x-xyz', |
|
| 1217 | - 'xz' => 'application/x-xz', |
|
| 1218 | - 'yaml' => 'text/yaml', |
|
| 1219 | - 'yang' => 'application/yang', |
|
| 1220 | - 'yin' => 'application/yin+xml', |
|
| 1221 | - 'yml' => 'text/yaml', |
|
| 1222 | - 'ymp' => 'text/x-suse-ymp', |
|
| 1223 | - 'z' => 'application/x-compress', |
|
| 1224 | - 'z1' => 'application/x-zmachine', |
|
| 1225 | - 'z2' => 'application/x-zmachine', |
|
| 1226 | - 'z3' => 'application/x-zmachine', |
|
| 1227 | - 'z4' => 'application/x-zmachine', |
|
| 1228 | - 'z5' => 'application/x-zmachine', |
|
| 1229 | - 'z6' => 'application/x-zmachine', |
|
| 1230 | - 'z7' => 'application/x-zmachine', |
|
| 1231 | - 'z8' => 'application/x-zmachine', |
|
| 1232 | - 'zaz' => 'application/vnd.zzazz.deck+xml', |
|
| 1233 | - 'zip' => 'application/zip', |
|
| 1234 | - 'zir' => 'application/vnd.zul', |
|
| 1235 | - 'zirz' => 'application/vnd.zul', |
|
| 1236 | - 'zmm' => 'application/vnd.handheld-entertainment+xml', |
|
| 1237 | - 'zsh' => 'text/x-scriptzsh', |
|
| 1238 | - ]; |
|
| 9 | + private const MIME_TYPES = [ |
|
| 10 | + '1km' => 'application/vnd.1000minds.decision-model+xml', |
|
| 11 | + '3dml' => 'text/vnd.in3d.3dml', |
|
| 12 | + '3ds' => 'image/x-3ds', |
|
| 13 | + '3g2' => 'video/3gpp2', |
|
| 14 | + '3gp' => 'video/3gp', |
|
| 15 | + '3gpp' => 'video/3gpp', |
|
| 16 | + '3mf' => 'model/3mf', |
|
| 17 | + '7z' => 'application/x-7z-compressed', |
|
| 18 | + '7zip' => 'application/x-7z-compressed', |
|
| 19 | + '123' => 'application/vnd.lotus-1-2-3', |
|
| 20 | + 'aab' => 'application/x-authorware-bin', |
|
| 21 | + 'aac' => 'audio/aac', |
|
| 22 | + 'aam' => 'application/x-authorware-map', |
|
| 23 | + 'aas' => 'application/x-authorware-seg', |
|
| 24 | + 'abw' => 'application/x-abiword', |
|
| 25 | + 'ac' => 'application/vnd.nokia.n-gage.ac+xml', |
|
| 26 | + 'ac3' => 'audio/ac3', |
|
| 27 | + 'acc' => 'application/vnd.americandynamics.acc', |
|
| 28 | + 'ace' => 'application/x-ace-compressed', |
|
| 29 | + 'acu' => 'application/vnd.acucobol', |
|
| 30 | + 'acutc' => 'application/vnd.acucorp', |
|
| 31 | + 'adp' => 'audio/adpcm', |
|
| 32 | + 'adts' => 'audio/aac', |
|
| 33 | + 'aep' => 'application/vnd.audiograph', |
|
| 34 | + 'afm' => 'application/x-font-type1', |
|
| 35 | + 'afp' => 'application/vnd.ibm.modcap', |
|
| 36 | + 'age' => 'application/vnd.age', |
|
| 37 | + 'ahead' => 'application/vnd.ahead.space', |
|
| 38 | + 'ai' => 'application/pdf', |
|
| 39 | + 'aif' => 'audio/x-aiff', |
|
| 40 | + 'aifc' => 'audio/x-aiff', |
|
| 41 | + 'aiff' => 'audio/x-aiff', |
|
| 42 | + 'air' => 'application/vnd.adobe.air-application-installer-package+zip', |
|
| 43 | + 'ait' => 'application/vnd.dvb.ait', |
|
| 44 | + 'ami' => 'application/vnd.amiga.ami', |
|
| 45 | + 'aml' => 'application/automationml-aml+xml', |
|
| 46 | + 'amlx' => 'application/automationml-amlx+zip', |
|
| 47 | + 'amr' => 'audio/amr', |
|
| 48 | + 'apk' => 'application/vnd.android.package-archive', |
|
| 49 | + 'apng' => 'image/apng', |
|
| 50 | + 'appcache' => 'text/cache-manifest', |
|
| 51 | + 'appinstaller' => 'application/appinstaller', |
|
| 52 | + 'application' => 'application/x-ms-application', |
|
| 53 | + 'appx' => 'application/appx', |
|
| 54 | + 'appxbundle' => 'application/appxbundle', |
|
| 55 | + 'apr' => 'application/vnd.lotus-approach', |
|
| 56 | + 'arc' => 'application/x-freearc', |
|
| 57 | + 'arj' => 'application/x-arj', |
|
| 58 | + 'asc' => 'application/pgp-signature', |
|
| 59 | + 'asf' => 'video/x-ms-asf', |
|
| 60 | + 'asm' => 'text/x-asm', |
|
| 61 | + 'aso' => 'application/vnd.accpac.simply.aso', |
|
| 62 | + 'asx' => 'video/x-ms-asf', |
|
| 63 | + 'atc' => 'application/vnd.acucorp', |
|
| 64 | + 'atom' => 'application/atom+xml', |
|
| 65 | + 'atomcat' => 'application/atomcat+xml', |
|
| 66 | + 'atomdeleted' => 'application/atomdeleted+xml', |
|
| 67 | + 'atomsvc' => 'application/atomsvc+xml', |
|
| 68 | + 'atx' => 'application/vnd.antix.game-component', |
|
| 69 | + 'au' => 'audio/x-au', |
|
| 70 | + 'avci' => 'image/avci', |
|
| 71 | + 'avcs' => 'image/avcs', |
|
| 72 | + 'avi' => 'video/x-msvideo', |
|
| 73 | + 'avif' => 'image/avif', |
|
| 74 | + 'aw' => 'application/applixware', |
|
| 75 | + 'azf' => 'application/vnd.airzip.filesecure.azf', |
|
| 76 | + 'azs' => 'application/vnd.airzip.filesecure.azs', |
|
| 77 | + 'azv' => 'image/vnd.airzip.accelerator.azv', |
|
| 78 | + 'azw' => 'application/vnd.amazon.ebook', |
|
| 79 | + 'b16' => 'image/vnd.pco.b16', |
|
| 80 | + 'bat' => 'application/x-msdownload', |
|
| 81 | + 'bcpio' => 'application/x-bcpio', |
|
| 82 | + 'bdf' => 'application/x-font-bdf', |
|
| 83 | + 'bdm' => 'application/vnd.syncml.dm+wbxml', |
|
| 84 | + 'bdoc' => 'application/x-bdoc', |
|
| 85 | + 'bed' => 'application/vnd.realvnc.bed', |
|
| 86 | + 'bh2' => 'application/vnd.fujitsu.oasysprs', |
|
| 87 | + 'bin' => 'application/octet-stream', |
|
| 88 | + 'blb' => 'application/x-blorb', |
|
| 89 | + 'blorb' => 'application/x-blorb', |
|
| 90 | + 'bmi' => 'application/vnd.bmi', |
|
| 91 | + 'bmml' => 'application/vnd.balsamiq.bmml+xml', |
|
| 92 | + 'bmp' => 'image/bmp', |
|
| 93 | + 'book' => 'application/vnd.framemaker', |
|
| 94 | + 'box' => 'application/vnd.previewsystems.box', |
|
| 95 | + 'boz' => 'application/x-bzip2', |
|
| 96 | + 'bpk' => 'application/octet-stream', |
|
| 97 | + 'bpmn' => 'application/octet-stream', |
|
| 98 | + 'bsp' => 'model/vnd.valve.source.compiled-map', |
|
| 99 | + 'btf' => 'image/prs.btif', |
|
| 100 | + 'btif' => 'image/prs.btif', |
|
| 101 | + 'buffer' => 'application/octet-stream', |
|
| 102 | + 'bz' => 'application/x-bzip', |
|
| 103 | + 'bz2' => 'application/x-bzip2', |
|
| 104 | + 'c' => 'text/x-c', |
|
| 105 | + 'c4d' => 'application/vnd.clonk.c4group', |
|
| 106 | + 'c4f' => 'application/vnd.clonk.c4group', |
|
| 107 | + 'c4g' => 'application/vnd.clonk.c4group', |
|
| 108 | + 'c4p' => 'application/vnd.clonk.c4group', |
|
| 109 | + 'c4u' => 'application/vnd.clonk.c4group', |
|
| 110 | + 'c11amc' => 'application/vnd.cluetrust.cartomobile-config', |
|
| 111 | + 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg', |
|
| 112 | + 'cab' => 'application/vnd.ms-cab-compressed', |
|
| 113 | + 'caf' => 'audio/x-caf', |
|
| 114 | + 'cap' => 'application/vnd.tcpdump.pcap', |
|
| 115 | + 'car' => 'application/vnd.curl.car', |
|
| 116 | + 'cat' => 'application/vnd.ms-pki.seccat', |
|
| 117 | + 'cb7' => 'application/x-cbr', |
|
| 118 | + 'cba' => 'application/x-cbr', |
|
| 119 | + 'cbr' => 'application/x-cbr', |
|
| 120 | + 'cbt' => 'application/x-cbr', |
|
| 121 | + 'cbz' => 'application/x-cbr', |
|
| 122 | + 'cc' => 'text/x-c', |
|
| 123 | + 'cco' => 'application/x-cocoa', |
|
| 124 | + 'cct' => 'application/x-director', |
|
| 125 | + 'ccxml' => 'application/ccxml+xml', |
|
| 126 | + 'cdbcmsg' => 'application/vnd.contact.cmsg', |
|
| 127 | + 'cdf' => 'application/x-netcdf', |
|
| 128 | + 'cdfx' => 'application/cdfx+xml', |
|
| 129 | + 'cdkey' => 'application/vnd.mediastation.cdkey', |
|
| 130 | + 'cdmia' => 'application/cdmi-capability', |
|
| 131 | + 'cdmic' => 'application/cdmi-container', |
|
| 132 | + 'cdmid' => 'application/cdmi-domain', |
|
| 133 | + 'cdmio' => 'application/cdmi-object', |
|
| 134 | + 'cdmiq' => 'application/cdmi-queue', |
|
| 135 | + 'cdr' => 'application/cdr', |
|
| 136 | + 'cdx' => 'chemical/x-cdx', |
|
| 137 | + 'cdxml' => 'application/vnd.chemdraw+xml', |
|
| 138 | + 'cdy' => 'application/vnd.cinderella', |
|
| 139 | + 'cer' => 'application/pkix-cert', |
|
| 140 | + 'cfs' => 'application/x-cfs-compressed', |
|
| 141 | + 'cgm' => 'image/cgm', |
|
| 142 | + 'chat' => 'application/x-chat', |
|
| 143 | + 'chm' => 'application/vnd.ms-htmlhelp', |
|
| 144 | + 'chrt' => 'application/vnd.kde.kchart', |
|
| 145 | + 'cif' => 'chemical/x-cif', |
|
| 146 | + 'cii' => 'application/vnd.anser-web-certificate-issue-initiation', |
|
| 147 | + 'cil' => 'application/vnd.ms-artgalry', |
|
| 148 | + 'cjs' => 'application/node', |
|
| 149 | + 'cla' => 'application/vnd.claymore', |
|
| 150 | + 'class' => 'application/octet-stream', |
|
| 151 | + 'cld' => 'model/vnd.cld', |
|
| 152 | + 'clkk' => 'application/vnd.crick.clicker.keyboard', |
|
| 153 | + 'clkp' => 'application/vnd.crick.clicker.palette', |
|
| 154 | + 'clkt' => 'application/vnd.crick.clicker.template', |
|
| 155 | + 'clkw' => 'application/vnd.crick.clicker.wordbank', |
|
| 156 | + 'clkx' => 'application/vnd.crick.clicker', |
|
| 157 | + 'clp' => 'application/x-msclip', |
|
| 158 | + 'cmc' => 'application/vnd.cosmocaller', |
|
| 159 | + 'cmdf' => 'chemical/x-cmdf', |
|
| 160 | + 'cml' => 'chemical/x-cml', |
|
| 161 | + 'cmp' => 'application/vnd.yellowriver-custom-menu', |
|
| 162 | + 'cmx' => 'image/x-cmx', |
|
| 163 | + 'cod' => 'application/vnd.rim.cod', |
|
| 164 | + 'coffee' => 'text/coffeescript', |
|
| 165 | + 'com' => 'application/x-msdownload', |
|
| 166 | + 'conf' => 'text/plain', |
|
| 167 | + 'cpio' => 'application/x-cpio', |
|
| 168 | + 'cpl' => 'application/cpl+xml', |
|
| 169 | + 'cpp' => 'text/x-c', |
|
| 170 | + 'cpt' => 'application/mac-compactpro', |
|
| 171 | + 'crd' => 'application/x-mscardfile', |
|
| 172 | + 'crl' => 'application/pkix-crl', |
|
| 173 | + 'crt' => 'application/x-x509-ca-cert', |
|
| 174 | + 'crx' => 'application/x-chrome-extension', |
|
| 175 | + 'cryptonote' => 'application/vnd.rig.cryptonote', |
|
| 176 | + 'csh' => 'application/x-csh', |
|
| 177 | + 'csl' => 'application/vnd.citationstyles.style+xml', |
|
| 178 | + 'csml' => 'chemical/x-csml', |
|
| 179 | + 'csp' => 'application/vnd.commonspace', |
|
| 180 | + 'csr' => 'application/octet-stream', |
|
| 181 | + 'css' => 'text/css', |
|
| 182 | + 'cst' => 'application/x-director', |
|
| 183 | + 'csv' => 'text/csv', |
|
| 184 | + 'cu' => 'application/cu-seeme', |
|
| 185 | + 'curl' => 'text/vnd.curl', |
|
| 186 | + 'cwl' => 'application/cwl', |
|
| 187 | + 'cww' => 'application/prs.cww', |
|
| 188 | + 'cxt' => 'application/x-director', |
|
| 189 | + 'cxx' => 'text/x-c', |
|
| 190 | + 'dae' => 'model/vnd.collada+xml', |
|
| 191 | + 'daf' => 'application/vnd.mobius.daf', |
|
| 192 | + 'dart' => 'application/vnd.dart', |
|
| 193 | + 'dataless' => 'application/vnd.fdsn.seed', |
|
| 194 | + 'davmount' => 'application/davmount+xml', |
|
| 195 | + 'dbf' => 'application/vnd.dbf', |
|
| 196 | + 'dbk' => 'application/docbook+xml', |
|
| 197 | + 'dcr' => 'application/x-director', |
|
| 198 | + 'dcurl' => 'text/vnd.curl.dcurl', |
|
| 199 | + 'dd2' => 'application/vnd.oma.dd2+xml', |
|
| 200 | + 'ddd' => 'application/vnd.fujixerox.ddd', |
|
| 201 | + 'ddf' => 'application/vnd.syncml.dmddf+xml', |
|
| 202 | + 'dds' => 'image/vnd.ms-dds', |
|
| 203 | + 'deb' => 'application/x-debian-package', |
|
| 204 | + 'def' => 'text/plain', |
|
| 205 | + 'deploy' => 'application/octet-stream', |
|
| 206 | + 'der' => 'application/x-x509-ca-cert', |
|
| 207 | + 'dfac' => 'application/vnd.dreamfactory', |
|
| 208 | + 'dgc' => 'application/x-dgc-compressed', |
|
| 209 | + 'dib' => 'image/bmp', |
|
| 210 | + 'dic' => 'text/x-c', |
|
| 211 | + 'dir' => 'application/x-director', |
|
| 212 | + 'dis' => 'application/vnd.mobius.dis', |
|
| 213 | + 'disposition-notification' => 'message/disposition-notification', |
|
| 214 | + 'dist' => 'application/octet-stream', |
|
| 215 | + 'distz' => 'application/octet-stream', |
|
| 216 | + 'djv' => 'image/vnd.djvu', |
|
| 217 | + 'djvu' => 'image/vnd.djvu', |
|
| 218 | + 'dll' => 'application/octet-stream', |
|
| 219 | + 'dmg' => 'application/x-apple-diskimage', |
|
| 220 | + 'dmn' => 'application/octet-stream', |
|
| 221 | + 'dmp' => 'application/vnd.tcpdump.pcap', |
|
| 222 | + 'dms' => 'application/octet-stream', |
|
| 223 | + 'dna' => 'application/vnd.dna', |
|
| 224 | + 'doc' => 'application/msword', |
|
| 225 | + 'docm' => 'application/vnd.ms-word.template.macroEnabled.12', |
|
| 226 | + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', |
|
| 227 | + 'dot' => 'application/msword', |
|
| 228 | + 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', |
|
| 229 | + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', |
|
| 230 | + 'dp' => 'application/vnd.osgi.dp', |
|
| 231 | + 'dpg' => 'application/vnd.dpgraph', |
|
| 232 | + 'dpx' => 'image/dpx', |
|
| 233 | + 'dra' => 'audio/vnd.dra', |
|
| 234 | + 'drle' => 'image/dicom-rle', |
|
| 235 | + 'dsc' => 'text/prs.lines.tag', |
|
| 236 | + 'dssc' => 'application/dssc+der', |
|
| 237 | + 'dtb' => 'application/x-dtbook+xml', |
|
| 238 | + 'dtd' => 'application/xml-dtd', |
|
| 239 | + 'dts' => 'audio/vnd.dts', |
|
| 240 | + 'dtshd' => 'audio/vnd.dts.hd', |
|
| 241 | + 'dump' => 'application/octet-stream', |
|
| 242 | + 'dvb' => 'video/vnd.dvb.file', |
|
| 243 | + 'dvi' => 'application/x-dvi', |
|
| 244 | + 'dwd' => 'application/atsc-dwd+xml', |
|
| 245 | + 'dwf' => 'model/vnd.dwf', |
|
| 246 | + 'dwg' => 'image/vnd.dwg', |
|
| 247 | + 'dxf' => 'image/vnd.dxf', |
|
| 248 | + 'dxp' => 'application/vnd.spotfire.dxp', |
|
| 249 | + 'dxr' => 'application/x-director', |
|
| 250 | + 'ear' => 'application/java-archive', |
|
| 251 | + 'ecelp4800' => 'audio/vnd.nuera.ecelp4800', |
|
| 252 | + 'ecelp7470' => 'audio/vnd.nuera.ecelp7470', |
|
| 253 | + 'ecelp9600' => 'audio/vnd.nuera.ecelp9600', |
|
| 254 | + 'ecma' => 'application/ecmascript', |
|
| 255 | + 'edm' => 'application/vnd.novadigm.edm', |
|
| 256 | + 'edx' => 'application/vnd.novadigm.edx', |
|
| 257 | + 'efif' => 'application/vnd.picsel', |
|
| 258 | + 'ei6' => 'application/vnd.pg.osasli', |
|
| 259 | + 'elc' => 'application/octet-stream', |
|
| 260 | + 'emf' => 'image/emf', |
|
| 261 | + 'eml' => 'message/rfc822', |
|
| 262 | + 'emma' => 'application/emma+xml', |
|
| 263 | + 'emotionml' => 'application/emotionml+xml', |
|
| 264 | + 'emz' => 'application/x-msmetafile', |
|
| 265 | + 'eol' => 'audio/vnd.digital-winds', |
|
| 266 | + 'eot' => 'application/vnd.ms-fontobject', |
|
| 267 | + 'eps' => 'application/postscript', |
|
| 268 | + 'epub' => 'application/epub+zip', |
|
| 269 | + 'es3' => 'application/vnd.eszigno3+xml', |
|
| 270 | + 'esa' => 'application/vnd.osgi.subsystem', |
|
| 271 | + 'esf' => 'application/vnd.epson.esf', |
|
| 272 | + 'et3' => 'application/vnd.eszigno3+xml', |
|
| 273 | + 'etx' => 'text/x-setext', |
|
| 274 | + 'eva' => 'application/x-eva', |
|
| 275 | + 'evy' => 'application/x-envoy', |
|
| 276 | + 'exe' => 'application/octet-stream', |
|
| 277 | + 'exi' => 'application/exi', |
|
| 278 | + 'exp' => 'application/express', |
|
| 279 | + 'exr' => 'image/aces', |
|
| 280 | + 'ext' => 'application/vnd.novadigm.ext', |
|
| 281 | + 'ez' => 'application/andrew-inset', |
|
| 282 | + 'ez2' => 'application/vnd.ezpix-album', |
|
| 283 | + 'ez3' => 'application/vnd.ezpix-package', |
|
| 284 | + 'f' => 'text/x-fortran', |
|
| 285 | + 'f4v' => 'video/mp4', |
|
| 286 | + 'f77' => 'text/x-fortran', |
|
| 287 | + 'f90' => 'text/x-fortran', |
|
| 288 | + 'fbs' => 'image/vnd.fastbidsheet', |
|
| 289 | + 'fcdt' => 'application/vnd.adobe.formscentral.fcdt', |
|
| 290 | + 'fcs' => 'application/vnd.isac.fcs', |
|
| 291 | + 'fdf' => 'application/vnd.fdf', |
|
| 292 | + 'fdt' => 'application/fdt+xml', |
|
| 293 | + 'fe_launch' => 'application/vnd.denovo.fcselayout-link', |
|
| 294 | + 'fg5' => 'application/vnd.fujitsu.oasysgp', |
|
| 295 | + 'fgd' => 'application/x-director', |
|
| 296 | + 'fh' => 'image/x-freehand', |
|
| 297 | + 'fh4' => 'image/x-freehand', |
|
| 298 | + 'fh5' => 'image/x-freehand', |
|
| 299 | + 'fh7' => 'image/x-freehand', |
|
| 300 | + 'fhc' => 'image/x-freehand', |
|
| 301 | + 'fig' => 'application/x-xfig', |
|
| 302 | + 'fits' => 'image/fits', |
|
| 303 | + 'flac' => 'audio/x-flac', |
|
| 304 | + 'fli' => 'video/x-fli', |
|
| 305 | + 'flo' => 'application/vnd.micrografx.flo', |
|
| 306 | + 'flv' => 'video/x-flv', |
|
| 307 | + 'flw' => 'application/vnd.kde.kivio', |
|
| 308 | + 'flx' => 'text/vnd.fmi.flexstor', |
|
| 309 | + 'fly' => 'text/vnd.fly', |
|
| 310 | + 'fm' => 'application/vnd.framemaker', |
|
| 311 | + 'fnc' => 'application/vnd.frogans.fnc', |
|
| 312 | + 'fo' => 'application/vnd.software602.filler.form+xml', |
|
| 313 | + 'for' => 'text/x-fortran', |
|
| 314 | + 'fpx' => 'image/vnd.fpx', |
|
| 315 | + 'frame' => 'application/vnd.framemaker', |
|
| 316 | + 'fsc' => 'application/vnd.fsc.weblaunch', |
|
| 317 | + 'fst' => 'image/vnd.fst', |
|
| 318 | + 'ftc' => 'application/vnd.fluxtime.clip', |
|
| 319 | + 'fti' => 'application/vnd.anser-web-funds-transfer-initiation', |
|
| 320 | + 'fvt' => 'video/vnd.fvt', |
|
| 321 | + 'fxp' => 'application/vnd.adobe.fxp', |
|
| 322 | + 'fxpl' => 'application/vnd.adobe.fxp', |
|
| 323 | + 'fzs' => 'application/vnd.fuzzysheet', |
|
| 324 | + 'g2w' => 'application/vnd.geoplan', |
|
| 325 | + 'g3' => 'image/g3fax', |
|
| 326 | + 'g3w' => 'application/vnd.geospace', |
|
| 327 | + 'gac' => 'application/vnd.groove-account', |
|
| 328 | + 'gam' => 'application/x-tads', |
|
| 329 | + 'gbr' => 'application/rpki-ghostbusters', |
|
| 330 | + 'gca' => 'application/x-gca-compressed', |
|
| 331 | + 'gdl' => 'model/vnd.gdl', |
|
| 332 | + 'gdoc' => 'application/vnd.google-apps.document', |
|
| 333 | + 'ged' => 'text/vnd.familysearch.gedcom', |
|
| 334 | + 'geo' => 'application/vnd.dynageo', |
|
| 335 | + 'geojson' => 'application/geo+json', |
|
| 336 | + 'gex' => 'application/vnd.geometry-explorer', |
|
| 337 | + 'ggb' => 'application/vnd.geogebra.file', |
|
| 338 | + 'ggt' => 'application/vnd.geogebra.tool', |
|
| 339 | + 'ghf' => 'application/vnd.groove-help', |
|
| 340 | + 'gif' => 'image/gif', |
|
| 341 | + 'gim' => 'application/vnd.groove-identity-message', |
|
| 342 | + 'glb' => 'model/gltf-binary', |
|
| 343 | + 'gltf' => 'model/gltf+json', |
|
| 344 | + 'gml' => 'application/gml+xml', |
|
| 345 | + 'gmx' => 'application/vnd.gmx', |
|
| 346 | + 'gnumeric' => 'application/x-gnumeric', |
|
| 347 | + 'gpg' => 'application/gpg-keys', |
|
| 348 | + 'gph' => 'application/vnd.flographit', |
|
| 349 | + 'gpx' => 'application/gpx+xml', |
|
| 350 | + 'gqf' => 'application/vnd.grafeq', |
|
| 351 | + 'gqs' => 'application/vnd.grafeq', |
|
| 352 | + 'gram' => 'application/srgs', |
|
| 353 | + 'gramps' => 'application/x-gramps-xml', |
|
| 354 | + 'gre' => 'application/vnd.geometry-explorer', |
|
| 355 | + 'grv' => 'application/vnd.groove-injector', |
|
| 356 | + 'grxml' => 'application/srgs+xml', |
|
| 357 | + 'gsf' => 'application/x-font-ghostscript', |
|
| 358 | + 'gsheet' => 'application/vnd.google-apps.spreadsheet', |
|
| 359 | + 'gslides' => 'application/vnd.google-apps.presentation', |
|
| 360 | + 'gtar' => 'application/x-gtar', |
|
| 361 | + 'gtm' => 'application/vnd.groove-tool-message', |
|
| 362 | + 'gtw' => 'model/vnd.gtw', |
|
| 363 | + 'gv' => 'text/vnd.graphviz', |
|
| 364 | + 'gxf' => 'application/gxf', |
|
| 365 | + 'gxt' => 'application/vnd.geonext', |
|
| 366 | + 'gz' => 'application/gzip', |
|
| 367 | + 'gzip' => 'application/gzip', |
|
| 368 | + 'h' => 'text/x-c', |
|
| 369 | + 'h261' => 'video/h261', |
|
| 370 | + 'h263' => 'video/h263', |
|
| 371 | + 'h264' => 'video/h264', |
|
| 372 | + 'hal' => 'application/vnd.hal+xml', |
|
| 373 | + 'hbci' => 'application/vnd.hbci', |
|
| 374 | + 'hbs' => 'text/x-handlebars-template', |
|
| 375 | + 'hdd' => 'application/x-virtualbox-hdd', |
|
| 376 | + 'hdf' => 'application/x-hdf', |
|
| 377 | + 'heic' => 'image/heic', |
|
| 378 | + 'heics' => 'image/heic-sequence', |
|
| 379 | + 'heif' => 'image/heif', |
|
| 380 | + 'heifs' => 'image/heif-sequence', |
|
| 381 | + 'hej2' => 'image/hej2k', |
|
| 382 | + 'held' => 'application/atsc-held+xml', |
|
| 383 | + 'hh' => 'text/x-c', |
|
| 384 | + 'hjson' => 'application/hjson', |
|
| 385 | + 'hlp' => 'application/winhlp', |
|
| 386 | + 'hpgl' => 'application/vnd.hp-hpgl', |
|
| 387 | + 'hpid' => 'application/vnd.hp-hpid', |
|
| 388 | + 'hps' => 'application/vnd.hp-hps', |
|
| 389 | + 'hqx' => 'application/mac-binhex40', |
|
| 390 | + 'hsj2' => 'image/hsj2', |
|
| 391 | + 'htc' => 'text/x-component', |
|
| 392 | + 'htke' => 'application/vnd.kenameaapp', |
|
| 393 | + 'htm' => 'text/html', |
|
| 394 | + 'html' => 'text/html', |
|
| 395 | + 'hvd' => 'application/vnd.yamaha.hv-dic', |
|
| 396 | + 'hvp' => 'application/vnd.yamaha.hv-voice', |
|
| 397 | + 'hvs' => 'application/vnd.yamaha.hv-script', |
|
| 398 | + 'i2g' => 'application/vnd.intergeo', |
|
| 399 | + 'icc' => 'application/vnd.iccprofile', |
|
| 400 | + 'ice' => 'x-conference/x-cooltalk', |
|
| 401 | + 'icm' => 'application/vnd.iccprofile', |
|
| 402 | + 'ico' => 'image/x-icon', |
|
| 403 | + 'ics' => 'text/calendar', |
|
| 404 | + 'ief' => 'image/ief', |
|
| 405 | + 'ifb' => 'text/calendar', |
|
| 406 | + 'ifm' => 'application/vnd.shana.informed.formdata', |
|
| 407 | + 'iges' => 'model/iges', |
|
| 408 | + 'igl' => 'application/vnd.igloader', |
|
| 409 | + 'igm' => 'application/vnd.insors.igm', |
|
| 410 | + 'igs' => 'model/iges', |
|
| 411 | + 'igx' => 'application/vnd.micrografx.igx', |
|
| 412 | + 'iif' => 'application/vnd.shana.informed.interchange', |
|
| 413 | + 'img' => 'application/octet-stream', |
|
| 414 | + 'imp' => 'application/vnd.accpac.simply.imp', |
|
| 415 | + 'ims' => 'application/vnd.ms-ims', |
|
| 416 | + 'in' => 'text/plain', |
|
| 417 | + 'ini' => 'text/plain', |
|
| 418 | + 'ink' => 'application/inkml+xml', |
|
| 419 | + 'inkml' => 'application/inkml+xml', |
|
| 420 | + 'install' => 'application/x-install-instructions', |
|
| 421 | + 'iota' => 'application/vnd.astraea-software.iota', |
|
| 422 | + 'ipfix' => 'application/ipfix', |
|
| 423 | + 'ipk' => 'application/vnd.shana.informed.package', |
|
| 424 | + 'irm' => 'application/vnd.ibm.rights-management', |
|
| 425 | + 'irp' => 'application/vnd.irepository.package+xml', |
|
| 426 | + 'iso' => 'application/x-iso9660-image', |
|
| 427 | + 'itp' => 'application/vnd.shana.informed.formtemplate', |
|
| 428 | + 'its' => 'application/its+xml', |
|
| 429 | + 'ivp' => 'application/vnd.immervision-ivp', |
|
| 430 | + 'ivu' => 'application/vnd.immervision-ivu', |
|
| 431 | + 'jad' => 'text/vnd.sun.j2me.app-descriptor', |
|
| 432 | + 'jade' => 'text/jade', |
|
| 433 | + 'jam' => 'application/vnd.jam', |
|
| 434 | + 'jar' => 'application/java-archive', |
|
| 435 | + 'jardiff' => 'application/x-java-archive-diff', |
|
| 436 | + 'java' => 'text/x-java-source', |
|
| 437 | + 'jhc' => 'image/jphc', |
|
| 438 | + 'jisp' => 'application/vnd.jisp', |
|
| 439 | + 'jls' => 'image/jls', |
|
| 440 | + 'jlt' => 'application/vnd.hp-jlyt', |
|
| 441 | + 'jng' => 'image/x-jng', |
|
| 442 | + 'jnlp' => 'application/x-java-jnlp-file', |
|
| 443 | + 'joda' => 'application/vnd.joost.joda-archive', |
|
| 444 | + 'jp2' => 'image/jp2', |
|
| 445 | + 'jpe' => 'image/jpeg', |
|
| 446 | + 'jpeg' => 'image/jpeg', |
|
| 447 | + 'jpf' => 'image/jpx', |
|
| 448 | + 'jpg' => 'image/jpeg', |
|
| 449 | + 'jpg2' => 'image/jp2', |
|
| 450 | + 'jpgm' => 'video/jpm', |
|
| 451 | + 'jpgv' => 'video/jpeg', |
|
| 452 | + 'jph' => 'image/jph', |
|
| 453 | + 'jpm' => 'video/jpm', |
|
| 454 | + 'jpx' => 'image/jpx', |
|
| 455 | + 'js' => 'application/javascript', |
|
| 456 | + 'json' => 'application/json', |
|
| 457 | + 'json5' => 'application/json5', |
|
| 458 | + 'jsonld' => 'application/ld+json', |
|
| 459 | + 'jsonml' => 'application/jsonml+json', |
|
| 460 | + 'jsx' => 'text/jsx', |
|
| 461 | + 'jt' => 'model/jt', |
|
| 462 | + 'jxr' => 'image/jxr', |
|
| 463 | + 'jxra' => 'image/jxra', |
|
| 464 | + 'jxrs' => 'image/jxrs', |
|
| 465 | + 'jxs' => 'image/jxs', |
|
| 466 | + 'jxsc' => 'image/jxsc', |
|
| 467 | + 'jxsi' => 'image/jxsi', |
|
| 468 | + 'jxss' => 'image/jxss', |
|
| 469 | + 'kar' => 'audio/midi', |
|
| 470 | + 'karbon' => 'application/vnd.kde.karbon', |
|
| 471 | + 'kdb' => 'application/octet-stream', |
|
| 472 | + 'kdbx' => 'application/x-keepass2', |
|
| 473 | + 'key' => 'application/x-iwork-keynote-sffkey', |
|
| 474 | + 'kfo' => 'application/vnd.kde.kformula', |
|
| 475 | + 'kia' => 'application/vnd.kidspiration', |
|
| 476 | + 'kml' => 'application/vnd.google-earth.kml+xml', |
|
| 477 | + 'kmz' => 'application/vnd.google-earth.kmz', |
|
| 478 | + 'kne' => 'application/vnd.kinar', |
|
| 479 | + 'knp' => 'application/vnd.kinar', |
|
| 480 | + 'kon' => 'application/vnd.kde.kontour', |
|
| 481 | + 'kpr' => 'application/vnd.kde.kpresenter', |
|
| 482 | + 'kpt' => 'application/vnd.kde.kpresenter', |
|
| 483 | + 'kpxx' => 'application/vnd.ds-keypoint', |
|
| 484 | + 'ksp' => 'application/vnd.kde.kspread', |
|
| 485 | + 'ktr' => 'application/vnd.kahootz', |
|
| 486 | + 'ktx' => 'image/ktx', |
|
| 487 | + 'ktx2' => 'image/ktx2', |
|
| 488 | + 'ktz' => 'application/vnd.kahootz', |
|
| 489 | + 'kwd' => 'application/vnd.kde.kword', |
|
| 490 | + 'kwt' => 'application/vnd.kde.kword', |
|
| 491 | + 'lasxml' => 'application/vnd.las.las+xml', |
|
| 492 | + 'latex' => 'application/x-latex', |
|
| 493 | + 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop', |
|
| 494 | + 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml', |
|
| 495 | + 'les' => 'application/vnd.hhe.lesson-player', |
|
| 496 | + 'less' => 'text/less', |
|
| 497 | + 'lgr' => 'application/lgr+xml', |
|
| 498 | + 'lha' => 'application/octet-stream', |
|
| 499 | + 'link66' => 'application/vnd.route66.link66+xml', |
|
| 500 | + 'list' => 'text/plain', |
|
| 501 | + 'list3820' => 'application/vnd.ibm.modcap', |
|
| 502 | + 'listafp' => 'application/vnd.ibm.modcap', |
|
| 503 | + 'litcoffee' => 'text/coffeescript', |
|
| 504 | + 'lnk' => 'application/x-ms-shortcut', |
|
| 505 | + 'log' => 'text/plain', |
|
| 506 | + 'lostxml' => 'application/lost+xml', |
|
| 507 | + 'lrf' => 'application/octet-stream', |
|
| 508 | + 'lrm' => 'application/vnd.ms-lrm', |
|
| 509 | + 'ltf' => 'application/vnd.frogans.ltf', |
|
| 510 | + 'lua' => 'text/x-lua', |
|
| 511 | + 'luac' => 'application/x-lua-bytecode', |
|
| 512 | + 'lvp' => 'audio/vnd.lucent.voice', |
|
| 513 | + 'lwp' => 'application/vnd.lotus-wordpro', |
|
| 514 | + 'lzh' => 'application/octet-stream', |
|
| 515 | + 'm1v' => 'video/mpeg', |
|
| 516 | + 'm2a' => 'audio/mpeg', |
|
| 517 | + 'm2v' => 'video/mpeg', |
|
| 518 | + 'm3a' => 'audio/mpeg', |
|
| 519 | + 'm3u' => 'text/plain', |
|
| 520 | + 'm3u8' => 'application/vnd.apple.mpegurl', |
|
| 521 | + 'm4a' => 'audio/x-m4a', |
|
| 522 | + 'm4p' => 'application/mp4', |
|
| 523 | + 'm4s' => 'video/iso.segment', |
|
| 524 | + 'm4u' => 'application/vnd.mpegurl', |
|
| 525 | + 'm4v' => 'video/x-m4v', |
|
| 526 | + 'm13' => 'application/x-msmediaview', |
|
| 527 | + 'm14' => 'application/x-msmediaview', |
|
| 528 | + 'm21' => 'application/mp21', |
|
| 529 | + 'ma' => 'application/mathematica', |
|
| 530 | + 'mads' => 'application/mads+xml', |
|
| 531 | + 'maei' => 'application/mmt-aei+xml', |
|
| 532 | + 'mag' => 'application/vnd.ecowin.chart', |
|
| 533 | + 'maker' => 'application/vnd.framemaker', |
|
| 534 | + 'man' => 'text/troff', |
|
| 535 | + 'manifest' => 'text/cache-manifest', |
|
| 536 | + 'map' => 'application/json', |
|
| 537 | + 'mar' => 'application/octet-stream', |
|
| 538 | + 'markdown' => 'text/markdown', |
|
| 539 | + 'mathml' => 'application/mathml+xml', |
|
| 540 | + 'mb' => 'application/mathematica', |
|
| 541 | + 'mbk' => 'application/vnd.mobius.mbk', |
|
| 542 | + 'mbox' => 'application/mbox', |
|
| 543 | + 'mc1' => 'application/vnd.medcalcdata', |
|
| 544 | + 'mcd' => 'application/vnd.mcd', |
|
| 545 | + 'mcurl' => 'text/vnd.curl.mcurl', |
|
| 546 | + 'md' => 'text/markdown', |
|
| 547 | + 'mdb' => 'application/x-msaccess', |
|
| 548 | + 'mdi' => 'image/vnd.ms-modi', |
|
| 549 | + 'mdx' => 'text/mdx', |
|
| 550 | + 'me' => 'text/troff', |
|
| 551 | + 'mesh' => 'model/mesh', |
|
| 552 | + 'meta4' => 'application/metalink4+xml', |
|
| 553 | + 'metalink' => 'application/metalink+xml', |
|
| 554 | + 'mets' => 'application/mets+xml', |
|
| 555 | + 'mfm' => 'application/vnd.mfmp', |
|
| 556 | + 'mft' => 'application/rpki-manifest', |
|
| 557 | + 'mgp' => 'application/vnd.osgeo.mapguide.package', |
|
| 558 | + 'mgz' => 'application/vnd.proteus.magazine', |
|
| 559 | + 'mid' => 'audio/midi', |
|
| 560 | + 'midi' => 'audio/midi', |
|
| 561 | + 'mie' => 'application/x-mie', |
|
| 562 | + 'mif' => 'application/vnd.mif', |
|
| 563 | + 'mime' => 'message/rfc822', |
|
| 564 | + 'mj2' => 'video/mj2', |
|
| 565 | + 'mjp2' => 'video/mj2', |
|
| 566 | + 'mjs' => 'text/javascript', |
|
| 567 | + 'mk3d' => 'video/x-matroska', |
|
| 568 | + 'mka' => 'audio/x-matroska', |
|
| 569 | + 'mkd' => 'text/x-markdown', |
|
| 570 | + 'mks' => 'video/x-matroska', |
|
| 571 | + 'mkv' => 'video/x-matroska', |
|
| 572 | + 'mlp' => 'application/vnd.dolby.mlp', |
|
| 573 | + 'mmd' => 'application/vnd.chipnuts.karaoke-mmd', |
|
| 574 | + 'mmf' => 'application/vnd.smaf', |
|
| 575 | + 'mml' => 'text/mathml', |
|
| 576 | + 'mmr' => 'image/vnd.fujixerox.edmics-mmr', |
|
| 577 | + 'mng' => 'video/x-mng', |
|
| 578 | + 'mny' => 'application/x-msmoney', |
|
| 579 | + 'mobi' => 'application/x-mobipocket-ebook', |
|
| 580 | + 'mods' => 'application/mods+xml', |
|
| 581 | + 'mov' => 'video/quicktime', |
|
| 582 | + 'movie' => 'video/x-sgi-movie', |
|
| 583 | + 'mp2' => 'audio/mpeg', |
|
| 584 | + 'mp2a' => 'audio/mpeg', |
|
| 585 | + 'mp3' => 'audio/mpeg', |
|
| 586 | + 'mp4' => 'video/mp4', |
|
| 587 | + 'mp4a' => 'audio/mp4', |
|
| 588 | + 'mp4s' => 'application/mp4', |
|
| 589 | + 'mp4v' => 'video/mp4', |
|
| 590 | + 'mp21' => 'application/mp21', |
|
| 591 | + 'mpc' => 'application/vnd.mophun.certificate', |
|
| 592 | + 'mpd' => 'application/dash+xml', |
|
| 593 | + 'mpe' => 'video/mpeg', |
|
| 594 | + 'mpeg' => 'video/mpeg', |
|
| 595 | + 'mpf' => 'application/media-policy-dataset+xml', |
|
| 596 | + 'mpg' => 'video/mpeg', |
|
| 597 | + 'mpg4' => 'video/mp4', |
|
| 598 | + 'mpga' => 'audio/mpeg', |
|
| 599 | + 'mpkg' => 'application/vnd.apple.installer+xml', |
|
| 600 | + 'mpm' => 'application/vnd.blueice.multipass', |
|
| 601 | + 'mpn' => 'application/vnd.mophun.application', |
|
| 602 | + 'mpp' => 'application/vnd.ms-project', |
|
| 603 | + 'mpt' => 'application/vnd.ms-project', |
|
| 604 | + 'mpy' => 'application/vnd.ibm.minipay', |
|
| 605 | + 'mqy' => 'application/vnd.mobius.mqy', |
|
| 606 | + 'mrc' => 'application/marc', |
|
| 607 | + 'mrcx' => 'application/marcxml+xml', |
|
| 608 | + 'ms' => 'text/troff', |
|
| 609 | + 'mscml' => 'application/mediaservercontrol+xml', |
|
| 610 | + 'mseed' => 'application/vnd.fdsn.mseed', |
|
| 611 | + 'mseq' => 'application/vnd.mseq', |
|
| 612 | + 'msf' => 'application/vnd.epson.msf', |
|
| 613 | + 'msg' => 'application/vnd.ms-outlook', |
|
| 614 | + 'msh' => 'model/mesh', |
|
| 615 | + 'msi' => 'application/x-msdownload', |
|
| 616 | + 'msix' => 'application/msix', |
|
| 617 | + 'msixbundle' => 'application/msixbundle', |
|
| 618 | + 'msl' => 'application/vnd.mobius.msl', |
|
| 619 | + 'msm' => 'application/octet-stream', |
|
| 620 | + 'msp' => 'application/octet-stream', |
|
| 621 | + 'msty' => 'application/vnd.muvee.style', |
|
| 622 | + 'mtl' => 'model/mtl', |
|
| 623 | + 'mts' => 'model/vnd.mts', |
|
| 624 | + 'mus' => 'application/vnd.musician', |
|
| 625 | + 'musd' => 'application/mmt-usd+xml', |
|
| 626 | + 'musicxml' => 'application/vnd.recordare.musicxml+xml', |
|
| 627 | + 'mvb' => 'application/x-msmediaview', |
|
| 628 | + 'mvt' => 'application/vnd.mapbox-vector-tile', |
|
| 629 | + 'mwf' => 'application/vnd.mfer', |
|
| 630 | + 'mxf' => 'application/mxf', |
|
| 631 | + 'mxl' => 'application/vnd.recordare.musicxml', |
|
| 632 | + 'mxmf' => 'audio/mobile-xmf', |
|
| 633 | + 'mxml' => 'application/xv+xml', |
|
| 634 | + 'mxs' => 'application/vnd.triscape.mxs', |
|
| 635 | + 'mxu' => 'video/vnd.mpegurl', |
|
| 636 | + 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install', |
|
| 637 | + 'n3' => 'text/n3', |
|
| 638 | + 'nb' => 'application/mathematica', |
|
| 639 | + 'nbp' => 'application/vnd.wolfram.player', |
|
| 640 | + 'nc' => 'application/x-netcdf', |
|
| 641 | + 'ncx' => 'application/x-dtbncx+xml', |
|
| 642 | + 'nfo' => 'text/x-nfo', |
|
| 643 | + 'ngdat' => 'application/vnd.nokia.n-gage.data', |
|
| 644 | + 'nitf' => 'application/vnd.nitf', |
|
| 645 | + 'nlu' => 'application/vnd.neurolanguage.nlu', |
|
| 646 | + 'nml' => 'application/vnd.enliven', |
|
| 647 | + 'nnd' => 'application/vnd.noblenet-directory', |
|
| 648 | + 'nns' => 'application/vnd.noblenet-sealer', |
|
| 649 | + 'nnw' => 'application/vnd.noblenet-web', |
|
| 650 | + 'npx' => 'image/vnd.net-fpx', |
|
| 651 | + 'nq' => 'application/n-quads', |
|
| 652 | + 'nsc' => 'application/x-conference', |
|
| 653 | + 'nsf' => 'application/vnd.lotus-notes', |
|
| 654 | + 'nt' => 'application/n-triples', |
|
| 655 | + 'ntf' => 'application/vnd.nitf', |
|
| 656 | + 'numbers' => 'application/x-iwork-numbers-sffnumbers', |
|
| 657 | + 'nzb' => 'application/x-nzb', |
|
| 658 | + 'oa2' => 'application/vnd.fujitsu.oasys2', |
|
| 659 | + 'oa3' => 'application/vnd.fujitsu.oasys3', |
|
| 660 | + 'oas' => 'application/vnd.fujitsu.oasys', |
|
| 661 | + 'obd' => 'application/x-msbinder', |
|
| 662 | + 'obgx' => 'application/vnd.openblox.game+xml', |
|
| 663 | + 'obj' => 'model/obj', |
|
| 664 | + 'oda' => 'application/oda', |
|
| 665 | + 'odb' => 'application/vnd.oasis.opendocument.database', |
|
| 666 | + 'odc' => 'application/vnd.oasis.opendocument.chart', |
|
| 667 | + 'odf' => 'application/vnd.oasis.opendocument.formula', |
|
| 668 | + 'odft' => 'application/vnd.oasis.opendocument.formula-template', |
|
| 669 | + 'odg' => 'application/vnd.oasis.opendocument.graphics', |
|
| 670 | + 'odi' => 'application/vnd.oasis.opendocument.image', |
|
| 671 | + 'odm' => 'application/vnd.oasis.opendocument.text-master', |
|
| 672 | + 'odp' => 'application/vnd.oasis.opendocument.presentation', |
|
| 673 | + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', |
|
| 674 | + 'odt' => 'application/vnd.oasis.opendocument.text', |
|
| 675 | + 'oga' => 'audio/ogg', |
|
| 676 | + 'ogex' => 'model/vnd.opengex', |
|
| 677 | + 'ogg' => 'audio/ogg', |
|
| 678 | + 'ogv' => 'video/ogg', |
|
| 679 | + 'ogx' => 'application/ogg', |
|
| 680 | + 'omdoc' => 'application/omdoc+xml', |
|
| 681 | + 'onepkg' => 'application/onenote', |
|
| 682 | + 'onetmp' => 'application/onenote', |
|
| 683 | + 'onetoc' => 'application/onenote', |
|
| 684 | + 'onetoc2' => 'application/onenote', |
|
| 685 | + 'opf' => 'application/oebps-package+xml', |
|
| 686 | + 'opml' => 'text/x-opml', |
|
| 687 | + 'oprc' => 'application/vnd.palm', |
|
| 688 | + 'opus' => 'audio/ogg', |
|
| 689 | + 'org' => 'text/x-org', |
|
| 690 | + 'osf' => 'application/vnd.yamaha.openscoreformat', |
|
| 691 | + 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml', |
|
| 692 | + 'osm' => 'application/vnd.openstreetmap.data+xml', |
|
| 693 | + 'otc' => 'application/vnd.oasis.opendocument.chart-template', |
|
| 694 | + 'otf' => 'font/otf', |
|
| 695 | + 'otg' => 'application/vnd.oasis.opendocument.graphics-template', |
|
| 696 | + 'oth' => 'application/vnd.oasis.opendocument.text-web', |
|
| 697 | + 'oti' => 'application/vnd.oasis.opendocument.image-template', |
|
| 698 | + 'otp' => 'application/vnd.oasis.opendocument.presentation-template', |
|
| 699 | + 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', |
|
| 700 | + 'ott' => 'application/vnd.oasis.opendocument.text-template', |
|
| 701 | + 'ova' => 'application/x-virtualbox-ova', |
|
| 702 | + 'ovf' => 'application/x-virtualbox-ovf', |
|
| 703 | + 'owl' => 'application/rdf+xml', |
|
| 704 | + 'oxps' => 'application/oxps', |
|
| 705 | + 'oxt' => 'application/vnd.openofficeorg.extension', |
|
| 706 | + 'p' => 'text/x-pascal', |
|
| 707 | + 'p7a' => 'application/x-pkcs7-signature', |
|
| 708 | + 'p7b' => 'application/x-pkcs7-certificates', |
|
| 709 | + 'p7c' => 'application/pkcs7-mime', |
|
| 710 | + 'p7m' => 'application/pkcs7-mime', |
|
| 711 | + 'p7r' => 'application/x-pkcs7-certreqresp', |
|
| 712 | + 'p7s' => 'application/pkcs7-signature', |
|
| 713 | + 'p8' => 'application/pkcs8', |
|
| 714 | + 'p10' => 'application/x-pkcs10', |
|
| 715 | + 'p12' => 'application/x-pkcs12', |
|
| 716 | + 'pac' => 'application/x-ns-proxy-autoconfig', |
|
| 717 | + 'pages' => 'application/x-iwork-pages-sffpages', |
|
| 718 | + 'pas' => 'text/x-pascal', |
|
| 719 | + 'paw' => 'application/vnd.pawaafile', |
|
| 720 | + 'pbd' => 'application/vnd.powerbuilder6', |
|
| 721 | + 'pbm' => 'image/x-portable-bitmap', |
|
| 722 | + 'pcap' => 'application/vnd.tcpdump.pcap', |
|
| 723 | + 'pcf' => 'application/x-font-pcf', |
|
| 724 | + 'pcl' => 'application/vnd.hp-pcl', |
|
| 725 | + 'pclxl' => 'application/vnd.hp-pclxl', |
|
| 726 | + 'pct' => 'image/x-pict', |
|
| 727 | + 'pcurl' => 'application/vnd.curl.pcurl', |
|
| 728 | + 'pcx' => 'image/x-pcx', |
|
| 729 | + 'pdb' => 'application/x-pilot', |
|
| 730 | + 'pde' => 'text/x-processing', |
|
| 731 | + 'pdf' => 'application/pdf', |
|
| 732 | + 'pem' => 'application/x-x509-user-cert', |
|
| 733 | + 'pfa' => 'application/x-font-type1', |
|
| 734 | + 'pfb' => 'application/x-font-type1', |
|
| 735 | + 'pfm' => 'application/x-font-type1', |
|
| 736 | + 'pfr' => 'application/font-tdpfr', |
|
| 737 | + 'pfx' => 'application/x-pkcs12', |
|
| 738 | + 'pgm' => 'image/x-portable-graymap', |
|
| 739 | + 'pgn' => 'application/x-chess-pgn', |
|
| 740 | + 'pgp' => 'application/pgp', |
|
| 741 | + 'phar' => 'application/octet-stream', |
|
| 742 | + 'php' => 'application/x-httpd-php', |
|
| 743 | + 'php3' => 'application/x-httpd-php', |
|
| 744 | + 'php4' => 'application/x-httpd-php', |
|
| 745 | + 'phps' => 'application/x-httpd-php-source', |
|
| 746 | + 'phtml' => 'application/x-httpd-php', |
|
| 747 | + 'pic' => 'image/x-pict', |
|
| 748 | + 'pkg' => 'application/octet-stream', |
|
| 749 | + 'pki' => 'application/pkixcmp', |
|
| 750 | + 'pkipath' => 'application/pkix-pkipath', |
|
| 751 | + 'pkpass' => 'application/vnd.apple.pkpass', |
|
| 752 | + 'pl' => 'application/x-perl', |
|
| 753 | + 'plb' => 'application/vnd.3gpp.pic-bw-large', |
|
| 754 | + 'plc' => 'application/vnd.mobius.plc', |
|
| 755 | + 'plf' => 'application/vnd.pocketlearn', |
|
| 756 | + 'pls' => 'application/pls+xml', |
|
| 757 | + 'pm' => 'application/x-perl', |
|
| 758 | + 'pml' => 'application/vnd.ctc-posml', |
|
| 759 | + 'png' => 'image/png', |
|
| 760 | + 'pnm' => 'image/x-portable-anymap', |
|
| 761 | + 'portpkg' => 'application/vnd.macports.portpkg', |
|
| 762 | + 'pot' => 'application/vnd.ms-powerpoint', |
|
| 763 | + 'potm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', |
|
| 764 | + 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', |
|
| 765 | + 'ppa' => 'application/vnd.ms-powerpoint', |
|
| 766 | + 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', |
|
| 767 | + 'ppd' => 'application/vnd.cups-ppd', |
|
| 768 | + 'ppm' => 'image/x-portable-pixmap', |
|
| 769 | + 'pps' => 'application/vnd.ms-powerpoint', |
|
| 770 | + 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', |
|
| 771 | + 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', |
|
| 772 | + 'ppt' => 'application/powerpoint', |
|
| 773 | + 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', |
|
| 774 | + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', |
|
| 775 | + 'pqa' => 'application/vnd.palm', |
|
| 776 | + 'prc' => 'model/prc', |
|
| 777 | + 'pre' => 'application/vnd.lotus-freelance', |
|
| 778 | + 'prf' => 'application/pics-rules', |
|
| 779 | + 'provx' => 'application/provenance+xml', |
|
| 780 | + 'ps' => 'application/postscript', |
|
| 781 | + 'psb' => 'application/vnd.3gpp.pic-bw-small', |
|
| 782 | + 'psd' => 'application/x-photoshop', |
|
| 783 | + 'psf' => 'application/x-font-linux-psf', |
|
| 784 | + 'pskcxml' => 'application/pskc+xml', |
|
| 785 | + 'pti' => 'image/prs.pti', |
|
| 786 | + 'ptid' => 'application/vnd.pvi.ptid1', |
|
| 787 | + 'pub' => 'application/x-mspublisher', |
|
| 788 | + 'pvb' => 'application/vnd.3gpp.pic-bw-var', |
|
| 789 | + 'pwn' => 'application/vnd.3m.post-it-notes', |
|
| 790 | + 'pya' => 'audio/vnd.ms-playready.media.pya', |
|
| 791 | + 'pyo' => 'model/vnd.pytha.pyox', |
|
| 792 | + 'pyox' => 'model/vnd.pytha.pyox', |
|
| 793 | + 'pyv' => 'video/vnd.ms-playready.media.pyv', |
|
| 794 | + 'qam' => 'application/vnd.epson.quickanime', |
|
| 795 | + 'qbo' => 'application/vnd.intu.qbo', |
|
| 796 | + 'qfx' => 'application/vnd.intu.qfx', |
|
| 797 | + 'qps' => 'application/vnd.publishare-delta-tree', |
|
| 798 | + 'qt' => 'video/quicktime', |
|
| 799 | + 'qwd' => 'application/vnd.quark.quarkxpress', |
|
| 800 | + 'qwt' => 'application/vnd.quark.quarkxpress', |
|
| 801 | + 'qxb' => 'application/vnd.quark.quarkxpress', |
|
| 802 | + 'qxd' => 'application/vnd.quark.quarkxpress', |
|
| 803 | + 'qxl' => 'application/vnd.quark.quarkxpress', |
|
| 804 | + 'qxt' => 'application/vnd.quark.quarkxpress', |
|
| 805 | + 'ra' => 'audio/x-realaudio', |
|
| 806 | + 'ram' => 'audio/x-pn-realaudio', |
|
| 807 | + 'raml' => 'application/raml+yaml', |
|
| 808 | + 'rapd' => 'application/route-apd+xml', |
|
| 809 | + 'rar' => 'application/x-rar', |
|
| 810 | + 'ras' => 'image/x-cmu-raster', |
|
| 811 | + 'rcprofile' => 'application/vnd.ipunplugged.rcprofile', |
|
| 812 | + 'rdf' => 'application/rdf+xml', |
|
| 813 | + 'rdz' => 'application/vnd.data-vision.rdz', |
|
| 814 | + 'relo' => 'application/p2p-overlay+xml', |
|
| 815 | + 'rep' => 'application/vnd.businessobjects', |
|
| 816 | + 'res' => 'application/x-dtbresource+xml', |
|
| 817 | + 'rgb' => 'image/x-rgb', |
|
| 818 | + 'rif' => 'application/reginfo+xml', |
|
| 819 | + 'rip' => 'audio/vnd.rip', |
|
| 820 | + 'ris' => 'application/x-research-info-systems', |
|
| 821 | + 'rl' => 'application/resource-lists+xml', |
|
| 822 | + 'rlc' => 'image/vnd.fujixerox.edmics-rlc', |
|
| 823 | + 'rld' => 'application/resource-lists-diff+xml', |
|
| 824 | + 'rm' => 'audio/x-pn-realaudio', |
|
| 825 | + 'rmi' => 'audio/midi', |
|
| 826 | + 'rmp' => 'audio/x-pn-realaudio-plugin', |
|
| 827 | + 'rms' => 'application/vnd.jcp.javame.midlet-rms', |
|
| 828 | + 'rmvb' => 'application/vnd.rn-realmedia-vbr', |
|
| 829 | + 'rnc' => 'application/relax-ng-compact-syntax', |
|
| 830 | + 'rng' => 'application/xml', |
|
| 831 | + 'roa' => 'application/rpki-roa', |
|
| 832 | + 'roff' => 'text/troff', |
|
| 833 | + 'rp9' => 'application/vnd.cloanto.rp9', |
|
| 834 | + 'rpm' => 'audio/x-pn-realaudio-plugin', |
|
| 835 | + 'rpss' => 'application/vnd.nokia.radio-presets', |
|
| 836 | + 'rpst' => 'application/vnd.nokia.radio-preset', |
|
| 837 | + 'rq' => 'application/sparql-query', |
|
| 838 | + 'rs' => 'application/rls-services+xml', |
|
| 839 | + 'rsa' => 'application/x-pkcs7', |
|
| 840 | + 'rsat' => 'application/atsc-rsat+xml', |
|
| 841 | + 'rsd' => 'application/rsd+xml', |
|
| 842 | + 'rsheet' => 'application/urc-ressheet+xml', |
|
| 843 | + 'rss' => 'application/rss+xml', |
|
| 844 | + 'rtf' => 'text/rtf', |
|
| 845 | + 'rtx' => 'text/richtext', |
|
| 846 | + 'run' => 'application/x-makeself', |
|
| 847 | + 'rusd' => 'application/route-usd+xml', |
|
| 848 | + 'rv' => 'video/vnd.rn-realvideo', |
|
| 849 | + 's' => 'text/x-asm', |
|
| 850 | + 's3m' => 'audio/s3m', |
|
| 851 | + 'saf' => 'application/vnd.yamaha.smaf-audio', |
|
| 852 | + 'sass' => 'text/x-sass', |
|
| 853 | + 'sbml' => 'application/sbml+xml', |
|
| 854 | + 'sc' => 'application/vnd.ibm.secure-container', |
|
| 855 | + 'scd' => 'application/x-msschedule', |
|
| 856 | + 'scm' => 'application/vnd.lotus-screencam', |
|
| 857 | + 'scq' => 'application/scvp-cv-request', |
|
| 858 | + 'scs' => 'application/scvp-cv-response', |
|
| 859 | + 'scss' => 'text/x-scss', |
|
| 860 | + 'scurl' => 'text/vnd.curl.scurl', |
|
| 861 | + 'sda' => 'application/vnd.stardivision.draw', |
|
| 862 | + 'sdc' => 'application/vnd.stardivision.calc', |
|
| 863 | + 'sdd' => 'application/vnd.stardivision.impress', |
|
| 864 | + 'sdkd' => 'application/vnd.solent.sdkm+xml', |
|
| 865 | + 'sdkm' => 'application/vnd.solent.sdkm+xml', |
|
| 866 | + 'sdp' => 'application/sdp', |
|
| 867 | + 'sdw' => 'application/vnd.stardivision.writer', |
|
| 868 | + 'sea' => 'application/octet-stream', |
|
| 869 | + 'see' => 'application/vnd.seemail', |
|
| 870 | + 'seed' => 'application/vnd.fdsn.seed', |
|
| 871 | + 'sema' => 'application/vnd.sema', |
|
| 872 | + 'semd' => 'application/vnd.semd', |
|
| 873 | + 'semf' => 'application/vnd.semf', |
|
| 874 | + 'senmlx' => 'application/senml+xml', |
|
| 875 | + 'sensmlx' => 'application/sensml+xml', |
|
| 876 | + 'ser' => 'application/java-serialized-object', |
|
| 877 | + 'setpay' => 'application/set-payment-initiation', |
|
| 878 | + 'setreg' => 'application/set-registration-initiation', |
|
| 879 | + 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data', |
|
| 880 | + 'sfs' => 'application/vnd.spotfire.sfs', |
|
| 881 | + 'sfv' => 'text/x-sfv', |
|
| 882 | + 'sgi' => 'image/sgi', |
|
| 883 | + 'sgl' => 'application/vnd.stardivision.writer-global', |
|
| 884 | + 'sgm' => 'text/sgml', |
|
| 885 | + 'sgml' => 'text/sgml', |
|
| 886 | + 'sh' => 'application/x-sh', |
|
| 887 | + 'shar' => 'application/x-shar', |
|
| 888 | + 'shex' => 'text/shex', |
|
| 889 | + 'shf' => 'application/shf+xml', |
|
| 890 | + 'shtml' => 'text/html', |
|
| 891 | + 'sid' => 'image/x-mrsid-image', |
|
| 892 | + 'sieve' => 'application/sieve', |
|
| 893 | + 'sig' => 'application/pgp-signature', |
|
| 894 | + 'sil' => 'audio/silk', |
|
| 895 | + 'silo' => 'model/mesh', |
|
| 896 | + 'sis' => 'application/vnd.symbian.install', |
|
| 897 | + 'sisx' => 'application/vnd.symbian.install', |
|
| 898 | + 'sit' => 'application/x-stuffit', |
|
| 899 | + 'sitx' => 'application/x-stuffitx', |
|
| 900 | + 'siv' => 'application/sieve', |
|
| 901 | + 'skd' => 'application/vnd.koan', |
|
| 902 | + 'skm' => 'application/vnd.koan', |
|
| 903 | + 'skp' => 'application/vnd.koan', |
|
| 904 | + 'skt' => 'application/vnd.koan', |
|
| 905 | + 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12', |
|
| 906 | + 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', |
|
| 907 | + 'slim' => 'text/slim', |
|
| 908 | + 'slm' => 'text/slim', |
|
| 909 | + 'sls' => 'application/route-s-tsid+xml', |
|
| 910 | + 'slt' => 'application/vnd.epson.salt', |
|
| 911 | + 'sm' => 'application/vnd.stepmania.stepchart', |
|
| 912 | + 'smf' => 'application/vnd.stardivision.math', |
|
| 913 | + 'smi' => 'application/smil', |
|
| 914 | + 'smil' => 'application/smil', |
|
| 915 | + 'smv' => 'video/x-smv', |
|
| 916 | + 'smzip' => 'application/vnd.stepmania.package', |
|
| 917 | + 'snd' => 'audio/basic', |
|
| 918 | + 'snf' => 'application/x-font-snf', |
|
| 919 | + 'so' => 'application/octet-stream', |
|
| 920 | + 'spc' => 'application/x-pkcs7-certificates', |
|
| 921 | + 'spdx' => 'text/spdx', |
|
| 922 | + 'spf' => 'application/vnd.yamaha.smaf-phrase', |
|
| 923 | + 'spl' => 'application/x-futuresplash', |
|
| 924 | + 'spot' => 'text/vnd.in3d.spot', |
|
| 925 | + 'spp' => 'application/scvp-vp-response', |
|
| 926 | + 'spq' => 'application/scvp-vp-request', |
|
| 927 | + 'spx' => 'audio/ogg', |
|
| 928 | + 'sql' => 'application/x-sql', |
|
| 929 | + 'src' => 'application/x-wais-source', |
|
| 930 | + 'srt' => 'application/x-subrip', |
|
| 931 | + 'sru' => 'application/sru+xml', |
|
| 932 | + 'srx' => 'application/sparql-results+xml', |
|
| 933 | + 'ssdl' => 'application/ssdl+xml', |
|
| 934 | + 'sse' => 'application/vnd.kodak-descriptor', |
|
| 935 | + 'ssf' => 'application/vnd.epson.ssf', |
|
| 936 | + 'ssml' => 'application/ssml+xml', |
|
| 937 | + 'sst' => 'application/octet-stream', |
|
| 938 | + 'st' => 'application/vnd.sailingtracker.track', |
|
| 939 | + 'stc' => 'application/vnd.sun.xml.calc.template', |
|
| 940 | + 'std' => 'application/vnd.sun.xml.draw.template', |
|
| 941 | + 'step' => 'application/STEP', |
|
| 942 | + 'stf' => 'application/vnd.wt.stf', |
|
| 943 | + 'sti' => 'application/vnd.sun.xml.impress.template', |
|
| 944 | + 'stk' => 'application/hyperstudio', |
|
| 945 | + 'stl' => 'model/stl', |
|
| 946 | + 'stp' => 'application/STEP', |
|
| 947 | + 'stpx' => 'model/step+xml', |
|
| 948 | + 'stpxz' => 'model/step-xml+zip', |
|
| 949 | + 'stpz' => 'model/step+zip', |
|
| 950 | + 'str' => 'application/vnd.pg.format', |
|
| 951 | + 'stw' => 'application/vnd.sun.xml.writer.template', |
|
| 952 | + 'styl' => 'text/stylus', |
|
| 953 | + 'stylus' => 'text/stylus', |
|
| 954 | + 'sub' => 'text/vnd.dvb.subtitle', |
|
| 955 | + 'sus' => 'application/vnd.sus-calendar', |
|
| 956 | + 'susp' => 'application/vnd.sus-calendar', |
|
| 957 | + 'sv4cpio' => 'application/x-sv4cpio', |
|
| 958 | + 'sv4crc' => 'application/x-sv4crc', |
|
| 959 | + 'svc' => 'application/vnd.dvb.service', |
|
| 960 | + 'svd' => 'application/vnd.svd', |
|
| 961 | + 'svg' => 'image/svg+xml', |
|
| 962 | + 'svgz' => 'image/svg+xml', |
|
| 963 | + 'swa' => 'application/x-director', |
|
| 964 | + 'swf' => 'application/x-shockwave-flash', |
|
| 965 | + 'swi' => 'application/vnd.aristanetworks.swi', |
|
| 966 | + 'swidtag' => 'application/swid+xml', |
|
| 967 | + 'sxc' => 'application/vnd.sun.xml.calc', |
|
| 968 | + 'sxd' => 'application/vnd.sun.xml.draw', |
|
| 969 | + 'sxg' => 'application/vnd.sun.xml.writer.global', |
|
| 970 | + 'sxi' => 'application/vnd.sun.xml.impress', |
|
| 971 | + 'sxm' => 'application/vnd.sun.xml.math', |
|
| 972 | + 'sxw' => 'application/vnd.sun.xml.writer', |
|
| 973 | + 't' => 'text/troff', |
|
| 974 | + 't3' => 'application/x-t3vm-image', |
|
| 975 | + 't38' => 'image/t38', |
|
| 976 | + 'taglet' => 'application/vnd.mynfc', |
|
| 977 | + 'tao' => 'application/vnd.tao.intent-module-archive', |
|
| 978 | + 'tap' => 'image/vnd.tencent.tap', |
|
| 979 | + 'tar' => 'application/x-tar', |
|
| 980 | + 'tcap' => 'application/vnd.3gpp2.tcap', |
|
| 981 | + 'tcl' => 'application/x-tcl', |
|
| 982 | + 'td' => 'application/urc-targetdesc+xml', |
|
| 983 | + 'teacher' => 'application/vnd.smart.teacher', |
|
| 984 | + 'tei' => 'application/tei+xml', |
|
| 985 | + 'teicorpus' => 'application/tei+xml', |
|
| 986 | + 'tex' => 'application/x-tex', |
|
| 987 | + 'texi' => 'application/x-texinfo', |
|
| 988 | + 'texinfo' => 'application/x-texinfo', |
|
| 989 | + 'text' => 'text/plain', |
|
| 990 | + 'tfi' => 'application/thraud+xml', |
|
| 991 | + 'tfm' => 'application/x-tex-tfm', |
|
| 992 | + 'tfx' => 'image/tiff-fx', |
|
| 993 | + 'tga' => 'image/x-tga', |
|
| 994 | + 'tgz' => 'application/x-tar', |
|
| 995 | + 'thmx' => 'application/vnd.ms-officetheme', |
|
| 996 | + 'tif' => 'image/tiff', |
|
| 997 | + 'tiff' => 'image/tiff', |
|
| 998 | + 'tk' => 'application/x-tcl', |
|
| 999 | + 'tmo' => 'application/vnd.tmobile-livetv', |
|
| 1000 | + 'toml' => 'application/toml', |
|
| 1001 | + 'torrent' => 'application/x-bittorrent', |
|
| 1002 | + 'tpl' => 'application/vnd.groove-tool-template', |
|
| 1003 | + 'tpt' => 'application/vnd.trid.tpt', |
|
| 1004 | + 'tr' => 'text/troff', |
|
| 1005 | + 'tra' => 'application/vnd.trueapp', |
|
| 1006 | + 'trig' => 'application/trig', |
|
| 1007 | + 'trm' => 'application/x-msterminal', |
|
| 1008 | + 'ts' => 'video/mp2t', |
|
| 1009 | + 'tsd' => 'application/timestamped-data', |
|
| 1010 | + 'tsv' => 'text/tab-separated-values', |
|
| 1011 | + 'ttc' => 'font/collection', |
|
| 1012 | + 'ttf' => 'font/ttf', |
|
| 1013 | + 'ttl' => 'text/turtle', |
|
| 1014 | + 'ttml' => 'application/ttml+xml', |
|
| 1015 | + 'twd' => 'application/vnd.simtech-mindmapper', |
|
| 1016 | + 'twds' => 'application/vnd.simtech-mindmapper', |
|
| 1017 | + 'txd' => 'application/vnd.genomatix.tuxedo', |
|
| 1018 | + 'txf' => 'application/vnd.mobius.txf', |
|
| 1019 | + 'txt' => 'text/plain', |
|
| 1020 | + 'u3d' => 'model/u3d', |
|
| 1021 | + 'u8dsn' => 'message/global-delivery-status', |
|
| 1022 | + 'u8hdr' => 'message/global-headers', |
|
| 1023 | + 'u8mdn' => 'message/global-disposition-notification', |
|
| 1024 | + 'u8msg' => 'message/global', |
|
| 1025 | + 'u32' => 'application/x-authorware-bin', |
|
| 1026 | + 'ubj' => 'application/ubjson', |
|
| 1027 | + 'udeb' => 'application/x-debian-package', |
|
| 1028 | + 'ufd' => 'application/vnd.ufdl', |
|
| 1029 | + 'ufdl' => 'application/vnd.ufdl', |
|
| 1030 | + 'ulx' => 'application/x-glulx', |
|
| 1031 | + 'umj' => 'application/vnd.umajin', |
|
| 1032 | + 'unityweb' => 'application/vnd.unity', |
|
| 1033 | + 'uo' => 'application/vnd.uoml+xml', |
|
| 1034 | + 'uoml' => 'application/vnd.uoml+xml', |
|
| 1035 | + 'uri' => 'text/uri-list', |
|
| 1036 | + 'uris' => 'text/uri-list', |
|
| 1037 | + 'urls' => 'text/uri-list', |
|
| 1038 | + 'usda' => 'model/vnd.usda', |
|
| 1039 | + 'usdz' => 'model/vnd.usdz+zip', |
|
| 1040 | + 'ustar' => 'application/x-ustar', |
|
| 1041 | + 'utz' => 'application/vnd.uiq.theme', |
|
| 1042 | + 'uu' => 'text/x-uuencode', |
|
| 1043 | + 'uva' => 'audio/vnd.dece.audio', |
|
| 1044 | + 'uvd' => 'application/vnd.dece.data', |
|
| 1045 | + 'uvf' => 'application/vnd.dece.data', |
|
| 1046 | + 'uvg' => 'image/vnd.dece.graphic', |
|
| 1047 | + 'uvh' => 'video/vnd.dece.hd', |
|
| 1048 | + 'uvi' => 'image/vnd.dece.graphic', |
|
| 1049 | + 'uvm' => 'video/vnd.dece.mobile', |
|
| 1050 | + 'uvp' => 'video/vnd.dece.pd', |
|
| 1051 | + 'uvs' => 'video/vnd.dece.sd', |
|
| 1052 | + 'uvt' => 'application/vnd.dece.ttml+xml', |
|
| 1053 | + 'uvu' => 'video/vnd.uvvu.mp4', |
|
| 1054 | + 'uvv' => 'video/vnd.dece.video', |
|
| 1055 | + 'uvva' => 'audio/vnd.dece.audio', |
|
| 1056 | + 'uvvd' => 'application/vnd.dece.data', |
|
| 1057 | + 'uvvf' => 'application/vnd.dece.data', |
|
| 1058 | + 'uvvg' => 'image/vnd.dece.graphic', |
|
| 1059 | + 'uvvh' => 'video/vnd.dece.hd', |
|
| 1060 | + 'uvvi' => 'image/vnd.dece.graphic', |
|
| 1061 | + 'uvvm' => 'video/vnd.dece.mobile', |
|
| 1062 | + 'uvvp' => 'video/vnd.dece.pd', |
|
| 1063 | + 'uvvs' => 'video/vnd.dece.sd', |
|
| 1064 | + 'uvvt' => 'application/vnd.dece.ttml+xml', |
|
| 1065 | + 'uvvu' => 'video/vnd.uvvu.mp4', |
|
| 1066 | + 'uvvv' => 'video/vnd.dece.video', |
|
| 1067 | + 'uvvx' => 'application/vnd.dece.unspecified', |
|
| 1068 | + 'uvvz' => 'application/vnd.dece.zip', |
|
| 1069 | + 'uvx' => 'application/vnd.dece.unspecified', |
|
| 1070 | + 'uvz' => 'application/vnd.dece.zip', |
|
| 1071 | + 'vbox' => 'application/x-virtualbox-vbox', |
|
| 1072 | + 'vbox-extpack' => 'application/x-virtualbox-vbox-extpack', |
|
| 1073 | + 'vcard' => 'text/vcard', |
|
| 1074 | + 'vcd' => 'application/x-cdlink', |
|
| 1075 | + 'vcf' => 'text/x-vcard', |
|
| 1076 | + 'vcg' => 'application/vnd.groove-vcard', |
|
| 1077 | + 'vcs' => 'text/x-vcalendar', |
|
| 1078 | + 'vcx' => 'application/vnd.vcx', |
|
| 1079 | + 'vdi' => 'application/x-virtualbox-vdi', |
|
| 1080 | + 'vds' => 'model/vnd.sap.vds', |
|
| 1081 | + 'vhd' => 'application/x-virtualbox-vhd', |
|
| 1082 | + 'vis' => 'application/vnd.visionary', |
|
| 1083 | + 'viv' => 'video/vnd.vivo', |
|
| 1084 | + 'vlc' => 'application/videolan', |
|
| 1085 | + 'vmdk' => 'application/x-virtualbox-vmdk', |
|
| 1086 | + 'vob' => 'video/x-ms-vob', |
|
| 1087 | + 'vor' => 'application/vnd.stardivision.writer', |
|
| 1088 | + 'vox' => 'application/x-authorware-bin', |
|
| 1089 | + 'vrml' => 'model/vrml', |
|
| 1090 | + 'vsd' => 'application/vnd.visio', |
|
| 1091 | + 'vsf' => 'application/vnd.vsf', |
|
| 1092 | + 'vss' => 'application/vnd.visio', |
|
| 1093 | + 'vst' => 'application/vnd.visio', |
|
| 1094 | + 'vsw' => 'application/vnd.visio', |
|
| 1095 | + 'vtf' => 'image/vnd.valve.source.texture', |
|
| 1096 | + 'vtt' => 'text/vtt', |
|
| 1097 | + 'vtu' => 'model/vnd.vtu', |
|
| 1098 | + 'vxml' => 'application/voicexml+xml', |
|
| 1099 | + 'w3d' => 'application/x-director', |
|
| 1100 | + 'wad' => 'application/x-doom', |
|
| 1101 | + 'wadl' => 'application/vnd.sun.wadl+xml', |
|
| 1102 | + 'war' => 'application/java-archive', |
|
| 1103 | + 'wasm' => 'application/wasm', |
|
| 1104 | + 'wav' => 'audio/x-wav', |
|
| 1105 | + 'wax' => 'audio/x-ms-wax', |
|
| 1106 | + 'wbmp' => 'image/vnd.wap.wbmp', |
|
| 1107 | + 'wbs' => 'application/vnd.criticaltools.wbs+xml', |
|
| 1108 | + 'wbxml' => 'application/wbxml', |
|
| 1109 | + 'wcm' => 'application/vnd.ms-works', |
|
| 1110 | + 'wdb' => 'application/vnd.ms-works', |
|
| 1111 | + 'wdp' => 'image/vnd.ms-photo', |
|
| 1112 | + 'weba' => 'audio/webm', |
|
| 1113 | + 'webapp' => 'application/x-web-app-manifest+json', |
|
| 1114 | + 'webm' => 'video/webm', |
|
| 1115 | + 'webmanifest' => 'application/manifest+json', |
|
| 1116 | + 'webp' => 'image/webp', |
|
| 1117 | + 'wg' => 'application/vnd.pmi.widget', |
|
| 1118 | + 'wgsl' => 'text/wgsl', |
|
| 1119 | + 'wgt' => 'application/widget', |
|
| 1120 | + 'wif' => 'application/watcherinfo+xml', |
|
| 1121 | + 'wks' => 'application/vnd.ms-works', |
|
| 1122 | + 'wm' => 'video/x-ms-wm', |
|
| 1123 | + 'wma' => 'audio/x-ms-wma', |
|
| 1124 | + 'wmd' => 'application/x-ms-wmd', |
|
| 1125 | + 'wmf' => 'image/wmf', |
|
| 1126 | + 'wml' => 'text/vnd.wap.wml', |
|
| 1127 | + 'wmlc' => 'application/wmlc', |
|
| 1128 | + 'wmls' => 'text/vnd.wap.wmlscript', |
|
| 1129 | + 'wmlsc' => 'application/vnd.wap.wmlscriptc', |
|
| 1130 | + 'wmv' => 'video/x-ms-wmv', |
|
| 1131 | + 'wmx' => 'video/x-ms-wmx', |
|
| 1132 | + 'wmz' => 'application/x-msmetafile', |
|
| 1133 | + 'woff' => 'font/woff', |
|
| 1134 | + 'woff2' => 'font/woff2', |
|
| 1135 | + 'word' => 'application/msword', |
|
| 1136 | + 'wpd' => 'application/vnd.wordperfect', |
|
| 1137 | + 'wpl' => 'application/vnd.ms-wpl', |
|
| 1138 | + 'wps' => 'application/vnd.ms-works', |
|
| 1139 | + 'wqd' => 'application/vnd.wqd', |
|
| 1140 | + 'wri' => 'application/x-mswrite', |
|
| 1141 | + 'wrl' => 'model/vrml', |
|
| 1142 | + 'wsc' => 'message/vnd.wfa.wsc', |
|
| 1143 | + 'wsdl' => 'application/wsdl+xml', |
|
| 1144 | + 'wspolicy' => 'application/wspolicy+xml', |
|
| 1145 | + 'wtb' => 'application/vnd.webturbo', |
|
| 1146 | + 'wvx' => 'video/x-ms-wvx', |
|
| 1147 | + 'x3d' => 'model/x3d+xml', |
|
| 1148 | + 'x3db' => 'model/x3d+fastinfoset', |
|
| 1149 | + 'x3dbz' => 'model/x3d+binary', |
|
| 1150 | + 'x3dv' => 'model/x3d-vrml', |
|
| 1151 | + 'x3dvz' => 'model/x3d+vrml', |
|
| 1152 | + 'x3dz' => 'model/x3d+xml', |
|
| 1153 | + 'x32' => 'application/x-authorware-bin', |
|
| 1154 | + 'x_b' => 'model/vnd.parasolid.transmit.binary', |
|
| 1155 | + 'x_t' => 'model/vnd.parasolid.transmit.text', |
|
| 1156 | + 'xaml' => 'application/xaml+xml', |
|
| 1157 | + 'xap' => 'application/x-silverlight-app', |
|
| 1158 | + 'xar' => 'application/vnd.xara', |
|
| 1159 | + 'xav' => 'application/xcap-att+xml', |
|
| 1160 | + 'xbap' => 'application/x-ms-xbap', |
|
| 1161 | + 'xbd' => 'application/vnd.fujixerox.docuworks.binder', |
|
| 1162 | + 'xbm' => 'image/x-xbitmap', |
|
| 1163 | + 'xca' => 'application/xcap-caps+xml', |
|
| 1164 | + 'xcs' => 'application/calendar+xml', |
|
| 1165 | + 'xdf' => 'application/xcap-diff+xml', |
|
| 1166 | + 'xdm' => 'application/vnd.syncml.dm+xml', |
|
| 1167 | + 'xdp' => 'application/vnd.adobe.xdp+xml', |
|
| 1168 | + 'xdssc' => 'application/dssc+xml', |
|
| 1169 | + 'xdw' => 'application/vnd.fujixerox.docuworks', |
|
| 1170 | + 'xel' => 'application/xcap-el+xml', |
|
| 1171 | + 'xenc' => 'application/xenc+xml', |
|
| 1172 | + 'xer' => 'application/patch-ops-error+xml', |
|
| 1173 | + 'xfdf' => 'application/xfdf', |
|
| 1174 | + 'xfdl' => 'application/vnd.xfdl', |
|
| 1175 | + 'xht' => 'application/xhtml+xml', |
|
| 1176 | + 'xhtm' => 'application/vnd.pwg-xhtml-print+xml', |
|
| 1177 | + 'xhtml' => 'application/xhtml+xml', |
|
| 1178 | + 'xhvml' => 'application/xv+xml', |
|
| 1179 | + 'xif' => 'image/vnd.xiff', |
|
| 1180 | + 'xl' => 'application/excel', |
|
| 1181 | + 'xla' => 'application/vnd.ms-excel', |
|
| 1182 | + 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', |
|
| 1183 | + 'xlc' => 'application/vnd.ms-excel', |
|
| 1184 | + 'xlf' => 'application/xliff+xml', |
|
| 1185 | + 'xlm' => 'application/vnd.ms-excel', |
|
| 1186 | + 'xls' => 'application/vnd.ms-excel', |
|
| 1187 | + 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', |
|
| 1188 | + 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', |
|
| 1189 | + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', |
|
| 1190 | + 'xlt' => 'application/vnd.ms-excel', |
|
| 1191 | + 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', |
|
| 1192 | + 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', |
|
| 1193 | + 'xlw' => 'application/vnd.ms-excel', |
|
| 1194 | + 'xm' => 'audio/xm', |
|
| 1195 | + 'xml' => 'application/xml', |
|
| 1196 | + 'xns' => 'application/xcap-ns+xml', |
|
| 1197 | + 'xo' => 'application/vnd.olpc-sugar', |
|
| 1198 | + 'xop' => 'application/xop+xml', |
|
| 1199 | + 'xpi' => 'application/x-xpinstall', |
|
| 1200 | + 'xpl' => 'application/xproc+xml', |
|
| 1201 | + 'xpm' => 'image/x-xpixmap', |
|
| 1202 | + 'xpr' => 'application/vnd.is-xpr', |
|
| 1203 | + 'xps' => 'application/vnd.ms-xpsdocument', |
|
| 1204 | + 'xpw' => 'application/vnd.intercon.formnet', |
|
| 1205 | + 'xpx' => 'application/vnd.intercon.formnet', |
|
| 1206 | + 'xsd' => 'application/xml', |
|
| 1207 | + 'xsf' => 'application/prs.xsf+xml', |
|
| 1208 | + 'xsl' => 'application/xml', |
|
| 1209 | + 'xslt' => 'application/xslt+xml', |
|
| 1210 | + 'xsm' => 'application/vnd.syncml+xml', |
|
| 1211 | + 'xspf' => 'application/xspf+xml', |
|
| 1212 | + 'xul' => 'application/vnd.mozilla.xul+xml', |
|
| 1213 | + 'xvm' => 'application/xv+xml', |
|
| 1214 | + 'xvml' => 'application/xv+xml', |
|
| 1215 | + 'xwd' => 'image/x-xwindowdump', |
|
| 1216 | + 'xyz' => 'chemical/x-xyz', |
|
| 1217 | + 'xz' => 'application/x-xz', |
|
| 1218 | + 'yaml' => 'text/yaml', |
|
| 1219 | + 'yang' => 'application/yang', |
|
| 1220 | + 'yin' => 'application/yin+xml', |
|
| 1221 | + 'yml' => 'text/yaml', |
|
| 1222 | + 'ymp' => 'text/x-suse-ymp', |
|
| 1223 | + 'z' => 'application/x-compress', |
|
| 1224 | + 'z1' => 'application/x-zmachine', |
|
| 1225 | + 'z2' => 'application/x-zmachine', |
|
| 1226 | + 'z3' => 'application/x-zmachine', |
|
| 1227 | + 'z4' => 'application/x-zmachine', |
|
| 1228 | + 'z5' => 'application/x-zmachine', |
|
| 1229 | + 'z6' => 'application/x-zmachine', |
|
| 1230 | + 'z7' => 'application/x-zmachine', |
|
| 1231 | + 'z8' => 'application/x-zmachine', |
|
| 1232 | + 'zaz' => 'application/vnd.zzazz.deck+xml', |
|
| 1233 | + 'zip' => 'application/zip', |
|
| 1234 | + 'zir' => 'application/vnd.zul', |
|
| 1235 | + 'zirz' => 'application/vnd.zul', |
|
| 1236 | + 'zmm' => 'application/vnd.handheld-entertainment+xml', |
|
| 1237 | + 'zsh' => 'text/x-scriptzsh', |
|
| 1238 | + ]; |
|
| 1239 | 1239 | |
| 1240 | - /** |
|
| 1241 | - * Determines the mimetype of a file by looking at its extension. |
|
| 1242 | - * |
|
| 1243 | - * @see https://raw.githubusercontent.com/jshttp/mime-db/master/db.json |
|
| 1244 | - */ |
|
| 1245 | - public static function fromFilename(string $filename): ?string |
|
| 1246 | - { |
|
| 1247 | - return self::fromExtension(pathinfo($filename, PATHINFO_EXTENSION)); |
|
| 1248 | - } |
|
| 1240 | + /** |
|
| 1241 | + * Determines the mimetype of a file by looking at its extension. |
|
| 1242 | + * |
|
| 1243 | + * @see https://raw.githubusercontent.com/jshttp/mime-db/master/db.json |
|
| 1244 | + */ |
|
| 1245 | + public static function fromFilename(string $filename): ?string |
|
| 1246 | + { |
|
| 1247 | + return self::fromExtension(pathinfo($filename, PATHINFO_EXTENSION)); |
|
| 1248 | + } |
|
| 1249 | 1249 | |
| 1250 | - /** |
|
| 1251 | - * Maps a file extensions to a mimetype. |
|
| 1252 | - * |
|
| 1253 | - * @see https://raw.githubusercontent.com/jshttp/mime-db/master/db.json |
|
| 1254 | - */ |
|
| 1255 | - public static function fromExtension(string $extension): ?string |
|
| 1256 | - { |
|
| 1257 | - return self::MIME_TYPES[strtolower($extension)] ?? null; |
|
| 1258 | - } |
|
| 1250 | + /** |
|
| 1251 | + * Maps a file extensions to a mimetype. |
|
| 1252 | + * |
|
| 1253 | + * @see https://raw.githubusercontent.com/jshttp/mime-db/master/db.json |
|
| 1254 | + */ |
|
| 1255 | + public static function fromExtension(string $extension): ?string |
|
| 1256 | + { |
|
| 1257 | + return self::MIME_TYPES[strtolower($extension)] ?? null; |
|
| 1258 | + } |
|
| 1259 | 1259 | } |
@@ -4,8 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\GuzzleHttp\Psr7; |
| 6 | 6 | |
| 7 | -final class MimeType |
|
| 8 | -{ |
|
| 7 | +final class MimeType { |
|
| 9 | 8 | private const MIME_TYPES = [ |
| 10 | 9 | '1km' => 'application/vnd.1000minds.decision-model+xml', |
| 11 | 10 | '3dml' => 'text/vnd.in3d.3dml', |
@@ -18,162 +18,162 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | final class PumpStream implements StreamInterface |
| 20 | 20 | { |
| 21 | - /** @var callable(int): (string|false|null)|null */ |
|
| 22 | - private $source; |
|
| 23 | - |
|
| 24 | - /** @var int|null */ |
|
| 25 | - private $size; |
|
| 26 | - |
|
| 27 | - /** @var int */ |
|
| 28 | - private $tellPos = 0; |
|
| 29 | - |
|
| 30 | - /** @var array */ |
|
| 31 | - private $metadata; |
|
| 32 | - |
|
| 33 | - /** @var BufferStream */ |
|
| 34 | - private $buffer; |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * @param callable(int): (string|false|null) $source Source of the stream data. The callable MAY |
|
| 38 | - * accept an integer argument used to control the |
|
| 39 | - * amount of data to return. The callable MUST |
|
| 40 | - * return a string when called, or false|null on error |
|
| 41 | - * or EOF. |
|
| 42 | - * @param array{size?: int, metadata?: array} $options Stream options: |
|
| 43 | - * - metadata: Hash of metadata to use with stream. |
|
| 44 | - * - size: Size of the stream, if known. |
|
| 45 | - */ |
|
| 46 | - public function __construct(callable $source, array $options = []) |
|
| 47 | - { |
|
| 48 | - $this->source = $source; |
|
| 49 | - $this->size = $options['size'] ?? null; |
|
| 50 | - $this->metadata = $options['metadata'] ?? []; |
|
| 51 | - $this->buffer = new BufferStream(); |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - public function __toString(): string |
|
| 55 | - { |
|
| 56 | - try { |
|
| 57 | - return Utils::copyToString($this); |
|
| 58 | - } catch (\Throwable $e) { |
|
| 59 | - if (\PHP_VERSION_ID >= 70400) { |
|
| 60 | - throw $e; |
|
| 61 | - } |
|
| 62 | - trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); |
|
| 63 | - |
|
| 64 | - return ''; |
|
| 65 | - } |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - public function close(): void |
|
| 69 | - { |
|
| 70 | - $this->detach(); |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - public function detach() |
|
| 74 | - { |
|
| 75 | - $this->tellPos = 0; |
|
| 76 | - $this->source = null; |
|
| 77 | - |
|
| 78 | - return null; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - public function getSize(): ?int |
|
| 82 | - { |
|
| 83 | - return $this->size; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - public function tell(): int |
|
| 87 | - { |
|
| 88 | - return $this->tellPos; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - public function eof(): bool |
|
| 92 | - { |
|
| 93 | - return $this->source === null; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - public function isSeekable(): bool |
|
| 97 | - { |
|
| 98 | - return false; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - public function rewind(): void |
|
| 102 | - { |
|
| 103 | - $this->seek(0); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - public function seek($offset, $whence = SEEK_SET): void |
|
| 107 | - { |
|
| 108 | - throw new \RuntimeException('Cannot seek a PumpStream'); |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - public function isWritable(): bool |
|
| 112 | - { |
|
| 113 | - return false; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - public function write($string): int |
|
| 117 | - { |
|
| 118 | - throw new \RuntimeException('Cannot write to a PumpStream'); |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - public function isReadable(): bool |
|
| 122 | - { |
|
| 123 | - return true; |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - public function read($length): string |
|
| 127 | - { |
|
| 128 | - $data = $this->buffer->read($length); |
|
| 129 | - $readLen = strlen($data); |
|
| 130 | - $this->tellPos += $readLen; |
|
| 131 | - $remaining = $length - $readLen; |
|
| 132 | - |
|
| 133 | - if ($remaining) { |
|
| 134 | - $this->pump($remaining); |
|
| 135 | - $data .= $this->buffer->read($remaining); |
|
| 136 | - $this->tellPos += strlen($data) - $readLen; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - return $data; |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - public function getContents(): string |
|
| 143 | - { |
|
| 144 | - $result = ''; |
|
| 145 | - while (!$this->eof()) { |
|
| 146 | - $result .= $this->read(1000000); |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - return $result; |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * @return mixed |
|
| 154 | - */ |
|
| 155 | - public function getMetadata($key = null) |
|
| 156 | - { |
|
| 157 | - if (!$key) { |
|
| 158 | - return $this->metadata; |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - return $this->metadata[$key] ?? null; |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - private function pump(int $length): void |
|
| 165 | - { |
|
| 166 | - if ($this->source !== null) { |
|
| 167 | - do { |
|
| 168 | - $data = ($this->source)($length); |
|
| 169 | - if ($data === false || $data === null) { |
|
| 170 | - $this->source = null; |
|
| 171 | - |
|
| 172 | - return; |
|
| 173 | - } |
|
| 174 | - $this->buffer->write($data); |
|
| 175 | - $length -= strlen($data); |
|
| 176 | - } while ($length > 0); |
|
| 177 | - } |
|
| 178 | - } |
|
| 21 | + /** @var callable(int): (string|false|null)|null */ |
|
| 22 | + private $source; |
|
| 23 | + |
|
| 24 | + /** @var int|null */ |
|
| 25 | + private $size; |
|
| 26 | + |
|
| 27 | + /** @var int */ |
|
| 28 | + private $tellPos = 0; |
|
| 29 | + |
|
| 30 | + /** @var array */ |
|
| 31 | + private $metadata; |
|
| 32 | + |
|
| 33 | + /** @var BufferStream */ |
|
| 34 | + private $buffer; |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * @param callable(int): (string|false|null) $source Source of the stream data. The callable MAY |
|
| 38 | + * accept an integer argument used to control the |
|
| 39 | + * amount of data to return. The callable MUST |
|
| 40 | + * return a string when called, or false|null on error |
|
| 41 | + * or EOF. |
|
| 42 | + * @param array{size?: int, metadata?: array} $options Stream options: |
|
| 43 | + * - metadata: Hash of metadata to use with stream. |
|
| 44 | + * - size: Size of the stream, if known. |
|
| 45 | + */ |
|
| 46 | + public function __construct(callable $source, array $options = []) |
|
| 47 | + { |
|
| 48 | + $this->source = $source; |
|
| 49 | + $this->size = $options['size'] ?? null; |
|
| 50 | + $this->metadata = $options['metadata'] ?? []; |
|
| 51 | + $this->buffer = new BufferStream(); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + public function __toString(): string |
|
| 55 | + { |
|
| 56 | + try { |
|
| 57 | + return Utils::copyToString($this); |
|
| 58 | + } catch (\Throwable $e) { |
|
| 59 | + if (\PHP_VERSION_ID >= 70400) { |
|
| 60 | + throw $e; |
|
| 61 | + } |
|
| 62 | + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); |
|
| 63 | + |
|
| 64 | + return ''; |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + public function close(): void |
|
| 69 | + { |
|
| 70 | + $this->detach(); |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + public function detach() |
|
| 74 | + { |
|
| 75 | + $this->tellPos = 0; |
|
| 76 | + $this->source = null; |
|
| 77 | + |
|
| 78 | + return null; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + public function getSize(): ?int |
|
| 82 | + { |
|
| 83 | + return $this->size; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + public function tell(): int |
|
| 87 | + { |
|
| 88 | + return $this->tellPos; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + public function eof(): bool |
|
| 92 | + { |
|
| 93 | + return $this->source === null; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + public function isSeekable(): bool |
|
| 97 | + { |
|
| 98 | + return false; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + public function rewind(): void |
|
| 102 | + { |
|
| 103 | + $this->seek(0); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + public function seek($offset, $whence = SEEK_SET): void |
|
| 107 | + { |
|
| 108 | + throw new \RuntimeException('Cannot seek a PumpStream'); |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + public function isWritable(): bool |
|
| 112 | + { |
|
| 113 | + return false; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + public function write($string): int |
|
| 117 | + { |
|
| 118 | + throw new \RuntimeException('Cannot write to a PumpStream'); |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + public function isReadable(): bool |
|
| 122 | + { |
|
| 123 | + return true; |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + public function read($length): string |
|
| 127 | + { |
|
| 128 | + $data = $this->buffer->read($length); |
|
| 129 | + $readLen = strlen($data); |
|
| 130 | + $this->tellPos += $readLen; |
|
| 131 | + $remaining = $length - $readLen; |
|
| 132 | + |
|
| 133 | + if ($remaining) { |
|
| 134 | + $this->pump($remaining); |
|
| 135 | + $data .= $this->buffer->read($remaining); |
|
| 136 | + $this->tellPos += strlen($data) - $readLen; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + return $data; |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + public function getContents(): string |
|
| 143 | + { |
|
| 144 | + $result = ''; |
|
| 145 | + while (!$this->eof()) { |
|
| 146 | + $result .= $this->read(1000000); |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + return $result; |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * @return mixed |
|
| 154 | + */ |
|
| 155 | + public function getMetadata($key = null) |
|
| 156 | + { |
|
| 157 | + if (!$key) { |
|
| 158 | + return $this->metadata; |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + return $this->metadata[$key] ?? null; |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + private function pump(int $length): void |
|
| 165 | + { |
|
| 166 | + if ($this->source !== null) { |
|
| 167 | + do { |
|
| 168 | + $data = ($this->source)($length); |
|
| 169 | + if ($data === false || $data === null) { |
|
| 170 | + $this->source = null; |
|
| 171 | + |
|
| 172 | + return; |
|
| 173 | + } |
|
| 174 | + $this->buffer->write($data); |
|
| 175 | + $length -= strlen($data); |
|
| 176 | + } while ($length > 0); |
|
| 177 | + } |
|
| 178 | + } |
|
| 179 | 179 | } |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | if (\PHP_VERSION_ID >= 70400) { |
| 60 | 60 | throw $e; |
| 61 | 61 | } |
| 62 | - trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); |
|
| 62 | + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string)$e), E_USER_ERROR); |
|
| 63 | 63 | |
| 64 | 64 | return ''; |
| 65 | 65 | } |
@@ -16,8 +16,7 @@ |
||
| 16 | 16 | * the read() function of the PumpStream. The provided callable MUST return |
| 17 | 17 | * false when there is no more data to read. |
| 18 | 18 | */ |
| 19 | -final class PumpStream implements StreamInterface |
|
| 20 | -{ |
|
| 19 | +final class PumpStream implements StreamInterface { |
|
| 21 | 20 | /** @var callable(int): (string|false|null)|null */ |
| 22 | 21 | private $source; |
| 23 | 22 | |
@@ -9,15 +9,15 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | final class Rfc7230 |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * Header related regular expressions (based on amphp/http package) |
|
| 14 | - * |
|
| 15 | - * Note: header delimiter (\r\n) is modified to \r?\n to accept line feed only delimiters for BC reasons. |
|
| 16 | - * |
|
| 17 | - * @see https://github.com/amphp/http/blob/v1.0.1/src/Rfc7230.php#L12-L15 |
|
| 18 | - * |
|
| 19 | - * @license https://github.com/amphp/http/blob/v1.0.1/LICENSE |
|
| 20 | - */ |
|
| 21 | - public const HEADER_REGEX = "(^([^()<>@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m"; |
|
| 22 | - public const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)"; |
|
| 12 | + /** |
|
| 13 | + * Header related regular expressions (based on amphp/http package) |
|
| 14 | + * |
|
| 15 | + * Note: header delimiter (\r\n) is modified to \r?\n to accept line feed only delimiters for BC reasons. |
|
| 16 | + * |
|
| 17 | + * @see https://github.com/amphp/http/blob/v1.0.1/src/Rfc7230.php#L12-L15 |
|
| 18 | + * |
|
| 19 | + * @license https://github.com/amphp/http/blob/v1.0.1/LICENSE |
|
| 20 | + */ |
|
| 21 | + public const HEADER_REGEX = "(^([^()<>@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m"; |
|
| 22 | + public const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)"; |
|
| 23 | 23 | } |
@@ -7,8 +7,7 @@ |
||
| 7 | 7 | /** |
| 8 | 8 | * @internal |
| 9 | 9 | */ |
| 10 | -final class Rfc7230 |
|
| 11 | -{ |
|
| 10 | +final class Rfc7230 { |
|
| 12 | 11 | /** |
| 13 | 12 | * Header related regular expressions (based on amphp/http package) |
| 14 | 13 | * |
@@ -12,38 +12,38 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | final class DroppingStream implements StreamInterface |
| 14 | 14 | { |
| 15 | - use StreamDecoratorTrait; |
|
| 16 | - |
|
| 17 | - /** @var int */ |
|
| 18 | - private $maxLength; |
|
| 19 | - |
|
| 20 | - /** @var StreamInterface */ |
|
| 21 | - private $stream; |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * @param StreamInterface $stream Underlying stream to decorate. |
|
| 25 | - * @param int $maxLength Maximum size before dropping data. |
|
| 26 | - */ |
|
| 27 | - public function __construct(StreamInterface $stream, int $maxLength) |
|
| 28 | - { |
|
| 29 | - $this->stream = $stream; |
|
| 30 | - $this->maxLength = $maxLength; |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - public function write($string): int |
|
| 34 | - { |
|
| 35 | - $diff = $this->maxLength - $this->stream->getSize(); |
|
| 36 | - |
|
| 37 | - // Begin returning 0 when the underlying stream is too large. |
|
| 38 | - if ($diff <= 0) { |
|
| 39 | - return 0; |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - // Write the stream or a subset of the stream if needed. |
|
| 43 | - if (strlen($string) < $diff) { |
|
| 44 | - return $this->stream->write($string); |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - return $this->stream->write(substr($string, 0, $diff)); |
|
| 48 | - } |
|
| 15 | + use StreamDecoratorTrait; |
|
| 16 | + |
|
| 17 | + /** @var int */ |
|
| 18 | + private $maxLength; |
|
| 19 | + |
|
| 20 | + /** @var StreamInterface */ |
|
| 21 | + private $stream; |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * @param StreamInterface $stream Underlying stream to decorate. |
|
| 25 | + * @param int $maxLength Maximum size before dropping data. |
|
| 26 | + */ |
|
| 27 | + public function __construct(StreamInterface $stream, int $maxLength) |
|
| 28 | + { |
|
| 29 | + $this->stream = $stream; |
|
| 30 | + $this->maxLength = $maxLength; |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + public function write($string): int |
|
| 34 | + { |
|
| 35 | + $diff = $this->maxLength - $this->stream->getSize(); |
|
| 36 | + |
|
| 37 | + // Begin returning 0 when the underlying stream is too large. |
|
| 38 | + if ($diff <= 0) { |
|
| 39 | + return 0; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + // Write the stream or a subset of the stream if needed. |
|
| 43 | + if (strlen($string) < $diff) { |
|
| 44 | + return $this->stream->write($string); |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + return $this->stream->write(substr($string, 0, $diff)); |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -10,8 +10,7 @@ |
||
| 10 | 10 | * Stream decorator that begins dropping data once the size of the underlying |
| 11 | 11 | * stream becomes too full. |
| 12 | 12 | */ |
| 13 | -final class DroppingStream implements StreamInterface |
|
| 14 | -{ |
|
| 13 | +final class DroppingStream implements StreamInterface { |
|
| 15 | 14 | use StreamDecoratorTrait; |
| 16 | 15 | |
| 17 | 16 | /** @var int */ |
@@ -6,129 +6,129 @@ |
||
| 6 | 6 | |
| 7 | 7 | final class Header |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Parse an array of header values containing ";" separated data into an |
|
| 11 | - * array of associative arrays representing the header key value pair data |
|
| 12 | - * of the header. When a parameter does not contain a value, but just |
|
| 13 | - * contains a key, this function will inject a key with a '' string value. |
|
| 14 | - * |
|
| 15 | - * @param string|array $header Header to parse into components. |
|
| 16 | - */ |
|
| 17 | - public static function parse($header): array |
|
| 18 | - { |
|
| 19 | - static $trimmed = "\"' \n\t\r"; |
|
| 20 | - $params = $matches = []; |
|
| 21 | - |
|
| 22 | - foreach ((array) $header as $value) { |
|
| 23 | - foreach (self::splitList($value) as $val) { |
|
| 24 | - $part = []; |
|
| 25 | - foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) ?: [] as $kvp) { |
|
| 26 | - if (preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) { |
|
| 27 | - $m = $matches[0]; |
|
| 28 | - if (isset($m[1])) { |
|
| 29 | - $part[trim($m[0], $trimmed)] = trim($m[1], $trimmed); |
|
| 30 | - } else { |
|
| 31 | - $part[] = trim($m[0], $trimmed); |
|
| 32 | - } |
|
| 33 | - } |
|
| 34 | - } |
|
| 35 | - if ($part) { |
|
| 36 | - $params[] = $part; |
|
| 37 | - } |
|
| 38 | - } |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - return $params; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Converts an array of header values that may contain comma separated |
|
| 46 | - * headers into an array of headers with no comma separated values. |
|
| 47 | - * |
|
| 48 | - * @param string|array $header Header to normalize. |
|
| 49 | - * |
|
| 50 | - * @deprecated Use self::splitList() instead. |
|
| 51 | - */ |
|
| 52 | - public static function normalize($header): array |
|
| 53 | - { |
|
| 54 | - $result = []; |
|
| 55 | - foreach ((array) $header as $value) { |
|
| 56 | - foreach (self::splitList($value) as $parsed) { |
|
| 57 | - $result[] = $parsed; |
|
| 58 | - } |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - return $result; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * Splits a HTTP header defined to contain a comma-separated list into |
|
| 66 | - * each individual value. Empty values will be removed. |
|
| 67 | - * |
|
| 68 | - * Example headers include 'accept', 'cache-control' and 'if-none-match'. |
|
| 69 | - * |
|
| 70 | - * This method must not be used to parse headers that are not defined as |
|
| 71 | - * a list, such as 'user-agent' or 'set-cookie'. |
|
| 72 | - * |
|
| 73 | - * @param string|string[] $values Header value as returned by MessageInterface::getHeader() |
|
| 74 | - * |
|
| 75 | - * @return string[] |
|
| 76 | - */ |
|
| 77 | - public static function splitList($values): array |
|
| 78 | - { |
|
| 79 | - if (!\is_array($values)) { |
|
| 80 | - $values = [$values]; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - $result = []; |
|
| 84 | - foreach ($values as $value) { |
|
| 85 | - if (!\is_string($value)) { |
|
| 86 | - throw new \TypeError('$header must either be a string or an array containing strings.'); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $v = ''; |
|
| 90 | - $isQuoted = false; |
|
| 91 | - $isEscaped = false; |
|
| 92 | - for ($i = 0, $max = \strlen($value); $i < $max; ++$i) { |
|
| 93 | - if ($isEscaped) { |
|
| 94 | - $v .= $value[$i]; |
|
| 95 | - $isEscaped = false; |
|
| 96 | - |
|
| 97 | - continue; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - if (!$isQuoted && $value[$i] === ',') { |
|
| 101 | - $v = \trim($v); |
|
| 102 | - if ($v !== '') { |
|
| 103 | - $result[] = $v; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - $v = ''; |
|
| 107 | - continue; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - if ($isQuoted && $value[$i] === '\\') { |
|
| 111 | - $isEscaped = true; |
|
| 112 | - $v .= $value[$i]; |
|
| 113 | - |
|
| 114 | - continue; |
|
| 115 | - } |
|
| 116 | - if ($value[$i] === '"') { |
|
| 117 | - $isQuoted = !$isQuoted; |
|
| 118 | - $v .= $value[$i]; |
|
| 119 | - |
|
| 120 | - continue; |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - $v .= $value[$i]; |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - $v = \trim($v); |
|
| 127 | - if ($v !== '') { |
|
| 128 | - $result[] = $v; |
|
| 129 | - } |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - return $result; |
|
| 133 | - } |
|
| 9 | + /** |
|
| 10 | + * Parse an array of header values containing ";" separated data into an |
|
| 11 | + * array of associative arrays representing the header key value pair data |
|
| 12 | + * of the header. When a parameter does not contain a value, but just |
|
| 13 | + * contains a key, this function will inject a key with a '' string value. |
|
| 14 | + * |
|
| 15 | + * @param string|array $header Header to parse into components. |
|
| 16 | + */ |
|
| 17 | + public static function parse($header): array |
|
| 18 | + { |
|
| 19 | + static $trimmed = "\"' \n\t\r"; |
|
| 20 | + $params = $matches = []; |
|
| 21 | + |
|
| 22 | + foreach ((array) $header as $value) { |
|
| 23 | + foreach (self::splitList($value) as $val) { |
|
| 24 | + $part = []; |
|
| 25 | + foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) ?: [] as $kvp) { |
|
| 26 | + if (preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) { |
|
| 27 | + $m = $matches[0]; |
|
| 28 | + if (isset($m[1])) { |
|
| 29 | + $part[trim($m[0], $trimmed)] = trim($m[1], $trimmed); |
|
| 30 | + } else { |
|
| 31 | + $part[] = trim($m[0], $trimmed); |
|
| 32 | + } |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | + if ($part) { |
|
| 36 | + $params[] = $part; |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + return $params; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Converts an array of header values that may contain comma separated |
|
| 46 | + * headers into an array of headers with no comma separated values. |
|
| 47 | + * |
|
| 48 | + * @param string|array $header Header to normalize. |
|
| 49 | + * |
|
| 50 | + * @deprecated Use self::splitList() instead. |
|
| 51 | + */ |
|
| 52 | + public static function normalize($header): array |
|
| 53 | + { |
|
| 54 | + $result = []; |
|
| 55 | + foreach ((array) $header as $value) { |
|
| 56 | + foreach (self::splitList($value) as $parsed) { |
|
| 57 | + $result[] = $parsed; |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + return $result; |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * Splits a HTTP header defined to contain a comma-separated list into |
|
| 66 | + * each individual value. Empty values will be removed. |
|
| 67 | + * |
|
| 68 | + * Example headers include 'accept', 'cache-control' and 'if-none-match'. |
|
| 69 | + * |
|
| 70 | + * This method must not be used to parse headers that are not defined as |
|
| 71 | + * a list, such as 'user-agent' or 'set-cookie'. |
|
| 72 | + * |
|
| 73 | + * @param string|string[] $values Header value as returned by MessageInterface::getHeader() |
|
| 74 | + * |
|
| 75 | + * @return string[] |
|
| 76 | + */ |
|
| 77 | + public static function splitList($values): array |
|
| 78 | + { |
|
| 79 | + if (!\is_array($values)) { |
|
| 80 | + $values = [$values]; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + $result = []; |
|
| 84 | + foreach ($values as $value) { |
|
| 85 | + if (!\is_string($value)) { |
|
| 86 | + throw new \TypeError('$header must either be a string or an array containing strings.'); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $v = ''; |
|
| 90 | + $isQuoted = false; |
|
| 91 | + $isEscaped = false; |
|
| 92 | + for ($i = 0, $max = \strlen($value); $i < $max; ++$i) { |
|
| 93 | + if ($isEscaped) { |
|
| 94 | + $v .= $value[$i]; |
|
| 95 | + $isEscaped = false; |
|
| 96 | + |
|
| 97 | + continue; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + if (!$isQuoted && $value[$i] === ',') { |
|
| 101 | + $v = \trim($v); |
|
| 102 | + if ($v !== '') { |
|
| 103 | + $result[] = $v; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + $v = ''; |
|
| 107 | + continue; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + if ($isQuoted && $value[$i] === '\\') { |
|
| 111 | + $isEscaped = true; |
|
| 112 | + $v .= $value[$i]; |
|
| 113 | + |
|
| 114 | + continue; |
|
| 115 | + } |
|
| 116 | + if ($value[$i] === '"') { |
|
| 117 | + $isQuoted = !$isQuoted; |
|
| 118 | + $v .= $value[$i]; |
|
| 119 | + |
|
| 120 | + continue; |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + $v .= $value[$i]; |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + $v = \trim($v); |
|
| 127 | + if ($v !== '') { |
|
| 128 | + $result[] = $v; |
|
| 129 | + } |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + return $result; |
|
| 133 | + } |
|
| 134 | 134 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | static $trimmed = "\"' \n\t\r"; |
| 20 | 20 | $params = $matches = []; |
| 21 | 21 | |
| 22 | - foreach ((array) $header as $value) { |
|
| 22 | + foreach ((array)$header as $value) { |
|
| 23 | 23 | foreach (self::splitList($value) as $val) { |
| 24 | 24 | $part = []; |
| 25 | 25 | foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) ?: [] as $kvp) { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public static function normalize($header): array |
| 53 | 53 | { |
| 54 | 54 | $result = []; |
| 55 | - foreach ((array) $header as $value) { |
|
| 55 | + foreach ((array)$header as $value) { |
|
| 56 | 56 | foreach (self::splitList($value) as $parsed) { |
| 57 | 57 | $result[] = $parsed; |
| 58 | 58 | } |
@@ -4,8 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\GuzzleHttp\Psr7; |
| 6 | 6 | |
| 7 | -final class Header |
|
| 8 | -{ |
|
| 7 | +final class Header { |
|
| 9 | 8 | /** |
| 10 | 9 | * Parse an array of header values containing ";" separated data into an |
| 11 | 10 | * array of associative arrays representing the header key value pair data |
@@ -9,6 +9,5 @@ |
||
| 9 | 9 | /** |
| 10 | 10 | * Exception thrown if a URI cannot be parsed because it's malformed. |
| 11 | 11 | */ |
| 12 | -class MalformedUriException extends InvalidArgumentException |
|
| 13 | -{ |
|
| 12 | +class MalformedUriException extends InvalidArgumentException { |
|
| 14 | 13 | } |