| 862 | } |
| 863 | |
| 864 | static int http_get_line(HTTPContext *s, char *line, int line_size) |
| 865 | { |
| 866 | int ch; |
| 867 | char *q; |
| 868 | |
| 869 | q = line; |
| 870 | for (;;) { |
| 871 | ch = http_getc(s); |
| 872 | if (ch < 0) |
| 873 | return ch; |
| 874 | if (ch == '\n') { |
| 875 | /* process line */ |
| 876 | if (q > line && q[-1] == '\r') |
| 877 | q--; |
| 878 | *q = '\0'; |
| 879 | |
| 880 | return 0; |
| 881 | } else { |
| 882 | if ((q - line) < line_size - 1) |
| 883 | *q++ = ch; |
| 884 | } |
| 885 | } |
| 886 | } |
| 887 | |
| 888 | static int check_http_code(URLContext *h, int http_code, const char *end) |
| 889 | { |
no test coverage detected