From 1fade8aa36bd5d9c1cf701003b51719c05e45bb1 Mon Sep 17 00:00:00 2001 From: Kongqun Yang Date: Tue, 3 Dec 2013 10:48:33 -0800 Subject: [PATCH] Patch happyhttp source to make it work in linux. Also creates gyp file and README file. Change-Id: I437d49abacf8f9f28dcef782c153a224dbe91468 --- third_party/happyhttp/README.packager | 20 +++++++++++++++ third_party/happyhttp/happyhttp.gyp | 26 ++++++++++++++++++++ third_party/happyhttp/patches/_stricmp | 13 ++++++++++ third_party/happyhttp/patches/server_url | 31 ++++++++++++++++++++++++ third_party/happyhttp/src/happyhttp.cpp | 2 +- third_party/happyhttp/src/test.cpp | 6 ++--- 6 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 third_party/happyhttp/README.packager create mode 100644 third_party/happyhttp/happyhttp.gyp create mode 100644 third_party/happyhttp/patches/_stricmp create mode 100644 third_party/happyhttp/patches/server_url diff --git a/third_party/happyhttp/README.packager b/third_party/happyhttp/README.packager new file mode 100644 index 0000000000..28f8b0122a --- /dev/null +++ b/third_party/happyhttp/README.packager @@ -0,0 +1,20 @@ +Name: happyhttp +URL: http://scumways.com/happyhttp/happyhttp.html +Version: 0.1 SHA 7306b1606a09063ac38c264afe59f0ad0b441750 +License: zlib/libpng +License File: http://opensource.org/licenses/zlib-license.php + +Description: +The src/ directory contains a snapshot of the happyhttp library +with the patches in the patches/ directories applied. +See the files in that directory for discussion of their effects. + +Modifications: +- Fix _stricmp undefined problem in linux. Use strcasecmp instead. +- "www.scumways.com" should be "scumways.com" in test.cpp. + +To import a new snapshot of libxml: +- Git clone from https://github.com/Zintinio/HappyHTTP. +- Copy the files into src/ directory +- Apply the patches in patches/ and fix any problems. +- Update this README to reflect the new version number. diff --git a/third_party/happyhttp/happyhttp.gyp b/third_party/happyhttp/happyhttp.gyp new file mode 100644 index 0000000000..7f8b93e917 --- /dev/null +++ b/third_party/happyhttp/happyhttp.gyp @@ -0,0 +1,26 @@ +# Copyright (c) 2013 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'happyhttp_lib', + 'type': 'static_library', + 'sources': [ + 'src/happyhttp.cpp', + 'src/happyhttp.h', + ], + }, + { + 'target_name': 'happyhttp_lib_test', + 'type': 'executable', + 'sources': [ + 'src/test.cpp', + ], + 'dependencies': [ + 'happyhttp_lib', + ], + }, + ], +} diff --git a/third_party/happyhttp/patches/_stricmp b/third_party/happyhttp/patches/_stricmp new file mode 100644 index 0000000000..80143f93b6 --- /dev/null +++ b/third_party/happyhttp/patches/_stricmp @@ -0,0 +1,13 @@ +diff --git a/third_party/happyhttp/src/happyhttp.cpp b/third_party/happyhttp/src/happyhttp.cpp +index 9e56673..8c8548f 100644 +--- a/third_party/happyhttp/src/happyhttp.cpp ++++ b/third_party/happyhttp/src/happyhttp.cpp +@@ -49,7 +49,7 @@ + #include + #include + +-#ifdef __APPLE__ ++#ifndef _WIN32 + #define _stricmp strcasecmp + #endif + diff --git a/third_party/happyhttp/patches/server_url b/third_party/happyhttp/patches/server_url new file mode 100644 index 0000000000..ab38e9218b --- /dev/null +++ b/third_party/happyhttp/patches/server_url @@ -0,0 +1,31 @@ +diff --git a/third_party/happyhttp/src/test.cpp b/third_party/happyhttp/src/test.cpp +index f3d39d1..3ce74b4 100644 +--- a/third_party/happyhttp/src/test.cpp ++++ b/third_party/happyhttp/src/test.cpp +@@ -31,7 +31,7 @@ void Test1() + { + puts("-----------------Test1------------------------" ); + // simple simple GET +- happyhttp::Connection conn( "www.scumways.com", 80 ); ++ happyhttp::Connection conn( "scumways.com", 80 ); + conn.setcallbacks( OnBegin, OnData, OnComplete, 0 ); + + conn.request( "GET", "/happyhttp/test.php", 0, 0,0 ); +@@ -57,7 +57,7 @@ void Test2() + + const char* body = "answer=42&name=Bubba"; + +- happyhttp::Connection conn( "www.scumways.com", 80 ); ++ happyhttp::Connection conn( "scumways.com", 80 ); + conn.setcallbacks( OnBegin, OnData, OnComplete, 0 ); + conn.request( "POST", + "/happyhttp/test.php", +@@ -77,7 +77,7 @@ void Test3() + const char* params = "answer=42&foo=bar"; + int l = strlen(params); + +- happyhttp::Connection conn( "www.scumways.com", 80 ); ++ happyhttp::Connection conn( "scumways.com", 80 ); + conn.setcallbacks( OnBegin, OnData, OnComplete, 0 ); + + conn.putrequest( "POST", "/happyhttp/test.php" ); diff --git a/third_party/happyhttp/src/happyhttp.cpp b/third_party/happyhttp/src/happyhttp.cpp index 9e566735f6..8c8548f47c 100644 --- a/third_party/happyhttp/src/happyhttp.cpp +++ b/third_party/happyhttp/src/happyhttp.cpp @@ -49,7 +49,7 @@ #include #include -#ifdef __APPLE__ +#ifndef _WIN32 #define _stricmp strcasecmp #endif diff --git a/third_party/happyhttp/src/test.cpp b/third_party/happyhttp/src/test.cpp index f3d39d1424..3ce74b47d9 100644 --- a/third_party/happyhttp/src/test.cpp +++ b/third_party/happyhttp/src/test.cpp @@ -31,7 +31,7 @@ void Test1() { puts("-----------------Test1------------------------" ); // simple simple GET - happyhttp::Connection conn( "www.scumways.com", 80 ); + happyhttp::Connection conn( "scumways.com", 80 ); conn.setcallbacks( OnBegin, OnData, OnComplete, 0 ); conn.request( "GET", "/happyhttp/test.php", 0, 0,0 ); @@ -57,7 +57,7 @@ void Test2() const char* body = "answer=42&name=Bubba"; - happyhttp::Connection conn( "www.scumways.com", 80 ); + happyhttp::Connection conn( "scumways.com", 80 ); conn.setcallbacks( OnBegin, OnData, OnComplete, 0 ); conn.request( "POST", "/happyhttp/test.php", @@ -77,7 +77,7 @@ void Test3() const char* params = "answer=42&foo=bar"; int l = strlen(params); - happyhttp::Connection conn( "www.scumways.com", 80 ); + happyhttp::Connection conn( "scumways.com", 80 ); conn.setcallbacks( OnBegin, OnData, OnComplete, 0 ); conn.putrequest( "POST", "/happyhttp/test.php" );