1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-07-31 08:24:23 +03:00

Added new C embedding example

This commit is contained in:
Thomas Davis
2013-09-01 03:53:52 -04:00
parent 7f7f0abcfc
commit c67fbc7caf
7 changed files with 354 additions and 2 deletions

View File

@ -19,6 +19,7 @@ Changes
- Externalized logging function cry() as mg_cry() - Externalized logging function cry() as mg_cry()
- Added CivetServer::getCookie method (Hariprasad Kamath) - Added CivetServer::getCookie method (Hariprasad Kamath)
- Added CivetServer::getHeader method (Hariprasad Kamath) - Added CivetServer::getHeader method (Hariprasad Kamath)
- Added new basic C embedding example
Release Notes v1.3 Release Notes v1.3
=== ===

View File

@ -11,54 +11,90 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "civetweb_lua", "civetweb_lu
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua_lib", "lua_lib\lua_lib.vcxproj", "{8F5E5D77-D269-4665-9E27-1045DA6CF0D8}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua_lib", "lua_lib\lua_lib.vcxproj", "{8F5E5D77-D269-4665-9E27-1045DA6CF0D8}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ex_embedded_c", "ex_embedded_c\ex_embedded_c.vcxproj", "{882EC43C-2EEE-434B-A711-C844108D29C6}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
Release|Mixed Platforms = Release|Mixed Platforms
Release|Win32 = Release|Win32 Release|Win32 = Release|Win32
Release|x64 = Release|x64 Release|x64 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E23B0040-F485-43D6-AA24-B34F9FED8484}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{E23B0040-F485-43D6-AA24-B34F9FED8484}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{E23B0040-F485-43D6-AA24-B34F9FED8484}.Debug|Win32.ActiveCfg = Debug|Win32 {E23B0040-F485-43D6-AA24-B34F9FED8484}.Debug|Win32.ActiveCfg = Debug|Win32
{E23B0040-F485-43D6-AA24-B34F9FED8484}.Debug|Win32.Build.0 = Debug|Win32 {E23B0040-F485-43D6-AA24-B34F9FED8484}.Debug|Win32.Build.0 = Debug|Win32
{E23B0040-F485-43D6-AA24-B34F9FED8484}.Debug|x64.ActiveCfg = Debug|x64 {E23B0040-F485-43D6-AA24-B34F9FED8484}.Debug|x64.ActiveCfg = Debug|x64
{E23B0040-F485-43D6-AA24-B34F9FED8484}.Debug|x64.Build.0 = Debug|x64 {E23B0040-F485-43D6-AA24-B34F9FED8484}.Debug|x64.Build.0 = Debug|x64
{E23B0040-F485-43D6-AA24-B34F9FED8484}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{E23B0040-F485-43D6-AA24-B34F9FED8484}.Release|Mixed Platforms.Build.0 = Release|Win32
{E23B0040-F485-43D6-AA24-B34F9FED8484}.Release|Win32.ActiveCfg = Release|Win32 {E23B0040-F485-43D6-AA24-B34F9FED8484}.Release|Win32.ActiveCfg = Release|Win32
{E23B0040-F485-43D6-AA24-B34F9FED8484}.Release|Win32.Build.0 = Release|Win32 {E23B0040-F485-43D6-AA24-B34F9FED8484}.Release|Win32.Build.0 = Release|Win32
{E23B0040-F485-43D6-AA24-B34F9FED8484}.Release|x64.ActiveCfg = Release|x64 {E23B0040-F485-43D6-AA24-B34F9FED8484}.Release|x64.ActiveCfg = Release|x64
{E23B0040-F485-43D6-AA24-B34F9FED8484}.Release|x64.Build.0 = Release|x64 {E23B0040-F485-43D6-AA24-B34F9FED8484}.Release|x64.Build.0 = Release|x64
{58B93E94-7766-435E-93AE-42A2FB5D99B1}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{58B93E94-7766-435E-93AE-42A2FB5D99B1}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{58B93E94-7766-435E-93AE-42A2FB5D99B1}.Debug|Win32.ActiveCfg = Debug|Win32 {58B93E94-7766-435E-93AE-42A2FB5D99B1}.Debug|Win32.ActiveCfg = Debug|Win32
{58B93E94-7766-435E-93AE-42A2FB5D99B1}.Debug|Win32.Build.0 = Debug|Win32 {58B93E94-7766-435E-93AE-42A2FB5D99B1}.Debug|Win32.Build.0 = Debug|Win32
{58B93E94-7766-435E-93AE-42A2FB5D99B1}.Debug|x64.ActiveCfg = Debug|x64 {58B93E94-7766-435E-93AE-42A2FB5D99B1}.Debug|x64.ActiveCfg = Debug|x64
{58B93E94-7766-435E-93AE-42A2FB5D99B1}.Debug|x64.Build.0 = Debug|x64 {58B93E94-7766-435E-93AE-42A2FB5D99B1}.Debug|x64.Build.0 = Debug|x64
{58B93E94-7766-435E-93AE-42A2FB5D99B1}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{58B93E94-7766-435E-93AE-42A2FB5D99B1}.Release|Mixed Platforms.Build.0 = Release|Win32
{58B93E94-7766-435E-93AE-42A2FB5D99B1}.Release|Win32.ActiveCfg = Release|Win32 {58B93E94-7766-435E-93AE-42A2FB5D99B1}.Release|Win32.ActiveCfg = Release|Win32
{58B93E94-7766-435E-93AE-42A2FB5D99B1}.Release|Win32.Build.0 = Release|Win32 {58B93E94-7766-435E-93AE-42A2FB5D99B1}.Release|Win32.Build.0 = Release|Win32
{58B93E94-7766-435E-93AE-42A2FB5D99B1}.Release|x64.ActiveCfg = Release|x64 {58B93E94-7766-435E-93AE-42A2FB5D99B1}.Release|x64.ActiveCfg = Release|x64
{58B93E94-7766-435E-93AE-42A2FB5D99B1}.Release|x64.Build.0 = Release|x64 {58B93E94-7766-435E-93AE-42A2FB5D99B1}.Release|x64.Build.0 = Release|x64
{4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Debug|Win32.ActiveCfg = Debug|Win32 {4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Debug|Win32.ActiveCfg = Debug|Win32
{4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Debug|Win32.Build.0 = Debug|Win32 {4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Debug|Win32.Build.0 = Debug|Win32
{4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Debug|x64.ActiveCfg = Debug|x64 {4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Debug|x64.ActiveCfg = Debug|x64
{4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Debug|x64.Build.0 = Debug|x64 {4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Debug|x64.Build.0 = Debug|x64
{4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Release|Mixed Platforms.Build.0 = Release|Win32
{4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Release|Win32.ActiveCfg = Release|Win32 {4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Release|Win32.ActiveCfg = Release|Win32
{4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Release|Win32.Build.0 = Release|Win32 {4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Release|Win32.Build.0 = Release|Win32
{4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Release|x64.ActiveCfg = Release|x64 {4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Release|x64.ActiveCfg = Release|x64
{4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Release|x64.Build.0 = Release|x64 {4308C5EE-45E4-45D8-9D73-6C4E2587AD78}.Release|x64.Build.0 = Release|x64
{9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Debug|Win32.ActiveCfg = Debug|Win32 {9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Debug|Win32.ActiveCfg = Debug|Win32
{9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Debug|Win32.Build.0 = Debug|Win32 {9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Debug|Win32.Build.0 = Debug|Win32
{9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Debug|x64.ActiveCfg = Debug|x64 {9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Debug|x64.ActiveCfg = Debug|x64
{9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Debug|x64.Build.0 = Debug|x64 {9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Debug|x64.Build.0 = Debug|x64
{9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Release|Mixed Platforms.Build.0 = Release|Win32
{9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Release|Win32.ActiveCfg = Release|Win32 {9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Release|Win32.ActiveCfg = Release|Win32
{9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Release|Win32.Build.0 = Release|Win32 {9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Release|Win32.Build.0 = Release|Win32
{9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Release|x64.ActiveCfg = Release|x64 {9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Release|x64.ActiveCfg = Release|x64
{9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Release|x64.Build.0 = Release|x64 {9BE9C008-E851-42B1-A034-BD4630AE4CD6}.Release|x64.Build.0 = Release|x64
{8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Debug|Win32.ActiveCfg = Debug|Win32 {8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Debug|Win32.ActiveCfg = Debug|Win32
{8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Debug|Win32.Build.0 = Debug|Win32 {8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Debug|Win32.Build.0 = Debug|Win32
{8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Debug|x64.ActiveCfg = Debug|x64 {8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Debug|x64.ActiveCfg = Debug|x64
{8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Debug|x64.Build.0 = Debug|x64 {8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Debug|x64.Build.0 = Debug|x64
{8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Release|Mixed Platforms.Build.0 = Release|Win32
{8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Release|Win32.ActiveCfg = Release|Win32 {8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Release|Win32.ActiveCfg = Release|Win32
{8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Release|Win32.Build.0 = Release|Win32 {8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Release|Win32.Build.0 = Release|Win32
{8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Release|x64.ActiveCfg = Release|x64 {8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Release|x64.ActiveCfg = Release|x64
{8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Release|x64.Build.0 = Release|x64 {8F5E5D77-D269-4665-9E27-1045DA6CF0D8}.Release|x64.Build.0 = Release|x64
{882EC43C-2EEE-434B-A711-C844108D29C6}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{882EC43C-2EEE-434B-A711-C844108D29C6}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{882EC43C-2EEE-434B-A711-C844108D29C6}.Debug|Win32.ActiveCfg = Debug|Win32
{882EC43C-2EEE-434B-A711-C844108D29C6}.Debug|Win32.Build.0 = Debug|Win32
{882EC43C-2EEE-434B-A711-C844108D29C6}.Debug|x64.ActiveCfg = Debug|x64
{882EC43C-2EEE-434B-A711-C844108D29C6}.Debug|x64.Build.0 = Debug|x64
{882EC43C-2EEE-434B-A711-C844108D29C6}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{882EC43C-2EEE-434B-A711-C844108D29C6}.Release|Mixed Platforms.Build.0 = Release|Win32
{882EC43C-2EEE-434B-A711-C844108D29C6}.Release|Win32.ActiveCfg = Release|Win32
{882EC43C-2EEE-434B-A711-C844108D29C6}.Release|Win32.Build.0 = Release|Win32
{882EC43C-2EEE-434B-A711-C844108D29C6}.Release|x64.ActiveCfg = Release|x64
{882EC43C-2EEE-434B-A711-C844108D29C6}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -0,0 +1,159 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\examples\embedded_c\embedded_c.c" />
<ClCompile Include="..\..\src\civetweb.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\civetweb.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{882EC43C-2EEE-434B-A711-C844108D29C6}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>ex_embedded_c</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)\$(Configuration)\$(Platform)</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)\$(Configuration)\$(Platform)</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\$(Configuration)\$(Platform)</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\$(Configuration)\$(Platform)</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\civetweb.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\examples\embedded_c\embedded_c.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\civetweb.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -0,0 +1,36 @@
#
# Copyright (c) 2013 No Face Press, LLC
# License http://opensource.org/licenses/mit-license.php MIT License
#
#This makefile is used to test the other Makefiles
PROG = embedded_c
SRC = embedded_c.c
TOP = ../..
CIVETWEB_LIB = libcivetweb.a
CFLAGS = -I$(TOP)/include $(COPT)
LIBS = -lpthread
include $(TOP)/resources/Makefile.in-os
ifeq ($(TARGET_OS),LINUX)
LIBS += -ldl
endif
all: $(PROG)
$(PROG): $(CIVETWEB_LIB) $(SRC)
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(SRC) $(CIVETWEB_LIB) $(LIBS)
$(CIVETWEB_LIB):
$(MAKE) -C $(TOP) clean lib
cp $(TOP)/$(CIVETWEB_LIB) .
clean:
rm -f $(CIVETWEB_LIB) $(PROG)
.PHONY: all clean

View File

@ -0,0 +1,88 @@
/*
* Copyright (c) 2013 No Face Press, LLC
* License http://opensource.org/licenses/mit-license.php MIT License
*/
// Simple example program on how to use Embedded C++ interface.
#ifdef _WIN32
#include <Windows.h>
#else
#include <unistd.h>
#endif
#include <string.h>
#include "civetweb.h"
#define DOCUMENT_ROOT "."
#define PORT "8888"
#define EXAMPLE_URI "/example"
#define EXIT_URI "/exit"
int exitNow = 0;
int ExampleHandler(struct mg_connection *conn, void *cbdata) {
mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n");
mg_printf(conn, "<html><body>");
mg_printf(conn, "<h2>This is example text!!!</h2>");
mg_printf(conn, "<p>To exit <a href=\"%s\">click here</a></p>",
EXIT_URI);
mg_printf(conn, "</body></html>\n");
return 1;
}
int ExitHandler(struct mg_connection *conn, void *cbdata) {
mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\n");
mg_printf(conn, "Bye!\n");
exitNow = 1;
return 1;
}
int AHandler(struct mg_connection *conn, void *cbdata) {
mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n");
mg_printf(conn, "<html><body>");
mg_printf(conn, "<h2>This is the A handler!!!</h2>");
mg_printf(conn, "</body></html>\n");
return 1;
}
int ABHandler(struct mg_connection *conn, void *cbdata) {
mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n");
mg_printf(conn, "<html><body>");
mg_printf(conn, "<h2>This is the AB handler!!!</h2>");
mg_printf(conn, "</body></html>\n");
return 1;
}
int main(int argc, char *argv[]) {
const char * options[] = { "document_root", DOCUMENT_ROOT,
"listening_ports", PORT, 0 };
struct mg_callbacks callbacks;
struct mg_context *ctx;
memset(&callbacks, 0, sizeof(callbacks));
ctx = mg_start(&callbacks, 0, options);
mg_set_request_handler(ctx,EXAMPLE_URI, ExampleHandler,0);
mg_set_request_handler(ctx,EXIT_URI, ExitHandler,0);
mg_set_request_handler(ctx,"/a", AHandler,0);
mg_set_request_handler(ctx,"/a/b", ABHandler,0); // going out of order with this to see if it will work.
printf("Browse files at http://localhost:%s/\n", PORT);
printf("Run example at http://localhost:%s%s\n", PORT, EXAMPLE_URI);
printf("Exit at http://localhost:%s%s\n", PORT, EXIT_URI);
while (!exitNow) {
#ifdef _WIN32
Sleep(1000);
#else
sleep(1);
#endif
}
printf("Bye!\n");
return 0;
}

View File

@ -26,6 +26,10 @@ dmg:
$(MAKE) -C $(TOP) -f Makefile.osx clean package $(MAKE) -C $(TOP) -f Makefile.osx clean package
buildexamples: buildexamples:
$(MAKE) -C $(TOP)/examples/embedded_c clean all
$(MAKE) -C $(TOP)/examples/embedded_c clean
$(MAKE) -C $(TOP)/examples/embedded_cpp clean all
$(MAKE) -C $(TOP)/examples/embedded_cpp clean
$(MAKE) -C $(TOP)/examples/chat clean all $(MAKE) -C $(TOP)/examples/chat clean all
$(MAKE) -C $(TOP)/examples/chat clean $(MAKE) -C $(TOP)/examples/chat clean
$(MAKE) -C $(TOP)/examples/hello clean all $(MAKE) -C $(TOP)/examples/hello clean all
@ -36,8 +40,6 @@ buildexamples:
$(MAKE) -C $(TOP)/examples/upload clean $(MAKE) -C $(TOP)/examples/upload clean
$(MAKE) -C $(TOP)/examples/websocket clean all $(MAKE) -C $(TOP)/examples/websocket clean all
$(MAKE) -C $(TOP)/examples/websocket clean $(MAKE) -C $(TOP)/examples/websocket clean
$(MAKE) -C $(TOP)/examples/embedded_cpp clean all
$(MAKE) -C $(TOP)/examples/embedded_cpp clean
buildoptions: buildoptions:
$(MAKE) -C $(TOP) clean build $(MAKE) -C $(TOP) clean build