资源简介
由c语言编写的 实现http web服务的程序,可以在linux和windows同时使用。

代码片段和文件信息
// Copyright (c) 2004-2011 Sergey Lyubka
//
// Permission is hereby granted free of charge to any person obtaining a copy
// of this software and associated documentation files (the “Software“) to deal
// in the Software without restriction including without limitation the rights
// to use copy modify merge publish distribute sublicense and/or sell
// copies of the Software and to permit persons to whom the Software is
// furnished to do so subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
// IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER
// LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#include “stdafx.h“
#if defined(_WIN32)
#define _CRT_SECURE_NO_WARNINGS // Disable deprecation warning in VS2005
#else
#define _XOPEN_SOURCE 600 // For PATH_MAX on linux
#endif
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include “mongoose.h“
#ifdef _WIN32
#include
#include
#define PATH_MAX MAX_PATH
#define S_ISDIR(x) ((x) & _S_IFDIR)
#define DIRSEP ‘\\‘
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define sleep(x) Sleep((x) * 1000)
#define WINCDECL __cdecl
#else
#include
#include
#define DIRSEP ‘/‘
#define WINCDECL
#endif // _WIN32
#define MAX_OPTIONS 40
#define MAX_CONF_FILE_LINE_SIZE (8 * 1024)
static int exit_flag;
static char server_name[40]; // Set by init_server_name()
static char config_file[PATH_MAX]; // Set by process_command_line_arguments()
static struct mg_context *ctx; // Set by start_mongoose()
#if !defined(CONFIG_FILE)
#define CONFIG_FILE “mongoose.conf“
#endif /* !CONFIG_FILE */
static void WINCDECL signal_handler(int sig_num) {
exit_flag = sig_num;
}
static void die(const char *fmt ...) {
va_list ap;
char msg[200];
va_start(ap fmt);
vsnprintf(msg sizeof(msg) fmt ap);
va_end(ap);
#if defined(_WIN32)
MessageBox(NULL msg “Error“ MB_OK);
#else
fprintf(stderr “%s\n“ msg);
#endif
exit(EXIT_FAILURE);
}
static void show_usage_and_exit(void) {
const char **names;
int i;
fprintf(stderr “Mongoose version %s (c) Sergey Lyubka built %s\n“
mg_version() __DATE__);
fprintf(stderr “Usage:\n“);
fprintf(stderr “ mongoose -A \n“);
fprintf(stderr “
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 197120 2012-09-24 13:36 HttpServer\Debug\HttpServer.exe
文件 196608 2012-09-24 11:10 HttpServer\Debug\ssleay32.dll
文件 598 2012-09-24 09:18 HttpServer\Debug\www\default.css
文件 310 2012-09-24 09:18 HttpServer\Debug\www\demodyn.htm
文件 2998 2012-09-24 09:18 HttpServer\Debug\www\favicon.ico
文件 2165 2012-09-24 09:18 HttpServer\Debug\www\index.htm
文件 562 2012-09-24 09:18 HttpServer\Debug\www\keytest.htm
文件 2750 2012-09-24 09:18 HttpServer\Debug\www\logo.png
文件 14 2012-09-24 09:18 HttpServer\Debug\www\q.xm
文件 1201 2012-09-24 09:18 HttpServer\Debug\www\ReadMe.txt
文件 6222 2012-09-24 13:36 HttpServer\HttpServer\Debug\BuildLog.htm
文件 4736 2012-09-24 10:42 HttpServer\HttpServer\HttpServer.vcproj
文件 1427 2012-09-24 14:58 HttpServer\HttpServer\HttpServer.vcproj.85F2592F6E7F43C.Administrator.user
文件 1421 2012-09-24 09:18 HttpServer\HttpServer\HttpServer.vcproj.wangzhuan-PC.wangzhuan.user
文件 16349 2012-09-24 10:29 HttpServer\HttpServer\main.cpp
文件 142815 2012-09-24 13:36 HttpServer\HttpServer\mongoose.cpp
文件 10958 2012-09-24 09:18 HttpServer\HttpServer\mongoose.h
文件 5524 2012-09-24 10:30 HttpServer\HttpServer\Release\BuildLog.htm
文件 215 2012-09-24 09:18 HttpServer\HttpServer\stdafx.cpp
文件 195 2012-09-24 09:18 HttpServer\HttpServer\stdafx.h
文件 498 2012-09-24 09:18 HttpServer\HttpServer\targetver.h
文件 464 2012-09-24 09:18 HttpServer\HttpServer\upload.html
文件 598 2012-09-24 09:18 HttpServer\HttpServer\www\default.css
文件 310 2012-09-24 09:18 HttpServer\HttpServer\www\demodyn.htm
文件 2998 2012-09-24 09:18 HttpServer\HttpServer\www\favicon.ico
文件 2165 2012-09-24 09:18 HttpServer\HttpServer\www\index.htm
文件 562 2012-09-24 09:18 HttpServer\HttpServer\www\keytest.htm
文件 2750 2012-09-24 09:18 HttpServer\HttpServer\www\logo.png
文件 14 2012-09-24 09:18 HttpServer\HttpServer\www\q.xm
文件 1201 2012-09-24 09:18 HttpServer\HttpServer\www\ReadMe.txt
............此处省略12个文件信息
- 上一篇:基于C语言的模拟KTV系统
- 下一篇:编译原理 C语言实现词法分析
相关资源
- C++中头文件与源文件的作用详解
- 基于mfc的多线程文件传输
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- C语言代码高亮html输出工具
- 猜数字游戏 c语言代码
- C语言课程设计
- 数字电位器C语言程序
- CCS FFT c语言算法
- 使用C语言编写的病房管理系统
- 通信过程中的RS编译码程序(c语言)
- 利用C++哈希表的方法实现电话号码查
- 计算机二级C语言上机填空,改错,编
- 用回溯法解决八皇后问题C语言实现
- 移木块游戏,可以自编自玩,vc6.0编写
- 简易教务管理系统c语言开发文档
- 操作系统课设 读写者问题 c语言实现
- 小波变换算法 c语言版
- C流程图生成器,用C语言代码 生成C语
- 3des加密算法C语言实现
- 简单的C语言点对点聊天程序
- 单片机c语言源程序(51定时器 八个按
- C++纯文字DOS超小RPG游戏
- 个人日常财务管理系统(C语言)
- MFC数字钟(基于VC6.0)
- c语言电子商务系统
- 小甲鱼C语言课件 源代码
- 将图片转换为C语言数组的程序
- 安科瑞智能电能表MODBUS通讯程序 VC6
- C语言实现的一个内存泄漏检测程序
评论
共有 条评论