Ignore:
Timestamp:
Jan 21, 2018, 12:10:09 AM (6 years ago)
Author:
coas-nagasima
Message:

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/ntshell/webserver/httpd.c

    r321 r331  
    4343#include "syssvc/syslog.h"
    4444#include "http-strings.h"
     45#include <tinet_defs.h>
     46#include <tinet_config.h>
    4547#include "netinet/in.h"
    4648#include "netinet/in_var.h"
     49#include "netinet/in_itron.h"
    4750#include "httpd.h"
    4851#include "httpd-fs.h"
     
    5053#include "base64.h"
    5154#include "sha1.h"
    52 #include "ntstdio.h"
     55#include "util/ntstdio.h"
     56#include "core/ntlibc.h"
    5357
    5458#define TRUE 1
     
    8286
    8387#ifndef _MSC_VER
     88#define strnlen httpd_strnlen
    8489/* strnlen() is a POSIX.2008 addition. Can't rely on it being available so
    8590 * define it ourselves.
     
    99104void strcpy_s(char *dst, int size, const char *src)
    100105{
    101         int slen = strlen(src);
     106        int slen = ntlibc_strlen(src);
    102107        if (slen >= size)
    103108                slen = size - 1;
     
    108113void strcat_s(char *dst, int size, const char *src)
    109114{
    110         int dlen = strlen(dst);
    111         int slen = strlen(src);
     115        int dlen = ntlibc_strlen(dst);
     116        int slen = ntlibc_strlen(src);
    112117        if (dlen + slen >= size)
    113118                slen = size - 1 - dlen;
     
    223228        struct message *m = &s->message;
    224229
    225         if (strncmp("Referer", buf, len) == 0) {
     230        if (ntlibc_strncmp("Referer", buf, len) == 0) {
    226231                m->num_headers = 1;
    227232        }
    228         else if (strncmp("Host", buf, len) == 0) {
     233        else if (ntlibc_strncmp("Host", buf, len) == 0) {
    229234                m->num_headers = 2;
    230235        }
    231         else if (strncmp("Upgrade", buf, len) == 0) {
     236        else if (ntlibc_strncmp("Upgrade", buf, len) == 0) {
    232237                m->num_headers = 3;
    233238        }
    234         else if (strncmp("Connection", buf, len) == 0) {
     239        else if (ntlibc_strncmp("Connection", buf, len) == 0) {
    235240                m->num_headers = 4;
    236241        }
    237         else if (strncmp("Sec-WebSocket-Key", buf, len) == 0) {
     242        else if (ntlibc_strncmp("Sec-WebSocket-Key", buf, len) == 0) {
    238243                m->num_headers = 5;
    239244        }
    240         else if (strncmp("Origin", buf, len) == 0) {
     245        else if (ntlibc_strncmp("Origin", buf, len) == 0) {
    241246                m->num_headers = 6;
    242247        }
    243         else if (strncmp("Sec-WebSocket-Protocol", buf, len) == 0) {
     248        else if (ntlibc_strncmp("Sec-WebSocket-Protocol", buf, len) == 0) {
    244249                m->num_headers = 7;
    245250        }
    246         else if (strncmp("Sec-WebSocket-Version", buf, len) == 0) {
     251        else if (ntlibc_strncmp("Sec-WebSocket-Version", buf, len) == 0) {
    247252                m->num_headers = 8;
    248253        }
     
    329334                        s->in.state = IN_STATE_UPLOAD;
    330335                }
    331                 else if (strcmp(s->filename, uploding->filename) == 0) {
     336                else if (ntlibc_strcmp(s->filename, uploding->filename) == 0) {
    332337                        ntstdio_printf(&ntstdio, "collision: %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
    333338                        goto error;
     
    559564        char *ptr;
    560565
    561         len = strlen(statushdr);
     566        len = ntlibc_strlen(statushdr);
    562567        tcp_snd_dat(s->cepid, (void *)statushdr, len, TMO_FEVR);
    563568
     
    574579                        tcp_snd_dat(s->cepid, "/~", len, TMO_FEVR);
    575580                }
    576                 len = strlen(s->filename);
     581                len = ntlibc_strlen(s->filename);
    577582                tcp_snd_dat(s->cepid, s->filename, len, TMO_FEVR);
    578583                if (s->query != NULL) {
    579584                        tcp_snd_dat(s->cepid, "?", 1, TMO_FEVR);
    580                         len = strlen(s->query);
     585                        len = ntlibc_strlen(s->query);
    581586                        tcp_snd_dat(s->cepid, s->query, len, TMO_FEVR);
    582587                }
     
    590595                tcp_snd_dat(s->cepid, (void *)http_content_type_binary, len, TMO_FEVR);
    591596        }
    592         else if (strncmp(http_html, ptr, sizeof(http_html) - 1) == 0 ||
    593                 strncmp(http_htm, ptr, sizeof(http_htm) - 1) == 0) {
     597        else if (ntlibc_strncmp(http_html, ptr, sizeof(http_html) - 1) == 0 ||
     598                ntlibc_strncmp(http_htm, ptr, sizeof(http_htm) - 1) == 0) {
    594599                len = sizeof(http_content_type_html) - 1;
    595600                tcp_snd_dat(s->cepid, (void *)http_content_type_html, len, TMO_FEVR);
    596601        }
    597         else if (strncmp(http_css, ptr, sizeof(http_css) - 1) == 0) {
     602        else if (ntlibc_strncmp(http_css, ptr, sizeof(http_css) - 1) == 0) {
    598603                len = sizeof(http_content_type_css) - 1;
    599604                tcp_snd_dat(s->cepid, (void *)http_content_type_css, len, TMO_FEVR);
    600605        }
    601         else if (strncmp(http_js, ptr, sizeof(http_js) - 1) == 0) {
     606        else if (ntlibc_strncmp(http_js, ptr, sizeof(http_js) - 1) == 0) {
    602607                len = sizeof(http_content_type_js) - 1;
    603608                tcp_snd_dat(s->cepid, (void *)http_content_type_js, len, TMO_FEVR);
    604609        }
    605         else if (strncmp(http_json, ptr, sizeof(http_json) - 1) == 0) {
     610        else if (ntlibc_strncmp(http_json, ptr, sizeof(http_json) - 1) == 0) {
    606611                len = sizeof(http_content_type_json) - 1;
    607612                tcp_snd_dat(s->cepid, (void *)http_content_type_json, len, TMO_FEVR);
    608613        }
    609         else if (strncmp(http_png, ptr, sizeof(http_png) - 1) == 0) {
     614        else if (ntlibc_strncmp(http_png, ptr, sizeof(http_png) - 1) == 0) {
    610615                len = sizeof(http_content_type_png) - 1;
    611616                tcp_snd_dat(s->cepid, (void *)http_content_type_png, len, TMO_FEVR);
    612617        }
    613         else if (strncmp(http_gif, ptr, sizeof(http_gif) - 1) == 0) {
     618        else if (ntlibc_strncmp(http_gif, ptr, sizeof(http_gif) - 1) == 0) {
    614619                len = sizeof(http_content_type_gif) - 1;
    615620                tcp_snd_dat(s->cepid, (void *)http_content_type_gif, len, TMO_FEVR);
    616621        }
    617         else if (strncmp(http_jpg, ptr, sizeof(http_jpg) - 1) == 0) {
     622        else if (ntlibc_strncmp(http_jpg, ptr, sizeof(http_jpg) - 1) == 0) {
    618623                len = sizeof(http_content_type_jpg) - 1;
    619624                tcp_snd_dat(s->cepid, (void *)http_content_type_jpg, len, TMO_FEVR);
    620625        }
    621         else if (strncmp(http_svg, ptr, sizeof(http_svg) - 1) == 0) {
     626        else if (ntlibc_strncmp(http_svg, ptr, sizeof(http_svg) - 1) == 0) {
    622627                len = sizeof(http_content_type_svg) - 1;
    623628                tcp_snd_dat(s->cepid, (void *)http_content_type_svg, len, TMO_FEVR);
    624629        }
    625         else if (strncmp(http_text, ptr, sizeof(http_text) - 1) == 0) {
     630        else if (ntlibc_strncmp(http_text, ptr, sizeof(http_text) - 1) == 0) {
    626631                len = sizeof(http_content_type_text) - 1;
    627632                tcp_snd_dat(s->cepid, (void *)http_content_type_text, len, TMO_FEVR);
    628633        }
    629         else if (strncmp(http_eot, ptr, sizeof(http_eot) - 1) == 0) {
     634        else if (ntlibc_strncmp(http_eot, ptr, sizeof(http_eot) - 1) == 0) {
    630635                len = sizeof(http_content_type_eot) - 1;
    631636                tcp_snd_dat(s->cepid, (void *)http_content_type_eot, len, TMO_FEVR);
    632637        }
    633         else if (strncmp(http_ttf, ptr, sizeof(http_ttf) - 1) == 0) {
     638        else if (ntlibc_strncmp(http_ttf, ptr, sizeof(http_ttf) - 1) == 0) {
    634639                len = sizeof(http_content_type_ttf) - 1;
    635640                tcp_snd_dat(s->cepid, (void *)http_content_type_ttf, len, TMO_FEVR);
    636641        }
    637         else if (strncmp(http_woff, ptr, sizeof(http_woff) - 1) == 0) {
     642        else if (ntlibc_strncmp(http_woff, ptr, sizeof(http_woff) - 1) == 0) {
    638643                len = sizeof(http_content_type_woff) - 1;
    639644                tcp_snd_dat(s->cepid, (void *)http_content_type_woff, len, TMO_FEVR);
    640645        }
    641         else if (strncmp(http_woff2, ptr, sizeof(http_woff2) - 1) == 0) {
     646        else if (ntlibc_strncmp(http_woff2, ptr, sizeof(http_woff2) - 1) == 0) {
    642647                len = sizeof(http_content_type_woff2) - 1;
    643648                tcp_snd_dat(s->cepid, (void *)http_content_type_woff2, len, TMO_FEVR);
    644649        }
    645         else if (strncmp(http_ico, ptr, sizeof(http_ico) - 1) == 0) {
     650        else if (ntlibc_strncmp(http_ico, ptr, sizeof(http_ico) - 1) == 0) {
    646651                len = sizeof(http_content_type_ico) - 1;
    647652                tcp_snd_dat(s->cepid, (void *)http_content_type_ico, len, TMO_FEVR);
     
    656661                tcp_snd_dat(s->cepid, (void *)http_content_length, len, TMO_FEVR);
    657662                ntstdio_snprintf(s->temp, sizeof(s->temp), "%d\r\n", s->file.len);
    658                 tcp_snd_dat(s->cepid, (void *)s->temp, strlen(s->temp), TMO_FEVR);
     663                tcp_snd_dat(s->cepid, (void *)s->temp, ntlibc_strlen(s->temp), TMO_FEVR);
    659664        }
    660665
     
    732737        int len;
    733738
    734         len = strlen(statushdr);
     739        len = ntlibc_strlen(statushdr);
    735740        tcp_snd_dat(s->cepid, (void *)statushdr, len, TMO_FEVR);
    736741
    737742        len = sizeof(http_upgrade) - 1;
    738743        tcp_snd_dat(s->cepid, (void *)http_upgrade, len, TMO_FEVR);
    739         len = strlen(s->message.upgrade);
     744        len = ntlibc_strlen(s->message.upgrade);
    740745        tcp_snd_dat(s->cepid, s->message.upgrade, len, TMO_FEVR);
    741746        len = sizeof(http_crnl) - 1;
     
    744749        len = sizeof(http_connection) - 1;
    745750        tcp_snd_dat(s->cepid, (void *)http_connection, len, TMO_FEVR);
    746         len = strlen(s->message.connection);
     751        len = ntlibc_strlen(s->message.connection);
    747752        tcp_snd_dat(s->cepid, s->message.connection, len, TMO_FEVR);
    748753        len = sizeof(http_crnl) - 1;
     
    751756        len = sizeof(http_sec_websocket_accept) - 1;
    752757        tcp_snd_dat(s->cepid, (void *)http_sec_websocket_accept, len, TMO_FEVR);
    753         len = strlen(s->message.response_key);
     758        len = ntlibc_strlen(s->message.response_key);
    754759        tcp_snd_dat(s->cepid, s->message.response_key, len, TMO_FEVR);
    755760        len = sizeof(http_crnl) - 1;
     
    758763        len = sizeof(http_sec_websocket_protocol) - 1;
    759764        tcp_snd_dat(s->cepid, (void *)http_sec_websocket_protocol, len, TMO_FEVR);
    760         len = strlen(s->message.sec_websocket_protocol);
     765        len = ntlibc_strlen(s->message.sec_websocket_protocol);
    761766        tcp_snd_dat(s->cepid, s->message.sec_websocket_protocol, len, TMO_FEVR);
    762767        len = sizeof(http_crnl) - 1;
Note: See TracChangeset for help on using the changeset viewer.