reorganized httpd files

This commit is contained in:
hyung-hwan 2012-05-31 10:18:50 +00:00
parent 08e1e7c9a8
commit 2c0fbbb45b
8 changed files with 3055 additions and 2849 deletions

View File

@ -12,6 +12,9 @@ libqsenet_la_SOURCES = \
htrd.c \
httpd.h \
httpd.c \
httpd-cgi.c \
httpd-proxy.c \
httpd-resol.c \
httpd-task.c
libqsenet_la_LDFLAGS = -version-info 1:0:0 -no-undefined -L../cmn -L$(libdir)

View File

@ -73,7 +73,7 @@ am__installdirs = "$(DESTDIR)$(libdir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libqsenet_la_DEPENDENCIES =
am_libqsenet_la_OBJECTS = http.lo htre.lo htrd.lo httpd.lo \
httpd-task.lo
httpd-cgi.lo httpd-proxy.lo httpd-resol.lo httpd-task.lo
libqsenet_la_OBJECTS = $(am_libqsenet_la_OBJECTS)
libqsenet_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@ -255,6 +255,9 @@ libqsenet_la_SOURCES = \
htrd.c \
httpd.h \
httpd.c \
httpd-cgi.c \
httpd-proxy.c \
httpd-resol.c \
httpd-task.c
libqsenet_la_LDFLAGS = -version-info 1:0:0 -no-undefined -L../cmn -L$(libdir)
@ -336,6 +339,9 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htrd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htre.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpd-cgi.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpd-proxy.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpd-resol.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpd-task.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpd.Plo@am__quote@

1452
qse/lib/net/httpd-cgi.c Normal file

File diff suppressed because it is too large Load Diff

1465
qse/lib/net/httpd-proxy.c Normal file

File diff suppressed because it is too large Load Diff

95
qse/lib/net/httpd-resol.c Normal file
View File

@ -0,0 +1,95 @@
/*
* $Id$
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
QSE is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
QSE 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with QSE. If not, see <htrd://www.gnu.org/licenses/>.
*/
#if defined(_WIN32) || defined(__DOS__) || defined(__OS2__)
/* UNSUPPORTED YET.. */
/* TODO: IMPLEMENT THIS */
#else
#include "httpd.h"
#include "../cmn/mem.h"
typedef struct task_resol_arg_t task_resol_arg_t;
struct task_resol_arg_t
{
const qse_mchar_t* path;
qse_htre_t* req;
int nph;
};
typedef struct task_resol_t task_resol_t;
struct task_resol_t
{
int init_failed;
qse_httpd_t* httpd;
const qse_mchar_t* path;
qse_http_version_t version;
int keepalive; /* taken from the request */
};
static int task_init_resol (
qse_httpd_t* httpd, qse_httpd_client_t* client, qse_httpd_task_t* task)
{
task_resol_t* resol;
resol = (task_resol_t*)qse_httpd_gettaskxtn (httpd, task);
QSE_MEMSET (resol, 0, QSE_SIZEOF(*resol));
resol->httpd = httpd;
task->ctx = resol;
return 0;
}
static void task_fini_resol (
qse_httpd_t* httpd, qse_httpd_client_t* client, qse_httpd_task_t* task)
{
task_resol_t* resol = (task_resol_t*)task->ctx;
qse_printf (QSE_T("task_fini_resol\n"));
}
static int task_main_resol (
qse_httpd_t* httpd, qse_httpd_client_t* client, qse_httpd_task_t* task)
{
return 0;
}
qse_httpd_task_t* qse_httpd_entaskresol (
qse_httpd_t* httpd,
qse_httpd_client_t* client,
qse_httpd_task_t* pred,
const qse_mchar_t* host)
{
qse_httpd_task_t task;
task_resol_arg_t arg;
QSE_MEMSET (&task, 0, QSE_SIZEOF(task));
task.init = task_init_resol;
task.fini = task_fini_resol;
task.main = task_main_resol;
task.ctx = &arg;
return qse_httpd_entask (
httpd, client, pred, &task, QSE_SIZEOF(task_resol_t)
);
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -62,6 +62,8 @@ static void free_server_list (
static int perform_client_task (
qse_httpd_t* httpd, void* mux, qse_ubi_t handle, int mask, void* cbarg);
qse_http_version_t qse_http_v11 = { 1, 1 };
qse_httpd_t* qse_httpd_open (qse_mmgr_t* mmgr, qse_size_t xtnsize)
{
qse_httpd_t* httpd;

View File

@ -61,10 +61,15 @@ struct qse_httpd_t
void* mux;
};
#define MAX_SEND_SIZE 4096
#ifdef __cplusplus
extern "C" {
#endif
extern qse_http_version_t qse_http_v11;
int qse_httpd_init (
qse_httpd_t* httpd,
qse_mmgr_t* mmgr
@ -74,6 +79,14 @@ void qse_httpd_fini (
qse_httpd_t* httpd
);
qse_httpd_task_t* qse_httpd_entask_error (
qse_httpd_t* httpd,
qse_httpd_client_t* client,
qse_httpd_task_t* pred,
int code,
const qse_http_version_t* version,
int keepalive
);
#ifdef __cplusplus
}