From 29852bc012afbed303159b895ae8dc9448500ca5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 17 Nov 2010 15:01:41 -0500 Subject: SH-476 FIX. Map tiles were failing when numeric addrs were substituted in amazon S3 image queries --- indra/newview/llmeshrepository.cpp | 54 +++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 24 deletions(-) mode change 100644 => 100755 indra/newview/llmeshrepository.cpp (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp old mode 100644 new mode 100755 index 94ed2697c5..b26f2dd0de --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -105,36 +105,42 @@ U32 get_volume_memory_size(const LLVolume* volume) std::string scrub_host_name(std::string http_url) { //curl loves to abuse the DNS cache, so scrub host names out of urls where trivial to prevent DNS timeouts + + if (http_url.empty()) + { + return http_url; + } + // Not safe to scrub amazon paths + if (http_url.find("s3.amazonaws.com") != std::string::npos) + { + return http_url; + } + std::string::size_type begin_host = http_url.find("://")+3; + std::string host_string = http_url.substr(begin_host); - if (!http_url.empty()) + std::string::size_type end_host = host_string.find(":"); + if (end_host == std::string::npos) { - std::string::size_type begin_host = http_url.find("://")+3; - std::string host_string = http_url.substr(begin_host); - - std::string::size_type end_host = host_string.find(":"); - if (end_host == std::string::npos) - { - end_host = host_string.find("/"); - } - - host_string = host_string.substr(0, end_host); + end_host = host_string.find("/"); + } + + host_string = host_string.substr(0, end_host); + + std::string::size_type idx = http_url.find(host_string); + + hostent* ent = gethostbyname(host_string.c_str()); + + if (ent && ent->h_length > 0) + { + U8* addr = (U8*) ent->h_addr_list[0]; - std::string::size_type idx = http_url.find(host_string); - - hostent* ent = gethostbyname(host_string.c_str()); - - if (ent && ent->h_length > 0) + std::string ip_string = llformat("%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]); + if (!ip_string.empty() && !host_string.empty() && idx != std::string::npos) { - U8* addr = (U8*) ent->h_addr_list[0]; - - std::string ip_string = llformat("%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]); - if (!ip_string.empty() && !host_string.empty() && idx != std::string::npos) - { - http_url.replace(idx, host_string.length(), ip_string); - } + http_url.replace(idx, host_string.length(), ip_string); } } - + return http_url; } -- cgit v1.2.3 From 48e2ec0340272efcb5caa7c5affaabfbf8d69c78 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Wed, 17 Nov 2010 20:04:30 -0500 Subject: SH-480 FIX meshes are not added to objects folder on upload curl host scrubbing was causing object creation for mesh prims to fail. Commenting out the offending lines so we can have a functional release. Will file a separate bug for Vir to investigate when/if we can re-enable host scrubbing on these URLs for a future release. Approach approved by davep. --- indra/newview/llmeshrepository.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index f00a8565f7..1313033f4e 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1409,8 +1409,8 @@ LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, mUploadObjectAssetCapability = gAgent.getRegion()->getCapability("UploadObjectAsset"); mNewInventoryCapability = gAgent.getRegion()->getCapability("NewFileAgentInventoryVariablePrice"); - mUploadObjectAssetCapability = scrub_host_name(mUploadObjectAssetCapability); - mNewInventoryCapability = scrub_host_name(mNewInventoryCapability); + //mUploadObjectAssetCapability = scrub_host_name(mUploadObjectAssetCapability); + //mNewInventoryCapability = scrub_host_name(mNewInventoryCapability); mOrigin += gAgent.getAtAxis() * scale.magVec(); } -- cgit v1.2.3