(self)
| 132 | # Raise error_proto('-ERR EOF') if the connection is closed. |
| 133 | |
| 134 | def _getline(self): |
| 135 | line = self.file.readline(_MAXLINE + 1) |
| 136 | if len(line) > _MAXLINE: |
| 137 | raise error_proto('line too long') |
| 138 | |
| 139 | if self._debugging > 1: print('*get*', repr(line)) |
| 140 | if not line: raise error_proto('-ERR EOF') |
| 141 | octets = len(line) |
| 142 | # server can send any combination of CR & LF |
| 143 | # however, 'readline()' returns lines ending in LF |
| 144 | # so only possibilities are ...LF, ...CRLF, CR...LF |
| 145 | if line[-2:] == CRLF: |
| 146 | return line[:-2], octets |
| 147 | if line[:1] == CR: |
| 148 | return line[1:-1], octets |
| 149 | return line[:-1], octets |
| 150 | |
| 151 | |
| 152 | # Internal: get a response from the server. |
no test coverage detected