| 135 | } |
| 136 | |
| 137 | vector<HttpServerBrowser::Entry *> *HttpServerBrowser::GoTo(const char *ref, int32_t *result) |
| 138 | { |
| 139 | vector<HttpServerBrowser::Entry *> *ret = new vector<HttpServerBrowser::Entry *>; |
| 140 | CURLcode cret; |
| 141 | |
| 142 | SetPath(ref); |
| 143 | |
| 144 | char *addr; |
| 145 | curl_url_get(m_url, CURLUPART_URL, &addr, 0); |
| 146 | SCE_DBG_LOG_INFO("[GoTo] Attempt to open %s\n", addr); |
| 147 | curl_easy_setopt(m_curl, CURLOPT_URL, addr); |
| 148 | curl_free(addr); |
| 149 | |
| 150 | m_buffer = NULL; |
| 151 | m_posInBuf = 0; |
| 152 | |
| 153 | cret = curl_easy_perform(m_curl); |
| 154 | if (cret != CURLE_OK) |
| 155 | { |
| 156 | *result = cret; |
| 157 | return ret; |
| 158 | } |
| 159 | |
| 160 | if (m_buffer && m_posInBuf > 2) |
| 161 | { |
| 162 | m_buffer[m_posInBuf - 1] = 0; |
| 163 | |
| 164 | char *href = NULL; |
| 165 | char *refEnd = m_buffer; |
| 166 | while (1) |
| 167 | { |
| 168 | href = sce_paf_strstr(refEnd + 1, "<a href=\""); |
| 169 | if (!href) |
| 170 | break; |
| 171 | href += 9; |
| 172 | |
| 173 | refEnd = sce_paf_strstr(href, "\">"); |
| 174 | *refEnd = 0; |
| 175 | |
| 176 | GenericPlayer::SupportType supportType = utils::GetContentSupportType(href); |
| 177 | |
| 178 | if (supportType != GenericPlayer::SupportType_NotSupported) |
| 179 | { |
| 180 | char *decoded = curl_easy_unescape(m_curl, href, 0, NULL); |
| 181 | HttpServerBrowser::Entry *entry = new HttpServerBrowser::Entry(); |
| 182 | entry->ref = decoded; |
| 183 | entry->type = HttpServerBrowser::Entry::Type_UnsupportedFile; |
| 184 | curl_free(decoded); |
| 185 | |
| 186 | if (supportType == GenericPlayer::SupportType_MaybeSupported) |
| 187 | { |
| 188 | entry->type = HttpServerBrowser::Entry::Type_Folder; |
| 189 | } |
| 190 | else if (supportType == GenericPlayer::SupportType_Supported) |
| 191 | { |
| 192 | entry->type = HttpServerBrowser::Entry::Type_SupportedFile; |
| 193 | } |
| 194 |
nothing calls this directly
no outgoing calls
no test coverage detected