From 6897c64c74f9de98fc562ddc065f3ae3ce72e871 Mon Sep 17 00:00:00 2001 From: yhirose Date: Thu, 27 Sep 2012 21:05:36 -0400 Subject: [PATCH] Renamed project name to 'cpp-httplib'. --- README.md | 14 ++++++++------ example/Makefile | 4 ++-- example/hello.cc | 2 +- example/sample.cc | 4 ++-- httpsvrkit.h => httplib.h | 10 +++++----- test/Makefile | 2 +- test/test.cc | 6 +++--- 7 files changed, 22 insertions(+), 20 deletions(-) rename httpsvrkit.h => httplib.h (98%) diff --git a/README.md b/README.md index 2c2d0df..131cec0 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ -httpsvrkit -========== +cpp-httplib +=========== -C++ HTTP sever library inspired by [Sinatra](http://www.sinatrarb.com/) +A C++ HTTP library. [The Boost Software License 1.0](http://www.boost.org/LICENSE_1_0.txt) -Example -------- +Server Example +-------------- - #include +Inspired by [Sinatra](http://www.sinatrarb.com/) + + #include int main(void) { HTTP_SERVER("localhost", 1234) { diff --git a/example/Makefile b/example/Makefile index acc523b..ed9ad04 100644 --- a/example/Makefile +++ b/example/Makefile @@ -11,8 +11,8 @@ endif all: sample hello -sample : sample.cc ../httpsvrkit.h +sample : sample.cc ../httplib.h $(CC) -o sample $(CFLAGS) -I.. sample.cc -hello : hello.cc ../httpsvrkit.h +hello : hello.cc ../httplib.h $(CC) -o hello $(CFLAGS) -I.. hello.cc diff --git a/example/hello.cc b/example/hello.cc index 7d8d538..aacacdf 100644 --- a/example/hello.cc +++ b/example/hello.cc @@ -5,7 +5,7 @@ // The Boost Software License 1.0 // -#include +#include int main(void) { diff --git a/example/sample.cc b/example/sample.cc index da6d9de..69d21b3 100644 --- a/example/sample.cc +++ b/example/sample.cc @@ -5,11 +5,11 @@ // The Boost Software License 1.0 // -#include +#include #include #include -using namespace httpsvrkit; +using namespace httplib; template void signal(int sig, Fn fn) { diff --git a/httpsvrkit.h b/httplib.h similarity index 98% rename from httpsvrkit.h rename to httplib.h index 2dd859c..a3d5361 100644 --- a/httpsvrkit.h +++ b/httplib.h @@ -1,5 +1,5 @@ // -// httpsvrkit.h +// httplib.h // // Copyright (c) 2012 Yuji Hirose. All rights reserved. // The Boost Software License 1.0 @@ -42,7 +42,7 @@ typedef int socket_t; #include #include -namespace httpsvrkit +namespace httplib { typedef std::map Map; @@ -457,18 +457,18 @@ inline void Server::process_request(FILE* fp_read, FILE* fp_write) } #define HTTP_SERVER(host, port) \ - for (std::shared_ptr svr_ = std::make_shared(host, port); \ + for (std::shared_ptr svr_ = std::make_shared(host, port); \ svr_; \ svr_->run(), svr_.reset()) #define GET(url, body) \ - svr_->get(url, [&](httpsvrkit::Context& cxt) { \ + svr_->get(url, [&](httplib::Context& cxt) { \ const auto& req_ = cxt.request; \ auto& res_ = cxt.response; \ body \ }); -} // namespace httpsvrkit +} // namespace httplib #endif diff --git a/test/Makefile b/test/Makefile index 172ca94..50a6880 100644 --- a/test/Makefile +++ b/test/Makefile @@ -9,7 +9,7 @@ CC = g++ CFLAGS = -std=c++11 -g endif -test : test.cc ../httpsvrkit.h +test : test.cc ../httplib.h $(CC) -o test $(CFLAGS) -I.. -I. test.cc gtest/gtest-all.cc gtest/gtest_main.cc .PHONY : run diff --git a/test/test.cc b/test/test.cc index df87776..7acfc4b 100644 --- a/test/test.cc +++ b/test/test.cc @@ -1,10 +1,10 @@ #include -#include +#include #include using namespace std; -using namespace httpsvrkit; +using namespace httplib; TEST(SplitTest, ParseQueryString) { @@ -55,7 +55,7 @@ TEST(ServerTest, GetMethod) { Server svr("localhost", 1914); - svr.get("hi", [&](httpsvrkit::Context& cxt) { + svr.get("hi", [&](httplib::Context& cxt) { cxt.response.set_content("Hello World!"); });