Patch happyhttp source to make it work in linux.

Also creates gyp file and README file.

Change-Id: I437d49abacf8f9f28dcef782c153a224dbe91468
This commit is contained in:
Kongqun Yang 2013-12-03 10:48:33 -08:00
parent e5ff5834f9
commit 1fade8aa36
6 changed files with 94 additions and 4 deletions

20
third_party/happyhttp/README.packager vendored Normal file
View File

@ -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.

26
third_party/happyhttp/happyhttp.gyp vendored Normal file
View File

@ -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',
],
},
],
}

13
third_party/happyhttp/patches/_stricmp vendored Normal file
View File

@ -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 <string>
#include <algorithm>
-#ifdef __APPLE__
+#ifndef _WIN32
#define _stricmp strcasecmp
#endif

View File

@ -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" );

View File

@ -49,7 +49,7 @@
#include <string>
#include <algorithm>
#ifdef __APPLE__
#ifndef _WIN32
#define _stricmp strcasecmp
#endif

View File

@ -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" );