From 893aded9b79245faebe257678ec3d04a0e2525af Mon Sep 17 00:00:00 2001 From: huangshiwu Date: Wed, 31 Dec 2014 11:32:35 +0800 Subject: [PATCH] iOS HttpClient replace libcurl - fix Jenkins compile error --- build/cocos2d_libs.xcodeproj/project.pbxproj | 8 ++++---- build/cocos2d_tests.xcodeproj/project.pbxproj | 2 ++ cocos/network/{HttpClientIOS.mm => HttpClient-ios.mm} | 4 +--- cocos/network/HttpCookie.cpp | 4 ++-- cocos/network/HttpCookie.h | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) rename cocos/network/{HttpClientIOS.mm => HttpClient-ios.mm} (99%) diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index 2e9d52cf43..8c036173b2 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -1750,7 +1750,7 @@ 52B47A1E1A53489B004E4C60 /* HttpClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52B47A1D1A53489B004E4C60 /* HttpClient.cpp */; }; 52B47A2E1A5349A3004E4C60 /* HttpAsynConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B47A291A5349A3004E4C60 /* HttpAsynConnection.h */; }; 52B47A2F1A5349A3004E4C60 /* HttpAsynConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 52B47A2A1A5349A3004E4C60 /* HttpAsynConnection.m */; }; - 52B47A301A5349A3004E4C60 /* HttpClientIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52B47A2B1A5349A3004E4C60 /* HttpClientIOS.mm */; }; + 52B47A301A5349A3004E4C60 /* HttpClient-ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52B47A2B1A5349A3004E4C60 /* HttpClient-ios.mm */; }; 52B47A311A5349A3004E4C60 /* HttpCookie.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52B47A2C1A5349A3004E4C60 /* HttpCookie.cpp */; }; 52B47A321A5349A3004E4C60 /* HttpCookie.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B47A2D1A5349A3004E4C60 /* HttpCookie.h */; }; 5E9F61261A3FFE3D0038DE01 /* CCFrustum.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E9F61221A3FFE3D0038DE01 /* CCFrustum.cpp */; }; @@ -2935,7 +2935,7 @@ 52B47A1D1A53489B004E4C60 /* HttpClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HttpClient.cpp; sourceTree = ""; }; 52B47A291A5349A3004E4C60 /* HttpAsynConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HttpAsynConnection.h; sourceTree = ""; }; 52B47A2A1A5349A3004E4C60 /* HttpAsynConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HttpAsynConnection.m; sourceTree = ""; }; - 52B47A2B1A5349A3004E4C60 /* HttpClientIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HttpClientIOS.mm; sourceTree = ""; }; + 52B47A2B1A5349A3004E4C60 /* HttpClient-ios.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "HttpClient-ios.mm"; sourceTree = ""; }; 52B47A2C1A5349A3004E4C60 /* HttpCookie.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HttpCookie.cpp; sourceTree = ""; }; 52B47A2D1A5349A3004E4C60 /* HttpCookie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HttpCookie.h; sourceTree = ""; }; 5E9F61221A3FFE3D0038DE01 /* CCFrustum.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCFrustum.cpp; sourceTree = ""; }; @@ -3915,7 +3915,7 @@ children = ( 52B47A291A5349A3004E4C60 /* HttpAsynConnection.h */, 52B47A2A1A5349A3004E4C60 /* HttpAsynConnection.m */, - 52B47A2B1A5349A3004E4C60 /* HttpClientIOS.mm */, + 52B47A2B1A5349A3004E4C60 /* HttpClient-ios.mm */, 52B47A2C1A5349A3004E4C60 /* HttpCookie.cpp */, 52B47A2D1A5349A3004E4C60 /* HttpCookie.h */, 52B47A1D1A53489B004E4C60 /* HttpClient.cpp */, @@ -6907,7 +6907,7 @@ 1A570072180BC5A10088DEC7 /* CCActionGrid.cpp in Sources */, 15AE1ABC19AAD40300C27E9E /* b2PolygonAndCircleContact.cpp in Sources */, 15AE1ADA19AAD41000C27E9E /* b2Rope.cpp in Sources */, - 52B47A301A5349A3004E4C60 /* HttpClientIOS.mm in Sources */, + 52B47A301A5349A3004E4C60 /* HttpClient-ios.mm in Sources */, B29A7E1619EE1B7700872B35 /* BoundingBoxAttachment.c in Sources */, 382384081A25900F002C4610 /* FlatBuffersSerialize.cpp in Sources */, DABC9FAA19E7DFA900FA252C /* CCClippingRectangleNode.cpp in Sources */, diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index c78471393f..c24d8f1e9f 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -794,6 +794,7 @@ 527B1F4419EFAE13000A1F82 /* Default-667h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 527B1F4219EFAE13000A1F82 /* Default-667h@2x.png */; }; 527B1F4519EFAE13000A1F82 /* Default-736h@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 527B1F4319EFAE13000A1F82 /* Default-736h@3x.png */; }; 52B47A341A534B2B004E4C60 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52B47A331A534B2B004E4C60 /* Security.framework */; }; + 52B47A351A53A43A004E4C60 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52B47A331A534B2B004E4C60 /* Security.framework */; }; 59620E8F1921E5CF002021B6 /* Bug-Child.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59620E8D1921E5CF002021B6 /* Bug-Child.cpp */; }; 59620E901921E5CF002021B6 /* Bug-Child.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59620E8D1921E5CF002021B6 /* Bug-Child.cpp */; }; 5EBEECB01995247000429821 /* DrawNode3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EBEECAE1995247000429821 /* DrawNode3D.cpp */; }; @@ -1875,6 +1876,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 52B47A351A53A43A004E4C60 /* Security.framework in Frameworks */, 15AE17DC19A725A000C27E9E /* libcurl.a in Frameworks */, 15EFA66F198B356E000C57D3 /* libluacocos2d iOS.a in Frameworks */, 15EFA666198B34D7000C57D3 /* libcocos2d iOS.a in Frameworks */, diff --git a/cocos/network/HttpClientIOS.mm b/cocos/network/HttpClient-ios.mm similarity index 99% rename from cocos/network/HttpClientIOS.mm rename to cocos/network/HttpClient-ios.mm index 68cc5fdf22..ea56d4af16 100644 --- a/cocos/network/HttpClientIOS.mm +++ b/cocos/network/HttpClient-ios.mm @@ -95,8 +95,6 @@ void HttpClient::networkThread() if (request == s_requestSentinel) { break; } - - // step 2: libcurl sync access // Create a HttpResponse object, the default setting is http access failed HttpResponse *response = new (std::nothrow) HttpResponse(request); @@ -198,7 +196,7 @@ static int processTask(HttpRequest *request, NSString* requestType, void *stream //read cookie propertities from file and set cookie if(!s_cookieFilename.empty()) { - CookiesInfo* cookieInfo = s_cookie->getMatchCookie(request->getUrl()); + const CookiesInfo* cookieInfo = s_cookie->getMatchCookie(request->getUrl()); if(cookieInfo != nullptr) { NSString *domain = [NSString stringWithCString:cookieInfo->domain.c_str() encoding:[NSString defaultCStringEncoding]]; diff --git a/cocos/network/HttpCookie.cpp b/cocos/network/HttpCookie.cpp index 984bbb0337..a7f805c0c6 100644 --- a/cocos/network/HttpCookie.cpp +++ b/cocos/network/HttpCookie.cpp @@ -88,12 +88,12 @@ void HttpCookie::readFile() } } -std::vector* HttpCookie::getCookies() +const std::vector* HttpCookie::getCookies() const { return &_cookies; } -CookiesInfo* HttpCookie::getMatchCookie(const std::string& url) +const CookiesInfo* HttpCookie::getMatchCookie(const std::string& url) const { for(auto iter = _cookies.begin(); iter != _cookies.end(); iter++) { diff --git a/cocos/network/HttpCookie.h b/cocos/network/HttpCookie.h index f3c97be5f7..be57a97f1a 100644 --- a/cocos/network/HttpCookie.h +++ b/cocos/network/HttpCookie.h @@ -44,8 +44,8 @@ public: void writeFile(); void setCookieFileName(const std::string fileName); - std::vector* getCookies(); - CookiesInfo* getMatchCookie(const std::string& url); + const std::vector* getCookies()const; + const CookiesInfo* getMatchCookie(const std::string& url) const; void updateOrAddCookie(CookiesInfo* cookie); private: