Done the basics of http server

Added mime type detection
Lots still todo, directory index files auto indexing(?)
This commit is contained in:
2014-07-29 21:00:19 +01:00
parent 17693097a5
commit 31e1ff4f97
15 changed files with 391 additions and 14 deletions

View File

@@ -42,6 +42,7 @@ OBJECTFILES= \
${OBJECTDIR}/src/http-server.o \
${OBJECTDIR}/src/http.o \
${OBJECTDIR}/src/main.o \
${OBJECTDIR}/src/mime.o \
${OBJECTDIR}/src/socket.o
@@ -59,7 +60,7 @@ FFLAGS=
ASFLAGS=
# Link Libraries and Options
LDLIBSOPTIONS=
LDLIBSOPTIONS=-lmagic
# Build Targets
.build-conf: ${BUILD_SUBPROJECTS}
@@ -104,6 +105,11 @@ ${OBJECTDIR}/src/main.o: nbproject/Makefile-${CND_CONF}.mk src/main.c
${RM} "$@.d"
$(COMPILE.c) -g -Werror -DINI_ALLOW_BOM=0 -DINI_ALLOW_MULTILINE=0 -D_GNU_SOURCE -Ilib -std=c99 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/src/main.o src/main.c
${OBJECTDIR}/src/mime.o: nbproject/Makefile-${CND_CONF}.mk src/mime.c
${MKDIR} -p ${OBJECTDIR}/src
${RM} "$@.d"
$(COMPILE.c) -g -Werror -DINI_ALLOW_BOM=0 -DINI_ALLOW_MULTILINE=0 -D_GNU_SOURCE -Ilib -std=c99 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/src/mime.o src/mime.c
${OBJECTDIR}/src/socket.o: nbproject/Makefile-${CND_CONF}.mk src/socket.c
${MKDIR} -p ${OBJECTDIR}/src
${RM} "$@.d"

View File

@@ -42,6 +42,7 @@ OBJECTFILES= \
${OBJECTDIR}/src/http-server.o \
${OBJECTDIR}/src/http.o \
${OBJECTDIR}/src/main.o \
${OBJECTDIR}/src/mime.o \
${OBJECTDIR}/src/socket.o
@@ -104,6 +105,11 @@ ${OBJECTDIR}/src/main.o: src/main.c
${RM} "$@.d"
$(COMPILE.c) -O2 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/src/main.o src/main.c
${OBJECTDIR}/src/mime.o: src/mime.c
${MKDIR} -p ${OBJECTDIR}/src
${RM} "$@.d"
$(COMPILE.c) -O2 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/src/mime.o src/mime.c
${OBJECTDIR}/src/socket.o: src/socket.c
${MKDIR} -p ${OBJECTDIR}/src
${RM} "$@.d"

View File

@@ -11,6 +11,7 @@
<itemPath>lib/http_parser.h</itemPath>
<itemPath>lib/ini.h</itemPath>
<itemPath>src/main.h</itemPath>
<itemPath>src/mime.h</itemPath>
<itemPath>src/socket.h</itemPath>
</logicalFolder>
<logicalFolder name="ResourceFiles"
@@ -27,6 +28,7 @@
<itemPath>lib/http_parser.c</itemPath>
<itemPath>lib/ini.c</itemPath>
<itemPath>src/main.c</itemPath>
<itemPath>src/mime.c</itemPath>
<itemPath>src/socket.c</itemPath>
</logicalFolder>
<logicalFolder name="TestFiles"
@@ -67,6 +69,11 @@
</preprocessorList>
<warningLevel>3</warningLevel>
</cTool>
<linkerTool>
<linkerLibItems>
<linkerLibLibItem>magic</linkerLibLibItem>
</linkerLibItems>
</linkerTool>
</compileType>
<item path="content/error.html" ex="false" tool="3" flavor2="0">
</item>
@@ -104,6 +111,10 @@
</item>
<item path="src/main.h" ex="false" tool="3" flavor2="0">
</item>
<item path="src/mime.c" ex="false" tool="0" flavor2="0">
</item>
<item path="src/mime.h" ex="false" tool="3" flavor2="0">
</item>
<item path="src/socket.c" ex="false" tool="0" flavor2="0">
</item>
<item path="src/socket.h" ex="false" tool="3" flavor2="0">
@@ -165,6 +176,10 @@
</item>
<item path="src/main.h" ex="false" tool="3" flavor2="0">
</item>
<item path="src/mime.c" ex="false" tool="0" flavor2="0">
</item>
<item path="src/mime.h" ex="false" tool="3" flavor2="0">
</item>
<item path="src/socket.c" ex="false" tool="0" flavor2="0">
</item>
<item path="src/socket.h" ex="false" tool="3" flavor2="0">

View File

@@ -8,6 +8,8 @@
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/home/sam/NetBeansProjects/KHttp/src/socket.c</file>
<file>file:/home/sam/NetBeansProjects/KHttp/content/khttpd.ini</file>
<file>file:/home/sam/NetBeansProjects/KHttp/src/config.c</file>
<file>file:/home/sam/NetBeansProjects/KHttp/src/http-server.h</file>
<file>file:/home/sam/NetBeansProjects/KHttp/src/http.c</file>
<file>file:/home/sam/NetBeansProjects/KHttp/src/http-reader.h</file>
@@ -16,8 +18,10 @@
<file>file:/home/sam/NetBeansProjects/KHttp/content/error.html</file>
<file>file:/home/sam/NetBeansProjects/KHttp/src/main.c</file>
<file>file:/home/sam/NetBeansProjects/KHttp/src/http-server.c</file>
<file>file:/home/sam/NetBeansProjects/KHttp/lib/ini.c</file>
<file>file:/home/sam/NetBeansProjects/KHttp/src/http.h</file>
<file>file:/home/sam/NetBeansProjects/KHttp/src/http-reader.c</file>
<file>file:/home/sam/NetBeansProjects/KHttp/src/config.h</file>
</group>
</open-files>
</project-private>