Commit Graph

237 Commits

Author SHA1 Message Date
Lukas Kahwe Smith
fa2c0273ec Added support for the PATCH method
http://tools.ietf.org/html/rfc2068#section-19.6.1.1
http://tools.ietf.org/html/rfc5789
2011-08-07 12:07:28 +02:00
Fabien Potencier
8700cd6154 fixed CS 2011-07-27 08:27:46 +02:00
Fabien Potencier
7dcbcbe69d [HttpFoundation] tagged public @api 2011-07-20 10:06:02 +02:00
Martin Eckhardt
95011ce4b7 [HttpFoundation] Fixed creation of requests without a path.
Providing urls with no path led to php warning that the index 'path' is
not set. This patch initializes 'path' if no path is set.
2011-07-19 10:54:21 +02:00
Fabien Potencier
932cd10477 made HTTP headers coming from proxies non-trusted by default 2011-07-05 19:49:36 +02:00
Daniel Londero
7dd8dd7699 Fixed @Return comment for getAcceptableContentTypes() method. 2011-07-04 14:34:11 -07:00
Fabien Potencier
ea0f327122 merged branch Seldaek/req_time (PR #1432)
Commits
-------

e80ce57 [HttpFoundation] Add REQUEST_TIME by default

Discussion
----------

[HttpFoundation] Add REQUEST_TIME by default

Without this the getting the REQUEST_TIME from the Request in tests is breaking.
2011-06-25 13:26:06 +02:00
Jordi Boggiano
e80ce57935 [HttpFoundation] Add REQUEST_TIME by default 2011-06-25 12:44:24 +02:00
Fabien Potencier
f57e1d3e10 fixed CS 2011-06-23 14:07:53 +02:00
Fabien Potencier
5b142d581b fixed CS 2011-06-15 11:35:32 +02:00
Sasa Stamenkovic
cbd1dfd3bd Minor doc fixes in Request. 2011-06-14 21:44:45 +02:00
Fabien Potencier
62e4342a86 fixed CS 2011-06-08 12:12:55 +02:00
Fabien Potencier
0af4743583 [HttpFoundation] fixed Request::getFormat() when the mime-type has some optional parameter (closes #1235) 2011-06-08 11:12:57 +02:00
Fabien Potencier
f16e206cd7 [HttpFoundation] added missing CONTENT_TYPE and CONTENT_LENGTH to the Request headers (these two headers are not prefixes with HTTP_ -- as per the CGI/1.1 spec, closes #1234) 2011-06-08 11:04:41 +02:00
Fabien Potencier
9118fcee14 [HttpFoundation] fixed CS 2011-06-08 10:35:47 +02:00
Fabien Potencier
c561f4f0c0 [Routing] changed HTTP method to always be uppercased (to be consistent with HttpFoundation/Request) 2011-06-04 19:06:39 +02:00
Fabien Potencier
c19d6c07d2 [HttpFoundation] simplified code 2011-05-26 15:02:40 +02:00
Joshua Nye
3832a7a33d Added missing space. 2011-05-25 17:22:32 -04:00
Joshua Nye
f019541716 Fixed broken logic in Request::getHttpHost(). It was ignoring HTTP_HOST completely. 2011-05-25 16:02:16 -04:00
Brikou CARRE
9908d51da8 removed docblock for isNoCache 2011-05-23 01:37:10 -07:00
Brikou CARRE
2648ff273e fixed the description of isNoCache method 2011-05-23 09:35:41 +02:00
Brikou CARRE
12bf94c7ff fixed description for isNoCache method 2011-05-23 08:44:08 +02:00
Brikou CARRE
e018e6ce44 added missing method's docblock 2011-05-22 09:13:03 +02:00
Miha Vrhovnik
2e286073a4 Removed ability to override method from GET request 2011-05-19 14:08:34 +02:00
Miha Vrhovnik
65ed6f7763 Added support for request method overriding via X-HTTP-Method-Override
This type of override is supported by MS MVC3 and is recommended by Google.
Also added ability to override request method via ?_method= when
request is made via GET.
2011-05-19 09:33:08 +02:00
Fabien Potencier
5a38886b1d [HttpFoundation] fixed Request::getHttpHost() 2011-05-16 08:20:17 +02:00
Fabien Potencier
e81b88c576 [HttpFoundation] added HeaderBag::__toString() 2011-05-15 12:38:12 +02:00
Fabien Potencier
dcb4ef6e23 [HttpFoundation] added Request::__toString() 2011-05-15 12:33:06 +02:00
Fabien Potencier
62d09b8fb2 [HttpFoundation] ensures that path info always starts with a / 2011-05-15 11:28:38 +02:00
Chekote
41ed194a98 Fixed content type for urlencoded forms being too specific. For example, this will now function will clients (such as Firefox) that append the charset to the content type header. Uses 0 === strpos() as per @kriswallsmith suggestion. 2011-05-13 19:05:28 -05:00
Chekote
88d94dd59f Fixed reference to $this, when not in object context 2011-05-12 16:21:13 -05:00
Fabien Potencier
0848604ce1 [HttpFoundation] fixed typo 2011-05-12 14:45:39 +02:00
Fabien Potencier
08846af9e2 [HttpFoundation] moved the PUT magic dance in createFromGlobals() 2011-05-12 14:45:38 +02:00
Fabien Potencier
efd1f1358c added support for PUT method 2011-05-12 14:45:38 +02:00
Johannes Schmitt
411659bc07 [HttpFoundation] added $deep flag to Request::get() 2011-05-10 11:19:22 +02:00
Johannes Schmitt
362b7264d1 [Security][HttpFoundation] splits Request::hasSession() into hasSession(), and hasPreviousSession()
This closes #774, and fixes #772.
2011-05-05 08:38:07 +02:00
Kris Wallsmith
ae46150bc8 [HttpFoundation] added support for X-Forwarded-Port request header 2011-05-04 09:56:34 -07:00
Fabien Potencier
c7fddca891 replaced some url..code by rawurl..code 2011-05-03 23:06:55 +02:00
Victor Berchet
d350e01e33 File & UploadedFile tweaks 2011-04-27 09:10:41 +02:00
Fabien Potencier
889c422d6e Merge remote branch 'igorw/ipv6'
* igorw/ipv6:
  [HttpFoundation] minor optimization
  minor adjustments suggested by vicb
  [HttpFoundation] IPv6 support for RequestMatcher
  [HttpFoundation] refactor RequestMatcherTest to use dataProvider
  [Validator] use full iPv6 regex
  [Validator] add IPv6 support to UrlValidator
  [HttpFoundation] add IPv6 support to Request
  [HttpFoundation] test Request::create with an IP as host name
  [HttpFoundation] refactor Request::getClientIp test
2011-04-24 22:04:25 +02:00
Igor Wiedler
51d12758a0 minor adjustments suggested by vicb 2011-04-22 18:37:20 +02:00
Igor Wiedler
82699c5a98 [HttpFoundation] add IPv6 support to Request 2011-04-22 17:07:44 +02:00
Fabien Potencier
417839345f Merge remote branch 'lsmith77/request_format_tweaks'
* lsmith77/request_format_tweaks:
  added text/html to default format mapping
  return "q" from splitHttpAcceptHeader() to enable more complex accept header negotiations
  added support for setting a custom default format in Request::getRequestFormat()
2011-04-22 15:33:01 +02:00
Fabien Potencier
c5497c7c67 [HttpFoundation] fixed a potential security problem in Request 2011-04-21 20:00:27 +02:00
Fabien Potencier
d993a9160a [HttpFoundation] fixed getScheme() method 2011-04-20 10:49:08 +02:00
Lukas Kahwe Smith
c2ac8304b0 added text/html to default format mapping 2011-04-17 14:39:07 +02:00
Lukas Kahwe Smith
4c3c6cdabf return "q" from splitHttpAcceptHeader() to enable more complex accept header negotiations 2011-04-17 14:38:33 +02:00
Lukas Kahwe Smith
53c7bcf3aa added support for setting a custom default format in Request::getRequestFormat() 2011-04-17 14:37:35 +02:00
hidenorigoto
1e78ec395c [HttpFoundation] fixed wrong method name 2011-04-15 19:04:00 +09:00
ornicar
7440db7244 [HttpFoundation] Make sure Request::getLanguages always returns an array 2011-03-19 01:34:54 -07:00
Fabien Potencier
8c423edfef replaced symfony-project.org by symfony.com 2011-03-06 12:40:06 +01:00
Pascal Borreli
fc42cc5066 [HttpFoundation] Removed useless else 2011-02-27 18:36:38 +01:00
Sven Paulus
5d87d83a10 optimize duplication of Request objects 2011-02-09 06:59:36 +01:00
Martijn Evers
1e3dc1479c [Testing][HttpKernel] Added possibility to functional test raw body data 2011-02-04 13:07:13 +01:00
Fabien Potencier
8dd0c5641a [HttpFoundation] made small optimizations 2011-01-31 08:26:40 +01:00
Victor Berchet
f470c5605e [Request] Fix getting mime type 2011-01-30 20:14:40 +01:00
Fabien Potencier
ee3d03ee8a [HttpFoundation] made Request::create() overridable 2011-01-30 10:53:45 +01:00
Fabien Potencier
98c1056fbf renamed Request::fromGlobals() to Request::createFromGlobals() (for consistency with the existing create() method) 2011-01-27 21:20:08 +01:00
Kris Wallsmith
224e66f77b [HttpFoundation] added static Request::fromGlobals()
The Request constructor no longer uses values from PHP's super globals. If you want a Request populated with these values you must use the new static method Request::fromGlobals().

Your front controllers (i.e. web/app.php, web/app_dev.php ...) will need to be updated:

    // old
    $kernel->handle(new Request())->send();

    // new
    $kernel->handle(Request::fromGlobals())->send();
2011-01-27 21:12:55 +01:00
Bulat Shakirzyanov
271e757f27 [HttFoundation] extracted FileBag, ServerBag, fixed HeaderBag::add(), updated Request test 2011-01-23 07:40:31 +01:00
Ryan Weaver
17f9162b89 [Standards] Changing many instances of "boolean" to "Boolean". 2011-01-21 09:53:24 +01:00
Dominique Bongiraud
64fb94c725 normalized license messages in PHP files 2011-01-18 08:07:46 +01:00
Bulat Shakirzyanov
d6b57bce33 [HttpFoundation] fixed error casting broken in DomCrawler\Form::getPhpFiles() 2011-01-10 18:57:55 +01:00
Jordi Boggiano
3d9b13f240 CS: Unified non-strict equality comparisons, put var on the right side 2010-12-21 08:51:27 +01:00
Jordi Boggiano
583340db7b [HttpFoundation] Added a way to grab the request body as a resource 2010-12-13 07:55:40 +01:00
Jordi Boggiano
9fef10f67d [HttpFoundation] Fixed indenting 2010-12-13 07:53:09 +01:00
jeff
e6d0385778 [HttpFoundation] fixed Request::create() when using HTTPS and getUri()/getPathForUri() when script name should be removed.
Original explanation from pull request:

I'm Using symfony2 with URL Rewriting to 'hide' index.php.
On form authentication, symfony2 redirect to http://host:port/index.php/login_path instead of http://host:port/login_path. I do understand that, in my case, redirect is set into one of :
FormAuthenticationEntryPoint with getUriForPath()
FormAuthenticationListener with getUriForPath()
Security/Firewal/ExceptionListener with getUri()

This path modify getUri and getUriForPath to :
remove default port from URI
remove script name if not initially present
2010-12-12 14:08:35 +01:00
Fabien Potencier
a7c81577c7 [HttpFoundation] added a way to retrieve raw body from a request 2010-12-12 09:05:03 +01:00
Jordi Boggiano
fb41389999 [HttpFoundation] Fixed Request::create handling of full URIs 2010-12-08 07:52:33 +01:00
Jordi Boggiano
f6bc712028 [HttpFoundation] Always force the request method to full caps 2010-12-08 07:28:18 +01:00
Fabien Potencier
e8672740c7 [HttpFoundation] allowed any HTTP method for a Request 2010-12-08 07:24:37 +01:00
Justin Hileman
112fb5ad99 Fix Request::overrideGlobals $_COOKIE global var reference. 2010-12-06 08:12:40 +01:00
Bernhard Schussek
d95d33666d [HttpFoundation] Fixed class Request to convert empty files to NULL 2010-11-23 06:51:17 +01:00
Fabien Potencier
b6923dd7b9 changed Cache-Control default value behavior
The PHP native cache limiter feature has been disabled as this is now managed
by the HeaderBag class directly instead (see below.)

The HeaderBag class uses the following rules to define a sensible and
convervative default value for the Response 'Cache-Control' header:

 * If no cache header is defined ('Cache-Control', 'ETag', 'Last-Modified',
   and 'Expires'), 'Cache-Control' is set to 'no-cache';

 * If 'Cache-Control' is empty, its value is set to "private, max-age=0,
   must-revalidate";

 * But if at least one 'Cache-Control' directive is set, and no 'public' or
   'private' directives have been explicitely added, Symfony2 adds the
   'private' directive automatically (except when 's-maxage' is set.)

So, remember to explicitly add the 'public' directive to 'Cache-Control' when
you want shared caches to store your application resources:

    // The Response is private by default
    $response->setEtag($etag);
    $response->setLastModified($date);
    $response->setMaxAge(10);

    // Change the Response to be public
    $response->setPublic();

    // Set cache settings in one call
    $response->setCache(array(
        'etag'          => $etag,
        'last_modified' => $date,
        'max_age'       => 10,
        'public'        => true,
    ));
2010-11-18 17:05:05 +01:00
Ryan Weaver
58a240baba [HttpFoundation] Allow the SERVER_PORT key of the server ParameterBag in Request to be a string value without confusing Request::getHttpHost().
The idea of a string port is probably semantically wrong, but it actually follows the convention of at least some web servers ($_SERVER['SERVER_PORT'] is actually a string). And since the $port variable is used as a string in getHttpHost(), it's correct to allow the types not to match.
2010-11-15 09:45:59 +01:00
Ryan Weaver
81272b22fa [HttpFoundation] Adding PHPDoc to the Request class and removing two unused variables. 2010-11-13 16:03:57 +01:00
Fabien Potencier
7b02766373 fixed session management
Some explanations on how it works now:

 * The Session is an optional dependency of the Request. If you create the
   Request yourself (which is mandatory now in the front controller) and if
   you don't inject a Session yourself (which is recommended if you want the
   session to be configured via dependency injection), the Symfony2 Kernel
   will associate the Session configured in the Container with the Request
   automatically.

 * When duplicating a request, the session is shared between the parent and
   the child (that's because duplicated requests are sub-requests of the main
   one most of the time.) Notice that when you use ::create(), the behavior is
   the same as for the constructor; no session is attached to the Request.

 * Symfony2 tries hard to not create a session cookie when it is not needed
   but a Session object is always available (the cookie is only created when
   "something" is stored in the session.)

 * Symfony2 only starts a session when:

   * A session already exists in the request ($_COOKIE[session_name()] is
     defined -- this is done by RequestListener);

   * There is something written in the session object (the cookie will be sent
     to the Client).

 * Notice that reading from the session does not start the session anymore (as
   we don't need to start a new session to get the default values, and because
   if a session exists, it has already been started by RequestListener.)
2010-11-09 22:34:48 +01:00
jeff
ae888b80f6 [HttpFoundation] removed port number from HOST header
To be consistent with backup values (SERVER_NAME, SERVER_ADDR).
fix a problem with getUriForPath($path) where port number may be present twice.
2010-10-28 15:14:48 +02:00
Fabien Potencier
94347f73c5 [HttpFoundation] added a way to generate a URI based on the current one and a path 2010-10-19 13:13:14 +02:00
Kris Wallsmith
f79e23ffb5 Removed all those spaces after @author that were bothering me so… 2010-10-18 16:55:41 +02:00
Antoine Hérault
7bd76610ca [HttpFoundation] fixed request files handling 2010-09-10 12:34:28 +02:00
Fabien Potencier
a141c98917 [HttpFoundation] moved File Component into the HttpFoundation one 2010-09-09 17:01:48 +02:00
Kris Wallsmith
1443d4a0ba [HttpFoundation] updated getQueryString() to work in more scenarios 2010-09-06 08:48:11 +02:00
Fabien Potencier
4f337615e3 [HttpFoundation] added request matcher 2010-09-02 13:39:49 +02:00
Fabien Potencier
15cd2643c0 [HttpFoundation] added Request::getClientIp() 2010-09-01 13:56:20 +02:00
Fabien Potencier
3e24cef256 [HttpFoundation] fixed Request::hasSession() 2010-09-01 11:18:07 +02:00
Fabien Potencier
bf82cf42dd renamed Symfony\Components to Symfony\Component 2010-08-20 23:09:55 +02:00