| 161 | } |
| 162 | |
| 163 | static int http_get_line(HTTPContext *s, char *line, int line_size) |
| 164 | { |
| 165 | int ch; |
| 166 | char *q; |
| 167 | |
| 168 | q = line; |
| 169 | for(;;) { |
| 170 | ch = http_getc(s); |
| 171 | if (ch < 0) |
| 172 | return AVERROR(EIO); |
| 173 | if (ch == '\n') { |
| 174 | /* process line */ |
| 175 | if (q > line && q[-1] == '\r') |
| 176 | q--; |
| 177 | *q = '\0'; |
| 178 | |
| 179 | return 0; |
| 180 | } else { |
| 181 | if ((q - line) < line_size - 1) |
| 182 | *q++ = ch; |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | static int process_line(URLContext *h, char *line, int line_count, |
| 188 | int *new_location) |
no test coverage detected