亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? httpd.c

?? 嵌入式操作系統(tǒng)ECOS的網(wǎng)絡(luò)開發(fā)包
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* =================================================================
 *
 *      httpd.c
 *
 *      A simple embedded HTTP server
 *
 * ================================================================= 
 * ####ECOSGPLCOPYRIGHTBEGIN####
 * -------------------------------------------
 * This file is part of eCos, the Embedded Configurable Operating
 * System.
 * Copyright (C) 2002 Nick Garnett.
 * 
 * eCos is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 or (at your option)
 * any later version.
 * 
 * eCos 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
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with eCos; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
 * 
 * As a special exception, if other files instantiate templates or
 * use macros or inline functions from this file, or you compile this
 * file and link it with other works to produce a work based on this
 * file, this file does not by itself cause the resulting work to be
 * covered by the GNU General Public License. However the source code
 * for this file must still be made available in accordance with
 * section (3) of the GNU General Public License.
 * 
 * This exception does not invalidate any other reasons why a work
 * based on this file might be covered by the GNU General Public
 * License.
 *
 * -------------------------------------------
 * ####ECOSGPLCOPYRIGHTEND####
 * =================================================================
 * #####DESCRIPTIONBEGIN####
 * 
 *  Author(s):    nickg@calivar.com
 *  Contributors: nickg@calivar.com
 *  Date:         2002-10-14
 *  Purpose:      
 *  Description:  
 *               
 * ####DESCRIPTIONEND####
 * 
 * =================================================================
 */

#include <pkgconf/system.h>
#include <pkgconf/isoinfra.h>
#include <pkgconf/httpd.h>

#include <cyg/infra/cyg_trac.h>        /* tracing macros */
#include <cyg/infra/cyg_ass.h>         /* assertion macros */

#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>

#include <network.h>
#include <arpa/inet.h>

#include <cyg/httpd/httpd.h>

/* ================================================================= */

#if 0
#define HTTPD_DIAG diag_printf
#else
#define HTTPD_DIAG(...)
#endif

/* ================================================================= */
/* Server socket address and file descriptor.
 */

static struct sockaddr_in server_address;

static int server_socket = -1;

/* ================================================================= */
/* Thread stacks, etc.
 */

static cyg_uint8 httpd_stacks[CYGNUM_HTTPD_THREAD_COUNT]
                             [CYGNUM_HAL_STACK_SIZE_MINIMUM+
                              CYGNUM_HTTPD_SERVER_BUFFER_SIZE+
                              CYGNUM_HTTPD_THREAD_STACK_SIZE];

static cyg_handle_t httpd_thread[CYGNUM_HTTPD_THREAD_COUNT];

static cyg_thread httpd_thread_object[CYGNUM_HTTPD_THREAD_COUNT];

/* ================================================================= */
/* Filename lookup table
 */

CYG_HAL_TABLE_BEGIN( cyg_httpd_table, httpd_table );
CYG_HAL_TABLE_END( cyg_httpd_table_end, httpd_table );

__externC cyg_httpd_table_entry cyg_httpd_table[];
__externC cyg_httpd_table_entry cyg_httpd_table_end[];

/* ================================================================= */
/* Page not found message
 */

static char cyg_httpd_not_found[] =
"<head><title>Page Not found</title></head>\n"
"<body><h2>The requested URL was not found on this server.</h2></body>\n";

/* ================================================================= */
/* Simple pattern matcher for filenames
 *
 * This performs a simple pattern match between the given name and the
 * pattern. At present the only matching supported is either exact, or
 * if the pattern ends in * then that matches all remaining
 * characters. At some point we might want to implement a more
 * complete regular expression parser here.
 */

static cyg_bool match( char *name, char *pattern )
{
    while( *name != 0 && *pattern != 0 && *name == *pattern )
        name++, pattern++;

    if( *name == 0 && *pattern == 0 )
        return true;

    if( *pattern == '*' )
        return true;

    return false;
}

/* ================================================================= */
/* Main HTTP server
 *
 * This just loops, collects client connections, reads the HTTP
 * header, look it up in the table and calls the handler.
 */

static void cyg_httpd_server( cyg_addrword_t arg )
{
    do
    {
        int err;
        int client_socket;
        struct sockaddr_in client_address;
        int calen;
        int nlc = 0;
        char request[CYGNUM_HTTPD_SERVER_BUFFER_SIZE];
        FILE *client;
        cyg_httpd_table_entry *entry = cyg_httpd_table;
        char *filename;
        char *formdata = NULL;
        char *p;
        cyg_bool success = false;

        /* Wait for a connection.
         */
        client_socket = accept( server_socket, (struct sockaddr *)&client_address, &calen );
        
        HTTPD_DIAG("Connection from %08x[%d]\n",client_address.sin_addr.s_addr,
                   client_address.sin_port);

        /* Convert the file descriptor to a C library FILE object so
         * we can use fprintf() and friends on it.
         */
        client = fdopen( client_socket, "r+");

        /* We are really only interested in the first line.
         */
        fgets( request, sizeof(request), client );

        HTTPD_DIAG("Request >%s<\n", request );
        
        /* Absorb the rest of the header. We nibble it away a
         * character at a time like this to avoid having to define
         * another buffer to read lines into. If we ever need to take
         * more interest in the header fields, we will need to be a
         * lot more sophisticated than this.
         */
        do{
            int c = getc( client );
            HTTPD_DIAG("%c",c);
            if( c == '\n' )
                nlc++;
            else if( c != '\r' )
                nlc = 0;
        } while(nlc < 2);

        /* Extract the filename and any form data being returned.
         * We know that the "GET " request takes 4 bytes.
         * TODO: handle POST type requests as well as GET's.
         */

        filename = p = request+4;

        /* Now scan the filename until we hit a space or a '?'. If we
         * end on a '?' then the rest is a form request. Put NULs at
         * the end of each string.
         */
        while( *p != ' ' && *p != '?' )
            p++;
        if( *p == '?' )
            formdata = p+1;
        *p = 0;

        if( formdata != NULL )
        {
            while( *p != ' ' )
                p++;
            *p = 0;
        }

        HTTPD_DIAG("Request filename >%s< formdata >%s<\n",filename,formdata?formdata:"-NULL-");

        HTTPD_DIAG("table: %08x...%08x\n",cyg_httpd_table, cyg_httpd_table_end);

        /* Now scan the table for a matching entry. If we find one
         * call the handler routine. If that returns true then we
         * terminate the scan, otherwise we keep looking.
         */
        while( entry != cyg_httpd_table_end )
        {
            HTTPD_DIAG("try %08x: %s\n", entry, entry->pattern);
            
            if( match( filename, entry->pattern ) )
            {
                if( (success = entry->handler( client, filename, formdata, entry->arg )) )
                    break;
            }

            entry++;
        }

        /* If we failed to find a match in the table, send a "not
         * found" response.
         * TODO: add an optional fallback to go look for files in
         * some filesystem, somewhere.
         */
        if( !success )
            cyg_httpd_send_html( client, NULL, NULL, cyg_httpd_not_found );

        /* All done, close the connection
         */
        err = fclose( client );
        CYG_ASSERT( err == 0, "fclose() returned error");        
        
    } while(1);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕 久热精品 视频在线| 日本一区二区三级电影在线观看| 91精品国产丝袜白色高跟鞋| 在线成人午夜影院| 欧美精品丝袜中出| 日韩一级片网站| 久久久精品国产99久久精品芒果| 久久久777精品电影网影网| 日韩理论在线观看| 日韩在线一区二区三区| 久久精品久久久精品美女| 国产麻豆精品在线观看| 成人av第一页| 欧美在线看片a免费观看| 91精品在线一区二区| 欧美精品一区二区三区一线天视频| 亚洲国产精品传媒在线观看| 一区二区在线电影| 日韩电影免费一区| 国产一区二区三区蝌蚪| 色老汉av一区二区三区| 成人网页在线观看| 色综合天天狠狠| 欧美一级精品在线| 久久精品人人做人人综合| 亚洲午夜精品在线| 精品一区二区三区av| 波多野结衣中文字幕一区| 欧美一区二区啪啪| 欧美国产禁国产网站cc| 亚洲激情第一区| 久国产精品韩国三级视频| www.综合网.com| 久久先锋影音av| 亚洲国产sm捆绑调教视频| 韩国女主播成人在线观看| 色94色欧美sute亚洲线路一ni| 欧美亚日韩国产aⅴ精品中极品| 国产欧美综合色| 激情久久五月天| 91精品国产综合久久精品app| 亚洲精品视频自拍| 国产成人精品亚洲日本在线桃色| 欧美精品成人一区二区三区四区| 成人性生交大片免费看视频在线| 欧美一级片免费看| 亚洲午夜影视影院在线观看| 99精品一区二区三区| 久久久国产精品午夜一区ai换脸| 日本 国产 欧美色综合| 欧美日韩一区高清| 亚洲精品国产高清久久伦理二区| 国产91精品一区二区麻豆网站| 日韩美女一区二区三区四区| 午夜精品免费在线| 欧美主播一区二区三区| 亚洲乱码国产乱码精品精小说 | 欧美日韩一区视频| 亚洲欧美自拍偷拍| 国产suv精品一区二区三区| 欧美mv日韩mv亚洲| 久久精品国产精品亚洲红杏 | 久久99国产精品久久99果冻传媒| 欧美少妇bbb| 欧美一区二区视频观看视频| 亚洲成a人片在线不卡一二三区| heyzo一本久久综合| 国产免费成人在线视频| 福利电影一区二区三区| 国产精品三级av| 99久久综合狠狠综合久久| 亚洲欧洲精品天堂一级| av日韩在线网站| 国产精品久久久久久妇女6080 | 国产精品理论片在线观看| 国产成人午夜高潮毛片| 国产欧美一区二区三区鸳鸯浴| 国产精品正在播放| 国产日韩三级在线| 岛国精品一区二区| 国产精品嫩草久久久久| eeuss鲁片一区二区三区在线观看| 国产亲近乱来精品视频| 成人性视频免费网站| 国产精品传媒视频| 色婷婷亚洲综合| 亚洲国产精品天堂| 51精品国自产在线| 秋霞午夜av一区二区三区| 欧美一区二区三区喷汁尤物| 精品系列免费在线观看| 2024国产精品视频| 粉嫩一区二区三区性色av| 中文字幕中文乱码欧美一区二区 | 亚洲精品久久7777| 在线视频中文字幕一区二区| 午夜精品久久久久久久蜜桃app| 日韩一卡二卡三卡国产欧美| 国产一区二区三区| 国产精品久久久久久久久免费桃花 | 91在线视频播放| 亚洲线精品一区二区三区| 日韩一区二区电影在线| 国产成人午夜99999| 亚洲日本在线a| 欧美日韩精品欧美日韩精品一综合| 免费成人在线视频观看| 久久蜜桃av一区精品变态类天堂| 成人白浆超碰人人人人| 一区二区在线看| 欧美日韩久久久一区| 国产毛片精品视频| 亚洲精品你懂的| 欧美xingq一区二区| 91网站最新地址| 日韩**一区毛片| 中文字幕不卡三区| 欧美日韩国产天堂| 国产成人综合视频| 一区二区三区毛片| 久久精品亚洲精品国产欧美| 欧美影院一区二区三区| 国精产品一区一区三区mba视频| 国产精品美女www爽爽爽| 欧美片在线播放| 成人丝袜视频网| 日韩制服丝袜先锋影音| 国产精品免费看片| 日韩欧美一级在线播放| av不卡免费在线观看| 日本在线播放一区二区三区| 日本一区二区三区高清不卡| 51午夜精品国产| 99国产精品一区| 久久99精品国产91久久来源| 一区二区在线看| 国产亚洲精品久| 欧美电影影音先锋| 色一区在线观看| 国产精品一二三| 奇米影视在线99精品| 亚洲狠狠丁香婷婷综合久久久| 欧美mv日韩mv| 91麻豆精品国产自产在线| 99久久综合精品| 国产99久久久国产精品潘金| 日本欧美加勒比视频| 亚洲国产精品人人做人人爽| 国产精品色呦呦| www国产亚洲精品久久麻豆| 欧美丰满美乳xxx高潮www| 91浏览器在线视频| 国产不卡视频在线观看| 久久91精品国产91久久小草| 日日夜夜免费精品| 一区二区三区视频在线观看| 国产精品久久久久影院| 精品国产123| 日韩亚洲欧美在线观看| 欧美亚洲综合一区| 色综合激情五月| 成a人片亚洲日本久久| 国模套图日韩精品一区二区| 免费一级片91| 日韩激情一二三区| 香蕉成人啪国产精品视频综合网| 亚洲另类在线视频| 亚洲蜜臀av乱码久久精品| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 久久综合久久综合九色| 91精品国产综合久久久久| 欧美日韩精品久久久| 欧美日韩一区二区在线观看| 色综合天天视频在线观看| 99久久精品国产一区二区三区 | 国产精品丝袜91| 久久精品夜色噜噜亚洲a∨| www久久精品| 久久色在线观看| 337p粉嫩大胆色噜噜噜噜亚洲| 欧美一级夜夜爽| 日韩欧美高清一区| 日韩视频一区在线观看| 日韩欧美一级在线播放| 日韩精品一区二区三区视频| 日韩三级中文字幕| 精品嫩草影院久久| 久久综合狠狠综合久久激情| 精品国产乱码久久久久久久久| 日韩女优电影在线观看| 欧美成人精品3d动漫h| 欧美草草影院在线视频| 久久久久一区二区三区四区| 久久久久久日产精品| 欧美国产精品中文字幕| 亚洲色图欧美在线| 亚洲综合一二三区| 婷婷国产v国产偷v亚洲高清| 免费成人av在线播放| 国产一区二区三区免费在线观看|