summaryrefslogtreecommitdiff
path: root/framework/Web/THttpRequest.php
diff options
context:
space:
mode:
authorxue <>2006-09-23 01:51:57 +0000
committerxue <>2006-09-23 01:51:57 +0000
commita5467e842316daf6a8a4345740f05a9731167ce1 (patch)
tree0a982dd52df5c682fd2de8f9b22137471cee2dbe /framework/Web/THttpRequest.php
parent9af56fd93ed071d86f14296cec618073f6c0941a (diff)
merge from 3.0 branch till 1435.
Diffstat (limited to 'framework/Web/THttpRequest.php')
-rw-r--r--framework/Web/THttpRequest.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php
index dc3143e6..33839ed0 100644
--- a/framework/Web/THttpRequest.php
+++ b/framework/Web/THttpRequest.php
@@ -130,6 +130,16 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
*/
public function init($config)
{
+ // Fill in default request info when the script is run in command line
+ if(php_sapi_name()==='cli')
+ {
+ $_SERVER['REMOTE_ADDR']='127.0.0.1';
+ $_SERVER['REQUEST_METHOD']='GET';
+ $_SERVER['SERVER_NAME']='localhost';
+ $_SERVER['SERVER_PORT']=80;
+ $_SERVER['HTTP_USER_AGENT']='';
+ }
+
// Info about server variables:
// PHP_SELF contains real URI (w/ path info, w/o query string)
// SCRIPT_NAME is the real URI for the requested script (w/o path info and query string)