/**
  * Handle method. Calls doCreate if necessary (the environment variable
  * "PRODUCT" is not set - which it will be if the RewriteRule has
  * taken control).
  *
  * @param   scriptlet.xml.XMLScriptletRequest request
  * @return  string class method (one of doGet, doPost, doHead)
  * @see     xp://scriptlet.xml.XMLScriptlet#_handleMethod
  */
 public function handleMethod($request)
 {
     // XXX TDB
     // if (!$request->getEnvValue('PRODUCT')) {
     //   return 'doCreate';
     // }
     return parent::handleMethod($request);
 }
 public function invalidProtocolRequestsUnsupported()
 {
     $req = $this->newRequest('GET', new URL('http://localhost/'));
     $req->env['SERVER_PROTOCOL'] = 'INVALID/1.0';
     $res = new HttpScriptletResponse();
     $s = new HttpScriptlet();
     $s->service($req, $res);
 }
 public function traceUnSupported()
 {
     $this->newRequest('TRACE', new URL('http://localhost/'));
     $s = new HttpScriptlet();
     $s->process();
 }
 public function forwardedHosts()
 {
     $req = $this->newRequest('GET', new URL('http://localhost/'));
     $req->addHeader('X-Forwarded-Host', 'balance.example.com, proxy.example.com');
     $res = new HttpScriptletResponse();
     $s = new HttpScriptlet();
     $s->service($req, $res);
     $this->assertEquals('balance.example.com', $req->getURL()->getHost());
 }
Ejemplo n.º 5
0
 /**
  * Calculate method to invoke
  *
  * @param   scriptlet.HttpScriptletRequest request 
  * @return  string
  */
 public function handleMethod($request)
 {
     parent::handleMethod($request);
     return 'doProcess';
 }