资源简介
由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语言实现词法分析
相关资源
- STM32连接EC20使用内置MQTT协议接入阿里
- TM4C123中文手册
- 单片机C语言实战开发108例
- stm32 AD7506
- stc-isp-15xx-v6.86G
- Linux那些事儿之我是USB core
- STC8G1K08A红外遥控点灯
- C语言的嵌入式汇编基本使用.docx(2页
- stm32f103c8t6开发板原理图+pcb
- Arduino 敲琴MIDI电子琴 程序报告.docx
- CAN实验
- LCD驱动芯片ST7701SI SPI接口底层驱动配
- 显示屏操作(stm32f103c8t6(SAN))
- USB CAN Tool 源代码(LabVIEW 2011环境)
- Proteus 8.6仿真STM32F103C6
- atmega128 串口通讯(RS485.c)
- C语言嵌入式Modbus协议栈,支持主站和
- stm32 +w5500 裸机 远程升级 自动dns pi
- 永磁同步电机的FOC控制算法
- arduino I2C设备扫描并串口返回地址(
- Proteus仿真:LCD液晶屏显示.rar
- STM32 PCB封装库 全系列 全网不好找
- 基于STM32F407的W5500 tcpserver(官网例程
- 步进电机调速原理.c
- tm1650+stm32f103源码(board_tm1650.c)
- 颜色识别形状识别STM103嵌入式代码
- 基于STM32的音频信号采样与FFT分析
- 汽车电子编程规范(Unlock-MISRA C 2012)
- cheat engine 7.2源码
- 基于STM32F103C8T6主控板使用BH1750检测光
评论
共有 条评论