当前位置: 首页>>代码示例>>PHP>>正文


PHP HTTP_Request2_Response::getVersion方法代码示例

本文整理汇总了PHP中HTTP_Request2_Response::getVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP_Request2_Response::getVersion方法的具体用法?PHP HTTP_Request2_Response::getVersion怎么用?PHP HTTP_Request2_Response::getVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTTP_Request2_Response的用法示例。


在下文中一共展示了HTTP_Request2_Response::getVersion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testParseStatusLine

 /**
  *
  * @expectedException HTTP_Request2_MessageException
  */
 public function testParseStatusLine()
 {
     $response = new HTTP_Request2_Response('HTTP/1.1 200 OK');
     $this->assertEquals('1.1', $response->getVersion());
     $this->assertEquals(200, $response->getStatus());
     $this->assertEquals('OK', $response->getReasonPhrase());
     $response2 = new HTTP_Request2_Response('HTTP/1.2 222 Nishtyak!');
     $this->assertEquals('1.2', $response2->getVersion());
     $this->assertEquals(222, $response2->getStatus());
     $this->assertEquals('Nishtyak!', $response2->getReasonPhrase());
     $response3 = new HTTP_Request2_Response('Invalid status line');
 }
开发者ID:Geeklog-Core,项目名称:geeklog,代码行数:16,代码来源:ResponseTest.php

示例2: testParseStatusLine

 public function testParseStatusLine()
 {
     $response = new HTTP_Request2_Response('HTTP/1.1 200 OK');
     $this->assertEquals('1.1', $response->getVersion());
     $this->assertEquals(200, $response->getStatus());
     $this->assertEquals('OK', $response->getReasonPhrase());
     $response2 = new HTTP_Request2_Response('HTTP/1.2 222 Nishtyak!');
     $this->assertEquals('1.2', $response2->getVersion());
     $this->assertEquals(222, $response2->getStatus());
     $this->assertEquals('Nishtyak!', $response2->getReasonPhrase());
     try {
         $response3 = new HTTP_Request2_Response('Invalid status line');
     } catch (HTTP_Request2_Exception $e) {
         return;
     }
     $this->fail('Expected HTTP_Request2_Exception was not thrown');
 }
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:17,代码来源:ResponseTest.php

示例3: canKeepAlive

 /**
  * Checks whether current connection may be reused or should be closed
  *
  * @param    boolean                 whether connection could be persistent
  *                                   in the first place
  * @param    HTTP_Request2_Response  response object to check
  * @return   boolean
  */
 protected function canKeepAlive($requestKeepAlive, HTTP_Request2_Response $response)
 {
     // Do not close socket on successful CONNECT request
     if (HTTP_Request2::METHOD_CONNECT == $this->request->getMethod() && 200 <= $response->getStatus() && 300 > $response->getStatus()) {
         return true;
     }
     $lengthKnown = 'chunked' == strtolower($response->getHeader('transfer-encoding')) || null !== $response->getHeader('content-length') || HTTP_Request2::METHOD_HEAD == $this->request->getMethod() || in_array($response->getStatus(), array(204, 304));
     $persistent = 'keep-alive' == strtolower($response->getHeader('connection')) || null === $response->getHeader('connection') && '1.1' == $response->getVersion();
     return $requestKeepAlive && $lengthKnown && $persistent;
 }
开发者ID:verbazend,项目名称:AWFA,代码行数:18,代码来源:Socket.php


注:本文中的HTTP_Request2_Response::getVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。