| 43 | } |
| 44 | |
| 45 | static int gopher_connect(URLContext *h, const char *path) |
| 46 | { |
| 47 | char buffer[1024]; |
| 48 | |
| 49 | if (!*path) return AVERROR(EINVAL); |
| 50 | switch (*++path) { |
| 51 | case ';': |
| 52 | case '<': |
| 53 | case '5': |
| 54 | case '9': |
| 55 | case 's': |
| 56 | path = strchr(path, '/'); |
| 57 | if (!path) return AVERROR(EINVAL); |
| 58 | break; |
| 59 | default: |
| 60 | av_log(h, AV_LOG_WARNING, |
| 61 | "Gopher protocol type '%c' not supported yet!\n", |
| 62 | *path); |
| 63 | return AVERROR(EINVAL); |
| 64 | } |
| 65 | |
| 66 | /* send gopher sector */ |
| 67 | snprintf(buffer, sizeof(buffer), "%s\r\n", path); |
| 68 | |
| 69 | if (gopher_write(h, buffer, strlen(buffer)) < 0) |
| 70 | return AVERROR(EIO); |
| 71 | |
| 72 | return 0; |
| 73 | } |
| 74 | |
| 75 | static int gopher_close(URLContext *h) |
| 76 | { |
no test coverage detected