forked from eantcal/thttpd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New MIT license, remove makefile, add cmake support, files tree refac…
…toring
- Loading branch information
antonino.calderone
committed
Jul 12, 2019
1 parent
cdf93d1
commit bd8b86c
Showing
26 changed files
with
201 additions
and
713 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cmake_minimum_required(VERSION 2.8.12) | ||
|
||
include_directories(. include) | ||
|
||
file(GLOB SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/cppsrc/*.cc") | ||
|
||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14" ) | ||
|
||
add_executable(thttpd ${SOURCES}) | ||
|
||
target_link_libraries(thttpd -pthread) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
------------------------------------------------------------------------------- | ||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
SUCH DAMAGE. | ||
This file is part of thttpd | ||
Copyright (c) Antonino Calderone ([email protected]) | ||
All rights reserved. | ||
Licensed under the MIT License. | ||
See COPYING file in the project root for full license information. | ||
------------------------------------------------------------------------------- | ||
|
||
TinyHttpServer is a lightweight web server implemented in C++11 | ||
|
@@ -37,7 +31,14 @@ tiny_http_server.vcxproj | |
information about the platforms, configurations, and project features selected with the | ||
Application Wizard. | ||
|
||
makefile | ||
This is a makefile | ||
CMakeLists.txt | ||
This is a cmakefile | ||
|
||
|
||
------------------------------------------------------------------------------- | ||
* Building TinyHttpServer using cmake | ||
|
||
Create build directory and run cmake: | ||
mkdir build && cd build && cmake .. | ||
|
||
|
||
Author A. Calderone - [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,13 @@ | ||
/* | ||
* gen_utils.cc | ||
* | ||
* This file is part of TinyHttpServer | ||
* | ||
* TinyHttpServer is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* TinyHttpServer is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with TinyHttpServer; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US | ||
* | ||
* Author: Antonino Calderone, <[email protected]> | ||
* | ||
*/ | ||
// | ||
// This file is part of thttpd | ||
// Copyright (c) Antonino Calderone ([email protected]) | ||
// All rights reserved. | ||
// Licensed under the MIT License. | ||
// See COPYING file in the project root for full license information. | ||
// | ||
|
||
|
||
/* -------------------------------------------------------------------------- */ | ||
|
||
/// \file gen_utils.cc | ||
/// \brief Collection of general purpose utilities | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,28 @@ | ||
/* | ||
* http_mime.cc | ||
* | ||
* This file is part of TinyHttpServer | ||
* | ||
* TinyHttpServer is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* TinyHttpServer is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with TinyHttpServer; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US | ||
* | ||
* Author: Antonino Calderone, <[email protected]> | ||
* | ||
*/ | ||
// | ||
// This file is part of thttpd | ||
// Copyright (c) Antonino Calderone ([email protected]) | ||
// All rights reserved. | ||
// Licensed under the MIT License. | ||
// See COPYING file in the project root for full license information. | ||
// | ||
|
||
|
||
// ---------------------------------------------------------------------------- | ||
|
||
/* -------------------------------------------------------------------------- */ | ||
|
||
/// \file http_mime.cc | ||
/// \brief Definition of MIME table | ||
|
||
|
||
// ---------------------------------------------------------------------------- | ||
|
||
/* -------------------------------------------------------------------------- */ | ||
|
||
#include "http_server.h" | ||
|
||
#include <map> | ||
#include <string> | ||
|
||
|
||
/* -------------------------------------------------------------------------- */ | ||
|
||
std::map<std::string, std::string> http_response_t::_mime_tbl = { | ||
{ ".3dm", "x-world/x-3dmf" }, { ".3dmf", "x-world/x-3dmf" }, | ||
{ ".a", "application/octet-stream" }, | ||
|
@@ -304,4 +290,5 @@ std::map<std::string, std::string> http_response_t::_mime_tbl = { | |
}; | ||
|
||
|
||
// ---------------------------------------------------------------------------- | ||
/* -------------------------------------------------------------------------- */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,18 @@ | ||
/* | ||
* http_server.cc | ||
* | ||
* This file is part of TinyHttpServer | ||
* | ||
* TinyHttpServer is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* TinyHttpServer is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with TinyHttpServer; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US | ||
* | ||
* Author: Antonino Calderone, <[email protected]> | ||
* | ||
*/ | ||
// | ||
// This file is part of thttpd | ||
// Copyright (c) Antonino Calderone ([email protected]) | ||
// All rights reserved. | ||
// Licensed under the MIT License. | ||
// See COPYING file in the project root for full license information. | ||
// | ||
|
||
|
||
/* -------------------------------------------------------------------------- */ | ||
|
||
/// \file http_server.cc | ||
/// \brief Implementation of HTTP classes | ||
|
||
|
||
/* -------------------------------------------------------------------------- */ | ||
// HTTP Server | ||
|
||
|
@@ -212,8 +200,8 @@ http_request_t::handle_t http_socket_t::recv() | |
case crlf_t::CR2: | ||
s = (c == '\n') ? crlf_t::LF2 : crlf_t::IDLE; | ||
break; | ||
default: | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
return s == crlf_t::LF2; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,10 @@ | ||
/* | ||
* os_dep.cc | ||
* | ||
* This file is part of TinyHttpServer | ||
* | ||
* TinyHttpServer is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* TinyHttpServer is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with TinyHttpServer; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US | ||
* | ||
* Author: Antonino Calderone, <[email protected]> | ||
* | ||
*/ | ||
// | ||
// This file is part of thttpd | ||
// Copyright (c) Antonino Calderone ([email protected]) | ||
// All rights reserved. | ||
// Licensed under the MIT License. | ||
// See COPYING file in the project root for full license information. | ||
// | ||
|
||
|
||
/* -------------------------------------------------------------------------- */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,14 @@ | ||
/* | ||
* socket_utils.cc | ||
* | ||
* This file is part of TinyHttpServer | ||
* | ||
* TinyHttpServer is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* TinyHttpServer is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with TinyHttpServer; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US | ||
* | ||
* Author: Antonino Calderone, <[email protected]> | ||
* | ||
*/ | ||
// | ||
// This file is part of thttpd | ||
// Copyright (c) Antonino Calderone ([email protected]) | ||
// All rights reserved. | ||
// Licensed under the MIT License. | ||
// See COPYING file in the project root for full license information. | ||
// | ||
|
||
|
||
/* -------------------------------------------------------------------------- */ | ||
|
||
/// \file socket_utils.cc | ||
/// \brief Implementation of socket classes containing some | ||
/// useful stuff cross-platform for manipulating socket | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,10 @@ | ||
/* | ||
* tiny_http_server.cc | ||
* | ||
* This file is part of TinyHttpServer | ||
* | ||
* TinyHttpServer is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* TinyHttpServer is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with TinyHttpServer; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US | ||
* | ||
* Author: Antonino Calderone, <[email protected]> | ||
* | ||
*/ | ||
// | ||
// This file is part of thttpd | ||
// Copyright (c) Antonino Calderone ([email protected]) | ||
// All rights reserved. | ||
// Licensed under the MIT License. | ||
// See COPYING file in the project root for full license information. | ||
// | ||
|
||
|
||
/* -------------------------------------------------------------------------- */ | ||
|
@@ -39,7 +24,9 @@ class prog_args_t { | |
std::string _prog_name; | ||
std::string _command_line; | ||
std::string _web_root = HTTP_SERVER_WROOT; | ||
|
||
tcp_socket_t::port_t _http_server_port = HTTP_SERVER_PORT; | ||
|
||
bool _show_help = false; | ||
bool _show_ver = false; | ||
bool _error = false; | ||
|
Oops, something went wrong.