| 68 | } |
| 69 | |
| 70 | Result LoadFromHttpInternal(const char* url, const dmURI::Parts& uri_parts, int argc, const char** argv, HConfig* config, FLoadFromBufferInternal load_from_buffer) |
| 71 | { |
| 72 | HttpContext context; |
| 73 | |
| 74 | dmHttpClient::NewParams params; |
| 75 | params.m_Userdata = &context; |
| 76 | params.m_HttpContent = &HttpContent; |
| 77 | params.m_HttpHeader = &HttpHeader; |
| 78 | dmHttpClient::HClient client = dmHttpClient::New(¶ms, &uri_parts, 0); |
| 79 | if (client == 0x0) |
| 80 | { |
| 81 | return RESULT_FILE_NOT_FOUND; |
| 82 | } |
| 83 | |
| 84 | dmHttpClient::Result http_result = dmHttpClient::Get(client, uri_parts.m_Path); |
| 85 | dmHttpClient::Delete(client); |
| 86 | |
| 87 | if (http_result != dmHttpClient::RESULT_OK) |
| 88 | { |
| 89 | return RESULT_FILE_NOT_FOUND; |
| 90 | } |
| 91 | |
| 92 | const char* buffer = context.m_Buffer.Size() > 0 ? (const char*) &context.m_Buffer.Front() : ""; |
| 93 | return load_from_buffer(url, buffer, context.m_Buffer.Size(), argc, argv, config); |
| 94 | } |
| 95 | } |