@@ 66-92 (lines=27) @@ | ||
63 | * @override |
|
64 | * @inheritDoc |
|
65 | */ |
|
66 | public function readRequest(BufferInterface $buffer, $data) |
|
67 | { |
|
68 | $buffer->push($data); |
|
69 | ||
70 | if (($position = $buffer->search(self::HTTP_EOM)) === false) |
|
71 | { |
|
72 | if ($buffer->length() > $this->maxFrameSize) |
|
73 | { |
|
74 | throw new ReadException( |
|
75 | sprintf('Message start line exceeded maximum size of %d bytes.', $this->maxFrameSize) |
|
76 | ); |
|
77 | } |
|
78 | ||
79 | return null; |
|
80 | } |
|
81 | ||
82 | try |
|
83 | { |
|
84 | return $this->parser->parseRequest($buffer->drain()); |
|
85 | } |
|
86 | catch (Error $ex) |
|
87 | {} |
|
88 | catch (Exception $ex) |
|
89 | {} |
|
90 | ||
91 | throw new InvalidFormatException('Could not parse start line.', 0, $ex); |
|
92 | } |
|
93 | ||
94 | /** |
|
95 | * @override |
|
@@ 98-124 (lines=27) @@ | ||
95 | * @override |
|
96 | * @inheritDoc |
|
97 | */ |
|
98 | public function readResponse(BufferInterface $buffer, $data) |
|
99 | { |
|
100 | $buffer->push($data); |
|
101 | ||
102 | if (($position = $buffer->search(self::HTTP_EOM)) === false) |
|
103 | { |
|
104 | if ($buffer->length() > $this->maxFrameSize) |
|
105 | { |
|
106 | throw new ReadException( |
|
107 | sprintf('Message start line exceeded maximum size of %d bytes.', $this->maxFrameSize) |
|
108 | ); |
|
109 | } |
|
110 | ||
111 | return null; |
|
112 | } |
|
113 | ||
114 | try |
|
115 | { |
|
116 | return $this->parser->parseResponse($buffer->drain()); |
|
117 | } |
|
118 | catch (Error $ex) |
|
119 | {} |
|
120 | catch (Exception $ex) |
|
121 | {} |
|
122 | ||
123 | throw new InvalidFormatException('Could not parse start line.'); |
|
124 | } |
|
125 | } |
|
126 |