示例#1
0
 /**
  * @param resource a file stream
  * @return Bringit_Header_ResponseHeader
  */
 public function parseStream($stream)
 {
     $statusLine = Bringit_Header_ResponseStatusLine::fromString(fgets($stream));
     // TODO: handle folding/continuation
     // @see http://tools.ietf.org/html/rfc2616#section-2.2
     $headers = array();
     while (!feof($stream)) {
         $line = fgets($stream);
         if ($line === "\r\n") {
             break;
         } else {
             $headers[] = Bringit_Header_HeaderField::fromString($line);
         }
     }
     return new Bringit_Header_ResponseHeader($statusLine, $headers);
 }
示例#2
0
 public function testRoundTrip()
 {
     $string = "Test: blarg: meh\r\n";
     $this->assertEqual(Bringit_Header_HeaderField::fromString($string)->__toString(), $string);
 }