#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
#include<assert.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<arpa/inet.h>
#include<netinet/in.h>
#include<fcntl.h>
#include<sys/stat.h>
#define DATALENGTH 1024
#define PATHLENGTH 128
//发送HTTP应答报头
void SendHeadData(int c,int size,int flag)
{
char buff[DATALENGTH]="http/1.0";
if(flag)
{
strcat(buff,"200 OK\r\n");
}
else
{
strcat(buff,"404 Not Found\r\n");
}
strcat(buff,"Server:MyWeb/1.0\r\n");
strcat(buff,"Content-Length:");
sprintf(buff+strlen
Web服务器——C语言实现
最新推荐文章于 2024-06-17 18:43:56 发布