Apache Zeta Components Manual :: File Source for http.php
Source for file http.php
Documentation is available at http.php
* File containing the ezcMvcHttpRequestParser class
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @version //autogentag//
* Request parser that uses HTTP headers to populate an ezcMvcRequest object.
* @version //autogentag//
* Uses the data from the superglobals.
* Creates and returns an ezcMvcRequest object.
* Processes the basic HTTP auth variables is set
if ( isset
( $_SERVER['PHP_AUTH_USER'] ) && isset
( $_SERVER['PHP_AUTH_PW'] ) )
* Processes the standard headers that are not subdivided into other structs.
* Processes the request protocol.
if ( isset
( $_SERVER['REQUEST_METHOD'] ) )
switch ( $_SERVER['REQUEST_METHOD'] )
$req->protocol =
'http-post';
$req->protocol =
'http-put';
$req->protocol =
'http-delete';
$req->protocol =
'http-get';
* Processes the request host.
$this->request->host = isset
( $_SERVER['HTTP_HOST'] )
isset
( $_SERVER['SERVER_NAME'] )
?
$_SERVER['SERVER_NAME']
:
'localhost.localdomain'
* Processes the request date.
$this->request->date = isset
( $_SERVER['REQUEST_TIME'] )
?
new DateTime( "@{$_SERVER['REQUEST_TIME']}" )
* Processes the request variables.
$this->request->variables =
& $_REQUEST;
* Processes the referrer.
$this->request->referrer = isset
( $_SERVER['HTTP_REFERER'] )
?
$_SERVER['HTTP_REFERER']
* Processes the request URI.
$req->uri = isset
( $_SERVER['REQUEST_URI'] )
?
$_SERVER['REQUEST_URI']
// remove the query string from the URI
// remove the prefix from the URI
* Processes the request ID from host and URI.
* Processes the request body for PUT requests.
if ( $req->protocol ==
'http-put' )
* Proccesses the HTTP Accept headers into the ezcMvcRequestAccept struct.
'HTTP_ACCEPT' =>
'types',
'HTTP_ACCEPT_CHARSET' =>
'charsets',
'HTTP_ACCEPT_ENCODING' =>
'encodings',
'HTTP_ACCEPT_LANGUAGE' =>
'languages',
foreach ( $map as $var =>
$property )
if ( !isset
( $_SERVER[$var] ) )
$accept->$property =
array();
$parts =
explode( ',', $_SERVER[$var] );
$tmpPriorities =
array();
foreach ( $parts as $part )
$priPart =
explode( ';q=', $part );
if ( count( $priPart ) ==
2 )
$tmpPriorities[$priPart[0]] =
$priPart[1];
$tmpPriorities[$part] =
1;
* Proccesses the User Agent header into the ezcMvcRequestUserAgent struct.
$agent->agent = isset
( $_SERVER['HTTP_USER_AGENT'] )
?
$_SERVER['HTTP_USER_AGENT']
* Processes uploaded files.
foreach ( $_FILES as $name =>
$info )
$file->mimeType =
$info['type'];
$file->name =
$info['name'];
$file->size =
$info['size'];
$file->status =
$info['error'];
$file->tmpPath =
$info['tmp_name'];
foreach ( $_COOKIE as $name =>
$value )
$this->request->cookies[] =
$cookie;