This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088

Dependents:   MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more

libMiMic(MiMic library for mbed)は、WebService機能を提供するSDKです。 mbedでWebAPIに対応したネットワークデバイスを簡単に作ることが出来ます。

libMiMicはMiMic projectで開発しています。MiMic projectについてはこちらをご覧ください。 http://nyatla.jp/mimic/wp/

構成

libMiMicはmbedRTOS上で動作し、ユーザアプリケーションにAPIを提供します。コアAPIはC言語で記述されていますが、使用頻度の高いものについてはmbed向けのC++APIが準備されています。

/media/uploads/nyatla/libmimic-sdk.png

※libMiMicはmbedの標準イーサネットドライバをしようしていません。

標準イーサネットドライバと同時に使用することはできません。

  • MiMicIP - IPv4スタックです。レテンシとメモリ消費量を抑えたuipベースのライブラリです。
  • ARP/ICMP/UDP/TCP - 基礎的なソケットAPIを提供します。APIは独自です。
  • HTTP/1.1 Server - HTTP/1.1に対応したサーバです。マルチセッション・Chunked・持続性接続に対応しています。
  • HTTP Modules - HTTP/1.1の機能モジュールです。以下のモジュールがあります。
    • ROM file provider - ROMに格納したファイルイメージを公開します。
    • File system provider - mbedファイルシステムを公開します。
    • Onchip configuration - プログラムフラッシュを利用して設定を保存します。
    • MiMicVM processor - RPCリクエスト(MiMicVM)を処理します。
    • FileUpload - ファイルアップロードを受け取ります。
    • URL decoder - HTTPリクエストを解析します。
    • UPnP handler -UPnPメッセージを処理します。
    • WebSocket - Websocketサーバです。
  • mDNS - マルチキャストDNSサービスです。
  • UPnP - UPnP/1.0の機能を提供します。UPnP handlerと協調して動作します。(現在はデバイス探索(SSDP)・デスクリプション(Description)のみ実装してあります。)
  • DHCP/APIPA - ゼロコンフィギュレーション用のモジュールです。
  • HTTP/1.1 Client
  • mbed C++ class library - mbed向けのC++CPIです。C言語のものより簡単です。

対応機種

  • mbed(mbed LPC1768)
  • LPCXpresso1769

プログラム

Import programMiMicRemoteMCU-for-Mbed

MiMic RemoteMCU for mbed. This program provides MCU control API over REST API. It can control MCU from Javascript,PHP or any HTTP rest client directly. And, The application has self development environment.

Import programMbedFileServer

The program publishes files at local directory and SD filesystem. It is a full-fledged webServer somewhat.

サンプル

Import programMiMicSimpleHttpd

This is a simplest HTTP server made ​​of libMiMic. It will echo back a request path.

Import programUPnPBasicDevice

Simplest UPnP basic device example. This program to run UPnP basic device on the mbed.

Import programWebSocketSample

MiMicSDK Websocket module sample program.

Import programHttpClientSamlpe

A http client sample program.

Import programTcpSocketClientSamlpe

MiMicSDK Tcp client socket sample program.

Import programUdpSocketSamlpe

Udp socket sample program. This program will send back the received packet.

チュートリアル

English

libMiMic(MiMic library for mbed) is SDK which provides Webservice functions. It can be created networking device easily using mbed.

See more MiMic information, See MiMic project website. http://nyatla.jp/mimic/wp/

Structure

libMiMic run on mbed RTOS and provides networking API to user application. This library has C++ class API for the mbed, and low-level C language API.

/media/uploads/nyatla/libmimic-sdk.png

For WebService general, it can be written in a simple C + + API.

libMiMic does not have the standard Ethernet driver of mbed. It is not possible that will be used with the standard Ethernet driver.

  • MiMicIP - IPv4 protocol stack. This is based uip which is reduced memory and latency.
  • ARP / ICMP / UDP / TCP - Those are provide basic IP protocols.
  • HTTP/1.1 Server - The Http server compatible HTTP/1.1. It supports multi-session, chunked transport, persistent connection.
  • HTTP Modules - There are addon-module for HTTP server. The following modules.
    • ROM file module - Publish the file images in ROM.
    • File system module - Publish thefiles in mbed file system.
    • Onchip configuration module - To save the network settings to the program flash via REST.
    • MiMicVM module - To handle the (MiMicVM) RPC request.
    • FileUpload module - Accept a file via HTTP POST.
    • URL dedoce module - A versatility URL decoder.
    • UPnP handle module - To handle UPnP messages.
    • UPnP - This provides UPnP/1.0 device functions. It works together with UPnP handler.
    • Websocket - websocket (version13) server
  • mDNS Service - DNS-SD protocol server.
  • UPnP - This provides UPnP/1.0 device functions which works with UPnP handler. (You have been implemented (SSDP) ? description only (Description) device search now.) It is a module zero configuration for - DHCP / APIPA. mbed C + + class library - C of mbed for + + is the CPI. It is simple than that of the C language.
  • DHCP/APIPA - It support zero-cpnfigulation.
  • mbed C++ class library. Almost APIs for Web applications are available.
  • HTTP/1.1 Client

Supported target

  • mbed(mbed LPC1768)
  • LPCXpresso1769

Application

Import programMiMicRemoteMCU-for-Mbed

MiMic RemoteMCU for mbed. This program provides MCU control API over REST API. It can control MCU from Javascript,PHP or any HTTP rest client directly. And, The application has self development environment.

Import programMbedFileServer

The program publishes files at local directory and SD filesystem. It is a full-fledged webServer somewhat.

Sample

Import programMiMicSimpleHttpd

This is a simplest HTTP server made ​​of libMiMic. It will echo back a request path.

Import programUPnPBasicDevice

Simplest UPnP basic device example. This program to run UPnP basic device on the mbed.

Import programWebSocketSample

MiMicSDK Websocket module sample program.

Import programHttpClientSamlpe

A http client sample program.

Import programTcpSocketClientSamlpe

MiMicSDK Tcp client socket sample program.

Import programUdpSocketSamlpe

Udp socket sample program. This program will send back the received packet.

Tutorial

Files at this revision

API Documentation at this revision

Comitter:
nyatla
Date:
Sat Apr 27 13:31:57 2013 +0000
Parent:
18:1970fec78229
Child:
20:3b0b444b4deb
Commit message:
update MiMic core r223;

Changed in this revision

core/include/NyLPC_stdlib.h Show annotated file Show diff for this revision Revisions of this file
core/net/httpd/NyLPC_cHttpd.h Show annotated file Show diff for this revision Revisions of this file
core/net/httpd/NyLPC_cHttpdConnection.h Show annotated file Show diff for this revision Revisions of this file
core/net/httpd/NyLPC_cHttpdThread.h Show annotated file Show diff for this revision Revisions of this file
core/net/httpd/NyLPC_cHttpdUtils.c Show annotated file Show diff for this revision Revisions of this file
core/net/httpd/NyLPC_cHttpdUtils.h Show annotated file Show diff for this revision Revisions of this file
core/net/httpd/NyLPC_cHttpd_protected.h Show annotated file Show diff for this revision Revisions of this file
core/net/httpd/mod/NyLPC_cMocMiMicSetting.c Show annotated file Show diff for this revision Revisions of this file
core/net/httpd/mod/NyLPC_cModMiMicSetting.h Show annotated file Show diff for this revision Revisions of this file
core/net/httpd/mod/NyLPC_cModRemoteMcu.c Show annotated file Show diff for this revision Revisions of this file
core/net/httpd/mod/NyLPC_cModRemoteMcu.h Show annotated file Show diff for this revision Revisions of this file
core/net/httpd/mod/NyLPC_cModRomFiles.c Show annotated file Show diff for this revision Revisions of this file
core/net/httpd/mod/NyLPC_cModRomFiles.h Show annotated file Show diff for this revision Revisions of this file
core/net/httpd/mod/NyLPC_cModUrl.c Show annotated file Show diff for this revision Revisions of this file
core/net/httpd/mod/NyLPC_cModUrl.h Show annotated file Show diff for this revision Revisions of this file
mbed/Httpd.cpp Show annotated file Show diff for this revision Revisions of this file
mbed/Httpd.h Show annotated file Show diff for this revision Revisions of this file
mbed/HttpdConnection.cpp Show annotated file Show diff for this revision Revisions of this file
mbed/HttpdConnection.h Show annotated file Show diff for this revision Revisions of this file
mbed/ModBaseClass.cpp Show annotated file Show diff for this revision Revisions of this file
mbed/ModLocalFileSystem.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/core/include/NyLPC_stdlib.h	Fri Apr 26 14:55:24 2013 +0000
+++ b/core/include/NyLPC_stdlib.h	Sat Apr 27 13:31:57 2013 +0000
@@ -43,59 +43,71 @@
  * ASSERT/ABORT
  *
  **********************************************************************/
+#define MIMIC_DEBUG 1
+#ifdef MIMIC_DEBUG
 
-/**
- * 引数チェック専用のASSERT構文です。
- * デバック時のみ有効です。
- */
-#define NyLPC_ArgAssert(e) if(!(e)){NyLPC_assertHook(NULL,-1);};
+    /**
+     * 引数チェック専用のASSERT構文です。
+     * デバック時のみ有効です。
+     */
+    #define NyLPC_ArgAssert(e) if(!(e)){NyLPC_assertHook(NULL,-1);};
 
-/**
- * ASSERTマクロです。
- * デバック時のみ有効です。
- */
-#define NyLPC_Assert(e) if(!(e)){NyLPC_assertHook(NULL,-1);};
+    /**
+     * ASSERTマクロです。
+     * デバック時のみ有効です。
+     */
+    #define NyLPC_Assert(e) if(!(e)){NyLPC_assertHook(NULL,-1);};
 
-/**
- * デバック用のフックマクロです。
- * デバック時のみ有効です。
- */
-#define NyAR_DebugHook() {NyLPC_debugHook(__FILE__,__LINE__);};
+    /**
+     * デバック用のフックマクロです。
+     * デバック時のみ有効です。
+     */
+    #define NyAR_DebugHook() {NyLPC_debugHook(__FILE__,__LINE__);};
 
-/**
- * Abortマクロです。プログラムを異常終了するときのエントリポイントになります。
- * デバック時/リリース時のどちらでも有効です。
- */
-#define NyLPC_Abort() {NyLPC_abortHook(__FILE__,__LINE__);};    //もうだめ
+    /**
+     * Abortマクロです。プログラムを異常終了するときのエントリポイントになります。
+     * デバック時/リリース時のどちらでも有効です。
+     */
+    #define NyLPC_Abort() {NyLPC_abortHook(__FILE__,__LINE__);};    //もうだめ
 
-/**
- * Abortマクロです。eが偽の時に、異常終了します。
- * デバック時/リリース時のどちらでも有効です。
- * @param e
- * 評価式です。
- */
-#define NyLPC_AbortIfNot(e) if(!(e)){NyLPC_abortHook(__FILE__,__LINE__);};
+    /**
+     * Abortマクロです。eが偽の時に、異常終了します。
+     * デバック時/リリース時のどちらでも有効です。
+     * @param e
+     * 評価式です。
+     */
+    #define NyLPC_AbortIfNot(e) if(!(e)){NyLPC_abortHook(__FILE__,__LINE__);};
 
-/**
- * 警告表示用のマクロです。デバックに使います。
- * デバック時のみ有効です。
- */
-#define NyLPC_Warning() {NyLPC_debugHook(__FILE__,__LINE__);};
+    /**
+     * 警告表示用のマクロです。デバックに使います。
+     * デバック時のみ有効です。
+     */
+    #define NyLPC_Warning() {NyLPC_debugHook(__FILE__,__LINE__);};
 
-/**
- * 警告表示用のマクロです。eが偽の時に、警告を出します。
- * デバック時のみ有効です。
- * @param e
- * 評価式です。
- */
-#define NyLPC_WarningIfNot(e) if(!(e)){NyLPC_debugHook(__FILE__,__LINE__);};
+    /**
+     * 警告表示用のマクロです。eが偽の時に、警告を出します。
+     * デバック時のみ有効です。
+     * @param e
+     * 評価式です。
+     */
+    #define NyLPC_WarningIfNot(e) if(!(e)){NyLPC_debugHook(__FILE__,__LINE__);};
 
-/*
- * トレースマクロです。デバックに使います。
- * 内部変数に、最後にコールされたファイル名と、行番号を保存します。
- * デバック時のみ有効です。
- */
-#define NyLPC_Trace() {NyLPC_debugHook(__FILE__,__LINE__);};
+    /*
+     * トレースマクロです。デバックに使います。
+     * 内部変数に、最後にコールされたファイル名と、行番号を保存します。
+     * デバック時のみ有効です。
+     */
+    #define NyLPC_Trace() {NyLPC_debugHook(__FILE__,__LINE__);};
+#else
+    #define NyLPC_ArgAssert(e) if(!(e)){NyLPC_assertHook(NULL,-1);};
+    #define NyLPC_Assert(e) if(!(e)){NyLPC_assertHook(NULL,-1);};
+    #define NyAR_DebugHook() {NyLPC_debugHook(__FILE__,__LINE__);};
+    #define NyLPC_Abort() {NyLPC_abortHook(__FILE__,__LINE__);};    //もうだめ
+    #define NyLPC_AbortIfNot(e) if(!(e)){NyLPC_abortHook(__FILE__,__LINE__);};
+    #define NyLPC_Warning() {NyLPC_debugHook(__FILE__,__LINE__);};
+    #define NyLPC_WarningIfNot(e) if(!(e)){NyLPC_debugHook(__FILE__,__LINE__);};
+    #define NyLPC_Trace() {NyLPC_debugHook(__FILE__,__LINE__);};
+#endif
 
 /**
  * アサートマクロが使う関数です。
--- a/core/net/httpd/NyLPC_cHttpd.h	Fri Apr 26 14:55:24 2013 +0000
+++ b/core/net/httpd/NyLPC_cHttpd.h	Sat Apr 27 13:31:57 2013 +0000
@@ -45,6 +45,8 @@
 void NyLPC_cHttpd_initialize(NyLPC_TcHttpd_t* i_inst,NyLPC_TUInt16 i_port_number);
 void NyLPC_cHttpd_finalize(NyLPC_TcHttpd_t* i_inst);
 void NyLPC_cHttpd_loop(NyLPC_TcHttpd_t* i_inst);
+void NyLPC_cHttpd_lock(NyLPC_TcHttpd_t* i_inst);
+void NyLPC_cHttpd_unlock(NyLPC_TcHttpd_t* i_inst);
 
 
 #ifdef __cplusplus
--- a/core/net/httpd/NyLPC_cHttpdConnection.h	Fri Apr 26 14:55:24 2013 +0000
+++ b/core/net/httpd/NyLPC_cHttpdConnection.h	Sat Apr 27 13:31:57 2013 +0000
@@ -125,8 +125,8 @@
  */
 #define NyLPC_cHttpdConnection_refStream(i_inst) (&(i_inst->_in_stream))
 
-#define NyLPC_cHttpdConnection_getMethod(i_inst) (i_inst->_pparser.method)
-#define NyLPC_cHttpdConnection_getReqStatus(i_inst) (i_inst->_req_status)
+#define NyLPC_cHttpdConnection_getMethod(i_inst) ((i_inst)->_pparser.method)
+#define NyLPC_cHttpdConnection_getReqStatus(i_inst) ((i_inst)->_req_status)
 
 #ifdef __cplusplus
 }
--- a/core/net/httpd/NyLPC_cHttpdThread.h	Fri Apr 26 14:55:24 2013 +0000
+++ b/core/net/httpd/NyLPC_cHttpdThread.h	Sat Apr 27 13:31:57 2013 +0000
@@ -21,7 +21,7 @@
 #endif
 
 /** Httpdセッションスレッドのスタックサイズ*/
-#define NyLPC_TcHttpdThread_SIZE_OF_THREAD_STACK 4096
+#define NyLPC_TcHttpdThread_SIZE_OF_THREAD_STACK 2048
 
 typedef struct NyLPC_TcHttpdThread NyLPC_TcHttpdThread_t;
 /**
--- a/core/net/httpd/NyLPC_cHttpdUtils.c	Fri Apr 26 14:55:24 2013 +0000
+++ b/core/net/httpd/NyLPC_cHttpdUtils.c	Sat Apr 27 13:31:57 2013 +0000
@@ -32,6 +32,17 @@
     return NyLPC_TBool_TRUE;
 }
 
+void NyLPC_cHttpdUtils_sendErrorResponse(NyLPC_TcHttpdConnection_t* i_connection,int i_status)
+{
+    NyLPC_TUInt8 mt=NyLPC_cHttpdConnection_getMethod(i_connection);
+    NyLPC_cHttpdConnection_sendResponseHeader(i_connection,i_status,"text/html",NULL);
+    if(mt!=NyLPC_THttpMethodType_HEAD){
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,"<!DOCTYPE html><html><head><title>MiMicHTTPD</title></head><body>Status %d</body></html>",i_status);
+    }
+}
+
+
+
 /**
  * 標準的なJsonヘッダを送信する。
  */
--- a/core/net/httpd/NyLPC_cHttpdUtils.h	Fri Apr 26 14:55:24 2013 +0000
+++ b/core/net/httpd/NyLPC_cHttpdUtils.h	Sat Apr 27 13:31:57 2013 +0000
@@ -25,6 +25,11 @@
  */
 NyLPC_TBool NyLPC_cHttpdUtils_sendJsonHeader(NyLPC_TcHttpdConnection_t* i_connection);
 
+/**
+ * エラーコードを送信する。HEAD以外リクエストに対しては簡単なbodyを返却する。
+ */
+void NyLPC_cHttpdUtils_sendErrorResponse(NyLPC_TcHttpdConnection_t* i_connection,int i_status);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
--- a/core/net/httpd/NyLPC_cHttpd_protected.h	Fri Apr 26 14:55:24 2013 +0000
+++ b/core/net/httpd/NyLPC_cHttpd_protected.h	Sat Apr 27 13:31:57 2013 +0000
@@ -17,14 +17,6 @@
 
 
 
-
-void NyLPC_cHttpd_initialize(NyLPC_TcHttpd_t* i_inst,NyLPC_TUInt16 i_port_number);
-void NyLPC_cHttpd_finalize(NyLPC_TcHttpd_t* i_inst);
-void NyLPC_cHttpd_loop(NyLPC_TcHttpd_t* i_inst);
-
-
-void NyLPC_cHttpd_lock(NyLPC_TcHttpd_t* i_inst);
-void NyLPC_cHttpd_unlock(NyLPC_TcHttpd_t* i_inst);
 #define NyLPC_cHttpd_getNumOfConnection(i_inst) ((i_inst)->_num_of_active_connection)
 
 #ifdef __cplusplus
--- a/core/net/httpd/mod/NyLPC_cMocMiMicSetting.c	Fri Apr 26 14:55:24 2013 +0000
+++ b/core/net/httpd/mod/NyLPC_cMocMiMicSetting.c	Sat Apr 27 13:31:57 2013 +0000
@@ -280,13 +280,10 @@
  */
 NyLPC_TBool NyLPC_cModMiMicSetting_execute(NyLPC_TcModMiMicSetting_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection)
 {
+    NyLPC_TUInt8 method_type;
     struct TModMiMicSettingRequest header;
     NyLPC_TcHttpBasicHeaderParser_t parser;
-    //connectonの状態を確認
-    if(!NyLPC_cHttpdConnection_getReqStatus(i_connection)==NyLPC_cHttpdConnection_ReqStatus_REQPARSE)
-    {
-        NyLPC_OnErrorGoto(Error1);
-    }
+
     //リクエストParse済へ遷移(この関数の後はModが責任を持ってリクエストを返却)
     NyLPC_cHttpdConnection_setReqStatusParsed(i_connection);
 
@@ -302,16 +299,19 @@
     NyLPC_cHttpdConnection_pushPrefetchInfo(i_connection,&parser,&header.super);
     //後続をストリームから取り込む
     if(!NyLPC_cHttpBasicHeaderParser_parseStream(&parser,NyLPC_cHttpdConnection_refStream(i_connection),&(header.super))){
+        NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);
         NyLPC_OnErrorGoto(Error2);
     }
     if(!NyLPC_cHttpBasicHeaderParser_parseFinish(&parser,&(header.super))){
+        NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);
         NyLPC_OnErrorGoto(Error2);
     }
-    //GETのみ
-    if(NyLPC_cHttpdConnection_getMethod(i_connection)!=NyLPC_THttpMethodType_GET)
+    //GETかHEADに制限
+    method_type=NyLPC_cHttpdConnection_getMethod(i_connection);
+    if(method_type!=NyLPC_THttpMethodType_GET && method_type!=NyLPC_THttpMethodType_HEAD)
     {
-        NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,405,"text/html",0,NULL);
-        NyLPC_OnErrorGoto(Error1);
+        NyLPC_cHttpdUtils_sendErrorResponse(i_connection,405);
+        NyLPC_OnErrorGoto(Error2);
     }
     //Connection Modeの設定 1.1 && !closeの場合はCONTINUE
     if(header.super.connection!=NyLPC_THttpMessgeHeader_Connection_CLOSE && header.super.startline.req.version==NyLPC_THttpVersion_11)
@@ -326,6 +326,7 @@
         break;
     case CONTENT_ID_UNKNOWN:
     default:
+        NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);
         NyLPC_OnErrorGoto(Error2);
     }
     NyLPC_cHttpBasicHeaderParser_finalize(&parser);
@@ -333,11 +334,10 @@
     NyLPC_cStr_finalize(&(header._tstr));
     return NyLPC_TBool_TRUE;
 Error2:
-    NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,500,"text/html",0,NULL);
     NyLPC_cHttpBasicHeaderParser_finalize(&parser);
     NyLPC_cMiMicDbCompiler_finalize(&header._binparser);
     NyLPC_cStr_finalize(&(header._tstr));
-Error1:
+
     return NyLPC_TBool_FALSE;
 }
 
@@ -347,33 +347,38 @@
     NyLPC_TBool ret;
     const struct NyLPC_TMimicConfigulation* config;
     struct NyLPC_TMimicConfigulation cfg_image;
+    NyLPC_Assert(
+        (NyLPC_cHttpdConnection_getMethod(i_connection)==NyLPC_THttpMethodType_GET)||
+        (NyLPC_cHttpdConnection_getMethod(i_connection)==NyLPC_THttpMethodType_HEAD));
 
     switch(i_req->content.setup.cval){
     case QVAL_C_GET:
         if(!NyLPC_cHttpdUtils_sendJsonHeader(i_connection)){
             NyLPC_OnErrorGoto(Error);
         }
-        config=NyLPC_cMiMicConfiglation_loadFromFlash();
-        //JSONを書く。
-        if(!NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,
-            "{\"application\":\""MOD_VERSION";%s\",\"mac00010203\":%u,\"mac0405xxxx\":%u,\"ip\":%u,\"mask\":%u,\"droute\":%u,\"port\":%u,\"access\":%u}",
-            NyLPC_cNet_PlatformName,
-            config->mac_00_01_02_03,
-            config->mac_04_05_xx_xx,
-            config->ipv4_addr_net,
-            config->ipv4_mask_net,
-            config->ipv4_drut_net,
-            config->ipv4_port,
-            config->accessmode
-            )){
-            NyLPC_OnErrorGoto(Error);
+        if(NyLPC_cHttpdConnection_getMethod(i_connection)==NyLPC_THttpMethodType_GET){
+            config=NyLPC_cMiMicConfiglation_loadFromFlash();
+            //JSONを書く。
+            if(!NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,
+                "{\"application\":\""MOD_VERSION";%s\",\"mac00010203\":%u,\"mac0405xxxx\":%u,\"ip\":%u,\"mask\":%u,\"droute\":%u,\"port\":%u,\"access\":%u}",
+                NyLPC_cNet_PlatformName,
+                config->mac_00_01_02_03,
+                config->mac_04_05_xx_xx,
+                config->ipv4_addr_net,
+                config->ipv4_mask_net,
+                config->ipv4_drut_net,
+                config->ipv4_port,
+                config->accessmode
+                )){
+                NyLPC_OnErrorGoto(Error);
+            }
         }
         break;
     case QVAL_C_UPDATE:
         //check parameter length
         if(i_req->content.setup.param_len!=SIZE_OF_SETUP_PARAM)
         {
-            NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,500,"text/html",0,NULL);
+            NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);
         }else{
             //パラメータ→ROMイメージ変換
             cfg_image.fast_boot=0xffffffff;
@@ -386,7 +391,7 @@
             cfg_image.accessmode=(i_req->content.setup.param_buf[6]);
             //一応確認。
             if((cfg_image.ipv4_port==0)|| (cfg_image.accessmode & 0xFEFE0000)!=0x00000000){
-                NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,500,"text/html",0,NULL);
+                NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);
             }else{
                 //FreeRTOSの停止
                 NyLPC_cIsr_enterCritical();
@@ -395,21 +400,23 @@
                 //FreeRTOSの復帰
                 NyLPC_cIsr_exitCritical();
                 if(!ret){
-                    NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,500,"text/html",0,NULL);
+                    NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);
                 }else{
                     if(!NyLPC_cHttpdUtils_sendJsonHeader(i_connection)){
                         NyLPC_OnErrorGoto(Error);
                     }
-                    NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,
-                        "{\"application\":\""MOD_VERSION";%s\",\"result\":%u}",
-                        NyLPC_cNet_PlatformName,ret?0x00000000:0x80000000);
+                    if(NyLPC_cHttpdConnection_getMethod(i_connection)==NyLPC_THttpMethodType_GET){
+                        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,
+                            "{\"application\":\""MOD_VERSION";%s\",\"result\":%u}",
+                            NyLPC_cNet_PlatformName,ret?0x00000000:0x80000000);
+                    }
                 }
             }
         }
         //JSONを書く。
         break;
     default:
-        NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,403,"text/html",0,NULL);
+        NyLPC_cHttpdUtils_sendErrorResponse(i_connection,400);
         NyLPC_OnErrorGoto(Error);
         break;
     }
--- a/core/net/httpd/mod/NyLPC_cModMiMicSetting.h	Fri Apr 26 14:55:24 2013 +0000
+++ b/core/net/httpd/mod/NyLPC_cModMiMicSetting.h	Sat Apr 27 13:31:57 2013 +0000
@@ -25,7 +25,7 @@
  *********************************************************************************/
 #ifndef NYLPC_CMODMIMICSETTING_H_
 #define NYLPC_CMODMIMICSETTING_H_
-#include "../http/NyLPC_cHttpBasicHeaderParser.h"
+#include "NyLPC_http.h"
 #include "../NyLPC_cHttpdConnection.h"
 #include "NyLPC_cModRomFiles.h"
 #ifdef __cplusplus
@@ -83,6 +83,7 @@
 NyLPC_TBool NyLPC_cModMiMicSetting_canHandle(NyLPC_TcModMiMicSetting_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection);
 /**
  * モジュールを実行します。
+ * @return 処理に成功したか
  */
 NyLPC_TBool NyLPC_cModMiMicSetting_execute(NyLPC_TcModMiMicSetting_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection);
 
@@ -91,4 +92,4 @@
 }
 #endif /* __cplusplus */
 
-#endif /* NYLPC_CHTTPSHORTHTTPHEADERPARSER_H_ */
\ No newline at end of file
+#endif /* NYLPC_CHTTPSHORTHTTPHEADERPARSER_H_ */
--- a/core/net/httpd/mod/NyLPC_cModRemoteMcu.c	Fri Apr 26 14:55:24 2013 +0000
+++ b/core/net/httpd/mod/NyLPC_cModRemoteMcu.c	Sat Apr 27 13:31:57 2013 +0000
@@ -341,11 +341,7 @@
 NyLPC_TBool NyLPC_cModRemoteMcu_execute(NyLPC_TcModRemoteMcu_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection)
 {
     NyLPC_TcHttpBasicHeaderParser_t parser;
-    //connectonの状態を確認
-    if(!NyLPC_cHttpdConnection_getReqStatus(i_connection)==NyLPC_cHttpdConnection_ReqStatus_REQPARSE)
-    {
-        NyLPC_OnErrorGoto(Error1);
-    }
+    NyLPC_TUInt8 method_type;
     //リクエストParse済へ遷移(この関数の後はModが責任を持ってリクエストを返却)
     NyLPC_cHttpdConnection_setReqStatusParsed(i_connection);
 
@@ -363,15 +359,25 @@
 
     NyLPC_cHttpBasicHeaderParser_initialize(&parser,&handler);
 
+
     //プリフェッチしたデータを流す
     NyLPC_cHttpBasicHeaderParser_parseInit(&parser,&(single_header.super));
     NyLPC_cHttpdConnection_pushPrefetchInfo(i_connection,&parser,&single_header.super);
     //後続をストリームから取り込む
     if(!NyLPC_cHttpBasicHeaderParser_parseStream(&parser,NyLPC_cHttpdConnection_refStream(i_connection),&(single_header.super))){
-        NyLPC_OnErrorGoto(Error2);
+        NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);
+        NyLPC_OnErrorGoto(Error1);
     }
     if(!NyLPC_cHttpBasicHeaderParser_parseFinish(&parser,&(single_header.super))){
-        NyLPC_OnErrorGoto(Error2);
+        NyLPC_cHttpdUtils_sendErrorResponse(i_connection,500);
+        NyLPC_OnErrorGoto(Error1);
+    }
+    //GETかHEADに制限
+    method_type=NyLPC_cHttpdConnection_getMethod(i_connection);
+    if(method_type!=NyLPC_THttpMethodType_GET && method_type!=NyLPC_THttpMethodType_HEAD)
+    {
+        NyLPC_cHttpdUtils_sendErrorResponse(i_connection,405);
+        NyLPC_OnErrorGoto(Error1);
     }
     //Connection Modeの設定 1.1 && !closeの場合はCONTINUE
     if(single_header.super.connection!=NyLPC_THttpMessgeHeader_Connection_CLOSE && single_header.super.startline.req.version==NyLPC_THttpVersion_11)
@@ -388,7 +394,8 @@
         status(i_connection);
         break;
     default:
-        NyLPC_OnErrorGoto(Error2);
+        NyLPC_cHttpdUtils_sendErrorResponse(i_connection,400);
+        NyLPC_OnErrorGoto(Error1);
     }
     NyLPC_cStr_finalize(&single_header._tstr);
     NyLPC_cMiMicDbCompiler_finalize(&single_header._binparser);
@@ -397,15 +404,13 @@
 //占有解除
     NyLPC_cHttpdConnection_unlock(i_connection);
     return NyLPC_TBool_TRUE;
-Error2:
-    NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,500,"text/html",0,NULL);
+Error1:
     NyLPC_cStr_finalize(&single_header._tstr);
     NyLPC_cMiMicDbCompiler_finalize(&single_header._binparser);
     NyLPC_cMiMicTxtCompiler_finalize(&single_header._txtcmp);
     NyLPC_cHttpBasicHeaderParser_finalize(&parser);
     //VM排他ロックの解除
     NyLPC_cHttpdConnection_unlock(i_connection);
-Error1:
     return NyLPC_TBool_FALSE;
 }
 
@@ -421,6 +426,8 @@
     NyLPC_TUInt16 db_pos;
     /** ストリームへ出力したデータの数*/
     NyLPC_TUInt16 st_len;
+    /** Bodyを送信するかのフラグ*/
+    NyLPC_TBool is_send_body;
 };
 
 /**
@@ -429,13 +436,16 @@
 static NyLPC_TBool mvmputs_json(struct NyLPC_TcMiMicVM_TEvent* i_eh,NyLPC_TUInt32 i_val)
 {
     struct TVmEventHandler* eh=(struct TVmEventHandler*)i_eh;
-    if(eh->st_len>0){
-        eh->st_len++;
-        return NyLPC_cHttpdConnection_sendResponseBodyF(eh->connection,",%u",i_val);
-    }else{
-        eh->st_len++;
-        return NyLPC_cHttpdConnection_sendResponseBodyF(eh->connection,"%u",i_val);
+    if(eh->is_send_body){
+        if(eh->st_len>0){
+            eh->st_len++;
+            return NyLPC_cHttpdConnection_sendResponseBodyF(eh->connection,",%u",i_val);
+        }else{
+            eh->st_len++;
+            return NyLPC_cHttpdConnection_sendResponseBodyF(eh->connection,"%u",i_val);
+        }
     }
+    return NyLPC_TBool_TRUE;
 }
 
 /**
@@ -486,8 +496,8 @@
         return;
     }
     //JSONを書く。
-    if(!NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,"{\"application\":\""MVM_VERSION";%s\"}",NyLPC_cNet_PlatformName)){
-        return;
+    if(NyLPC_cHttpdConnection_getMethod(i_connection)==NyLPC_THttpMethodType_GET){
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,"{\"application\":\""MVM_VERSION";%s\"}",NyLPC_cNet_PlatformName);
     }
     return;
 }
@@ -503,12 +513,11 @@
     NyLPC_TUInt32 vmret;
     if(i_rqh->content.mvm.v!=QVAL_V_1 || i_rqh->content.mvm.o!=QVAL_O_JSON)
     {
-        NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,500,"text/html",0,NULL);
+        NyLPC_cHttpdUtils_sendErrorResponse(i_connection,400);
         return;
     }
 
     //Bodyを書く
-//ここでリクエストパーサのエラー原因を調べて、詳細JSONをかくのもあり
     //ハンドラインスタンスの設定
     if(!NyLPC_cHttpdUtils_sendJsonHeader(i_connection)){
         NyLPC_OnErrorGoto(Error1);
@@ -522,28 +531,29 @@
     he.st_len=0;
     he.connection=i_connection;
     he.req=i_rqh;
+    he.is_send_body=(NyLPC_cHttpdConnection_getMethod(i_connection)==NyLPC_THttpMethodType_GET);
 
     //起動VMの初期化
     NyLPC_cMiMicVM_initialize(&vm,(struct NyLPC_TcMiMicVM_TEvent*)&(he.super));
 
     //JSONを書く。
-    if(!NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,"{\"version\":\""MVM_VERSION"\",\"stream\":[")){
-        NyLPC_OnErrorGoto(Error3);
+    if(he.is_send_body){
+        if(!NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,"{\"version\":\""MVM_VERSION"\",\"stream\":[")){
+            NyLPC_OnErrorGoto(Error1);
+        }
     }
     //VMの実行
     vmret=NyLPC_cMiMicVM_run(&(vm),i_rqh->content.mvm.vm_instruction.bc_buf,i_rqh->content.mvm.vm_instruction.txt_len);
-    if(!NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,"],\"result\":%u}",vmret)){
-        NyLPC_OnErrorGoto(Error3);
+    //only GET method
+    if(he.is_send_body){
+        if(!NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,"],\"result\":%u}",vmret)){
+            NyLPC_OnErrorGoto(Error1);
+        }
     }
     NyLPC_cMiMicVM_finalize(&vm);
-
     return;
-Error3:
+Error1:
     NyLPC_cMiMicVM_finalize(&vm);
-Error1:
-    //VM排他ロックの解除
-    NyLPC_cMiMicVM_finalize(&vm);
-    NyLPC_cHttpBodyWriter_finalize(&hw);
     return;
 }
 
--- a/core/net/httpd/mod/NyLPC_cModRemoteMcu.h	Fri Apr 26 14:55:24 2013 +0000
+++ b/core/net/httpd/mod/NyLPC_cModRemoteMcu.h	Sat Apr 27 13:31:57 2013 +0000
@@ -8,7 +8,7 @@
 #ifndef NYLPC_CMODREMOTEMCU_H_
 #define NYLPC_CMODREMOTEMCU_H_
 
-#include "../http/NyLPC_cHttpBasicHeaderParser.h"
+#include "NyLPC_http.h"
 #include "../NyLPC_cHttpdConnection.h"
 #include "NyLPC_cModRomFiles.h"
 #ifdef __cplusplus
@@ -44,6 +44,8 @@
 NyLPC_TBool NyLPC_cModRemoteMcu_canHandle(NyLPC_TcModRemoteMcu_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection);
 /**
  * モジュールを実行します。
+ * @return
+ * 処理に成功したか
  */
 NyLPC_TBool NyLPC_cModRemoteMcu_execute(NyLPC_TcModRemoteMcu_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection);
 
--- a/core/net/httpd/mod/NyLPC_cModRomFiles.c	Fri Apr 26 14:55:24 2013 +0000
+++ b/core/net/httpd/mod/NyLPC_cModRomFiles.c	Sat Apr 27 13:31:57 2013 +0000
@@ -58,6 +58,11 @@
 {
     const NyLPC_TChar* in_url;
     const NyLPC_TChar* base_url=i_inst->_ref_root_path;
+    //connectonの状態を確認
+    if(!NyLPC_cHttpdConnection_getReqStatus(i_connection)==NyLPC_cHttpdConnection_ReqStatus_REQPARSE)
+    {
+        return NyLPC_TBool_FALSE;
+    }
     in_url=NyLPC_cHttpdConnection_getUrlPrefix(i_connection);
     size_t base_url_len=strlen(base_url);
     //check '/'+base_url+'/'
@@ -79,21 +84,25 @@
 {
     int i;
     char url[32];
-    //connectonの状態を確認
-    if(!NyLPC_cHttpdConnection_getReqStatus(i_connection)==NyLPC_cHttpdConnection_ReqStatus_REQPARSE)
+    NyLPC_TUInt8 method_type;
+    //URLサフィックスを取得(rootpath+'2'*2)
+    if(!NyLPC_cModUrl_execute2(&(i_inst->super),i_connection,url,32,strlen(i_inst->_ref_root_path)+2,NyLPC_cModUrl_ParseMode_PATH_ONLY))
     {
-        return NyLPC_TBool_FALSE;
+        //Response処理はモジュール内で実行済
+        NyLPC_OnErrorGoto(Error1);
     }
-    //URLサフィックスを取得(rootpath+'2'*2)
-    if(!NyLPC_cModUrl_execute2(&(i_inst->super),i_connection,url,32,strlen(i_inst->_ref_root_path)+2))
+    //GETかHEADに制限
+    method_type=NyLPC_cHttpdConnection_getMethod(i_connection);
+    if(method_type!=NyLPC_THttpMethodType_GET && method_type!=NyLPC_THttpMethodType_HEAD)
     {
-        return NyLPC_TBool_TRUE;//request processed!
+        NyLPC_cHttpdUtils_sendErrorResponse(i_connection,405);
+        NyLPC_OnErrorGoto(Error1);
     }
     if(strlen(url)==0)
     {
         //PrefixがURLよりも短ければ403エラーで処理終了。
-        NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,403,"text/html",0,NULL);
-        return NyLPC_TBool_TRUE;
+        NyLPC_cHttpdUtils_sendErrorResponse(i_connection,403);
+        NyLPC_OnErrorGoto(Error1);
     }
     //URL比較
     for(i=i_inst->_num_of_data-1;i>=0;i--)
@@ -106,10 +115,10 @@
         {
             NyLPC_cHttpdConnection_setConnectionMode(i_connection,NyLPC_TcHttpdConnection_CONNECTION_MODE_CONTINUE);
         }
-        NyLPC_cHttpdUtils_sendFixedContentBatch(i_connection,i_inst->_data[i].content_type,i_inst->_data[i].data,i_inst->_data[i].size>0?i_inst->_data[i].size:strlen(i_inst->_data[i].data));
-        return NyLPC_TBool_TRUE;
+        return NyLPC_cHttpdUtils_sendFixedContentBatch(i_connection,i_inst->_data[i].content_type,i_inst->_data[i].data,i_inst->_data[i].size>0?i_inst->_data[i].size:strlen(i_inst->_data[i].data));
     }
     //404Error
-    NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,404,"text/html",0,NULL);
-    return NyLPC_TBool_TRUE;
+    NyLPC_cHttpdUtils_sendErrorResponse(i_connection,404);
+Error1:
+    return NyLPC_TBool_FALSE;
 }
--- a/core/net/httpd/mod/NyLPC_cModRomFiles.h	Fri Apr 26 14:55:24 2013 +0000
+++ b/core/net/httpd/mod/NyLPC_cModRomFiles.h	Sat Apr 27 13:31:57 2013 +0000
@@ -72,7 +72,9 @@
  */
 NyLPC_TBool NyLPC_cModRomFiles_canHandle(NyLPC_TcModRomFiles_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection);
 /**
- * モジュールを実行します。
+ * モジュールを実行します。canHandleがtrueの時だけ実行できます。
+ * @return
+ * 処理が成功すればtrue。失敗したらfalse
  */
 NyLPC_TBool NyLPC_cModRomFiles_execute(NyLPC_TcModRomFiles_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection);
 
--- a/core/net/httpd/mod/NyLPC_cModUrl.c	Fri Apr 26 14:55:24 2013 +0000
+++ b/core/net/httpd/mod/NyLPC_cModUrl.c	Sat Apr 27 13:31:57 2013 +0000
@@ -35,6 +35,9 @@
     char* url_buf;
     NyLPC_TInt16 length_of_buf;
     NyLPC_TInt16 length_of_url;
+    NyLPC_TInt16 reason;
+    NyLPC_TInt8 skip;
+    NyLPC_TInt8 mode;
 }TcHeaderParser_t;
 
 static NyLPC_TBool NyLPC_cModUrl_messageHandler(NyLPC_TcHttpBasicHeaderParser_t* i_inst,const NyLPC_TChar* i_name,NyLPC_TChar i_c,struct NyLPC_THttpBasicHeader* o_out)
@@ -44,22 +47,37 @@
     (void)i_c;
     return NyLPC_TBool_TRUE;
 }
+
 static NyLPC_TBool NyLPC_cModUrl_urlHandler(NyLPC_TcHttpBasicHeaderParser_t* i_inst,NyLPC_TChar i_c,struct NyLPC_THttpBasicHeader* o_out)
 {
     TcHeaderParser_t* inst=(TcHeaderParser_t*)i_inst;
-    //読み飛ばし
-    if(inst->length_of_url<0){
-        inst->length_of_url++;
+    if(inst->skip){
+        //SKIPが有効な場合
+        if(inst->length_of_url<0){
+            inst->length_of_url++;
+            if(inst->length_of_url==0){
+                inst->skip=NyLPC_TUInt8_FALSE;
+            }
+        }
         return NyLPC_TBool_TRUE;
     }
+    if((inst->mode & NyLPC_cModUrl_ParseMode_PATH_ONLY)==NyLPC_cModUrl_ParseMode_PATH_ONLY){
+        if(strchr("?#",i_c)){
+            inst->url_buf[inst->length_of_url]='\0';
+            inst->skip=NyLPC_TUInt8_TRUE;
+            return NyLPC_TBool_TRUE;//Terminate
+        }
+    }
     inst->url_buf[inst->length_of_url]=i_c;
-    inst->length_of_url++;
     if(i_c=='\0'){
         return NyLPC_TBool_TRUE;//Terminate
     }
+    inst->length_of_url++;
     if(inst->length_of_url==inst->length_of_buf){
+        inst->reason=414;
         return NyLPC_TBool_FALSE;//長すぎる。
     }
+
     return NyLPC_TBool_TRUE;
 }
 /**
@@ -97,12 +115,12 @@
 
 
 
-
-NyLPC_TBool NyLPC_cModUrl_execute2(NyLPC_TcModUrl_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection,char* o_url_buf,NyLPC_TInt16 i_length_buf,NyLPC_TInt16 i_pass_prefix_len)
+NyLPC_TBool NyLPC_cModUrl_execute2(NyLPC_TcModUrl_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection,char* o_url_buf,NyLPC_TInt16 i_length_buf,NyLPC_TInt16 i_pass_prefix_len,NyLPC_cModUrl_ParseMode i_mode)
 {
     TcHeaderParser_t parser;
     NyLPC_Assert(i_length_buf>0);
     NyLPC_Assert(i_pass_prefix_len>=0);
+    //コネクションのステータスチェック
     if(!NyLPC_cHttpdConnection_getReqStatus(i_connection)==NyLPC_cHttpdConnection_ReqStatus_REQPARSE)
     {
         NyLPC_OnErrorGoto(Error1);
@@ -113,8 +131,11 @@
     NyLPC_cHttpBasicHeaderParser_initialize(&parser.super,&_handler);
     parser.length_of_buf=i_length_buf;
     parser.length_of_url=-i_pass_prefix_len;//無視するPrefix長
+    parser.skip=(parser.length_of_url<0)?NyLPC_TUInt8_TRUE:NyLPC_TUInt8_FALSE;//スキップの初期値の設定
     parser.url_buf=o_url_buf;
     parser.url_buf[0]='0';//URL長<=prefix長に備えてNULLターミネイト
+    parser.reason=400;
+    parser.mode=i_mode;
     //プリフェッチしたデータを流す
     NyLPC_cHttpBasicHeaderParser_parseInit(&parser.super,&(i_inst->_header));
     NyLPC_cHttpdConnection_pushPrefetchInfo(i_connection,&parser.super,&(i_inst->_header));
@@ -134,7 +155,7 @@
     return NyLPC_TBool_TRUE;
 Error2:
     //400Error
-    NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,400,"text/html",0,NULL);
+    NyLPC_cHttpdUtils_sendErrorResponse(i_connection,parser.reason);
     NyLPC_cHttpBasicHeaderParser_finalize(&parser);
 Error1:
     return NyLPC_TBool_FALSE;
--- a/core/net/httpd/mod/NyLPC_cModUrl.h	Fri Apr 26 14:55:24 2013 +0000
+++ b/core/net/httpd/mod/NyLPC_cModUrl.h	Sat Apr 27 13:31:57 2013 +0000
@@ -33,6 +33,21 @@
 #endif /* __cplusplus */
 
 /**
+ * URLの取得モード
+ */
+typedef NyLPC_TUInt8 NyLPC_cModUrl_ParseMode;
+/**
+ * URL文字列全てを取得する。
+ */
+#define NyLPC_cModUrl_ParseMode_ALL       0x00
+/**
+ * URLのパス部分だけを取得する。
+ * /absolutepath/?queryや/absolutepath/#bookmarkの/absolutepath/だけを取り出します。
+ */
+#define NyLPC_cModUrl_ParseMode_PATH_ONLY 0x01
+
+
+/**
  * URLを
  */
 typedef struct NyLPC_TcModUrl NyLPC_TcModUrl_t;
@@ -51,7 +66,7 @@
 
 /**
  * コネクションから全てのURLをパースします。
- * NyLPC_cModUrl_execute2のラッパーです。i_i_pass_prefix_lenに0を指定したときと同じ動作をします。
+ * NyLPC_cModUrl_execute2のラッパーです。i_i_pass_prefix_len=0,i_mode=NyLPC_cModUrl_ParseMode_ALLを指定したときと同じ動作をします。
  * @param o_url_buf
  * 取得したURL文字列。i_pass_prefix_lenが指定されている場合は、URLの後半部分です。
  * 戻り値がTRUEの場合に有効です。
@@ -59,7 +74,7 @@
  * 処理が成功するとTRUEを返します。FALSEの場合、URLのパースに失敗しています。
  * TRUEの場合は引き続きResponseの送信処理をしてください。FALSEの場合はそのままリクエストハンドラを終了してください。
  */
-#define NyLPC_cModUrl_execute(i_inst,i_connection,o_url_buf,i_length_buf) NyLPC_cModUrl_execute2((i_inst),(i_connection),(o_url_buf),(i_length_buf),0)
+#define NyLPC_cModUrl_execute(i_inst,i_connection,o_url_buf,i_length_buf) NyLPC_cModUrl_execute2((i_inst),(i_connection),(o_url_buf),(i_length_buf),0,NyLPC_cModUrl_ParseMode_ALL)
 
 /**
  * コネクションからURLをパースします。
@@ -69,11 +84,17 @@
  * @param o_url_buf
  * 取得したURL文字列。i_pass_prefix_lenが指定されている場合は、URLの後半部分です。
  * 戻り値がTRUEの場合に有効です。
+ * @param i_mode
+ * URLの取得モードです。
+ * <ul>
+ * <li>NyLPC_cModUrl_ParseMode_ALL - URL全てを取得します。</li>
+ * <li>NyLPC_cModUrl_ParseMode_PATH_ONLY - クエリ文字列、ブックマークを除く文字列を取得します。</li>
+ * </ul>
  * @return
  * 処理が成功するとTRUEを返します。FALSEの場合、URLのパースに失敗しています。
  * TRUEの場合は引き続きResponseの送信処理をしてください。FALSEの場合はそのままリクエストハンドラを終了してください。
  */
-NyLPC_TBool NyLPC_cModUrl_execute2(NyLPC_TcModUrl_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection,char* o_url_buf,NyLPC_TInt16 i_length_buf,NyLPC_TInt16 i_pass_prefix_len);
+NyLPC_TBool NyLPC_cModUrl_execute2(NyLPC_TcModUrl_t* i_inst,NyLPC_TcHttpdConnection_t* i_connection,char* o_url_buf,NyLPC_TInt16 i_length_buf,NyLPC_TInt16 i_pass_prefix_len, NyLPC_cModUrl_ParseMode i_mode);
 
 /**
  * basicヘッダオブジェクトを返します。
--- a/mbed/Httpd.cpp	Fri Apr 26 14:55:24 2013 +0000
+++ b/mbed/Httpd.cpp	Sat Apr 27 13:31:57 2013 +0000
@@ -2,6 +2,8 @@
 #include "HttpdConnection.h"
 namespace MiMic
 {
+    char Httpd::_shared_buf[SIZE_OF_HTTP_BUF];
+
     void Httpd::onRequestHandler(NyLPC_TcHttpdConnection_t* i_connection)
     {
         HttpdConnection c(i_connection);
@@ -21,4 +23,13 @@
     {
         NyLPC_cHttpd_loop((NyLPC_TcHttpd_t*)(&this->_inst));
     }
+    void Httpd::lock()
+    {
+        NyLPC_cHttpd_lock((NyLPC_TcHttpd_t*)(&this->_inst));
+    }
+    void Httpd::unlock()
+    {
+        NyLPC_cHttpd_unlock((NyLPC_TcHttpd_t*)(&this->_inst));
+    }
+    
 }
\ No newline at end of file
--- a/mbed/Httpd.h	Fri Apr 26 14:55:24 2013 +0000
+++ b/mbed/Httpd.h	Sat Apr 27 13:31:57 2013 +0000
@@ -21,5 +21,14 @@
         virtual ~Httpd();
         void loop();
         virtual void onRequest(HttpdConnection& i_connection)=0;
+        void lock();
+        void unlock();
+    public:
+        const static int SIZE_OF_HTTP_BUF=512;
+        /**
+         * This buffer is a share buffer for HTTPD. 
+         * Must be locked by lock function for using
+         */
+        static char _shared_buf[SIZE_OF_HTTP_BUF];
     };
 }
\ No newline at end of file
--- a/mbed/HttpdConnection.cpp	Fri Apr 26 14:55:24 2013 +0000
+++ b/mbed/HttpdConnection.cpp	Sat Apr 27 13:31:57 2013 +0000
@@ -53,7 +53,7 @@
     {
         NyLPC_cHttpdConnection_lock(this->_ref_inst);
     }
-    void HttpdConnection::releaseHttpd()
+    void HttpdConnection::unlockHttpd()
     {
         NyLPC_cHttpdConnection_unlock(this->_ref_inst);
     }
--- a/mbed/HttpdConnection.h	Fri Apr 26 14:55:24 2013 +0000
+++ b/mbed/HttpdConnection.h	Sat Apr 27 13:31:57 2013 +0000
@@ -61,6 +61,6 @@
         /**
          * The function releases the httpd lock.
          */
-        void releaseHttpd();
+        void unlockHttpd();
     };
 }
\ No newline at end of file
--- a/mbed/ModBaseClass.cpp	Fri Apr 26 14:55:24 2013 +0000
+++ b/mbed/ModBaseClass.cpp	Sat Apr 27 13:31:57 2013 +0000
@@ -39,6 +39,11 @@
         if(this->_path==NULL){
             return false;
         }
+        //connectonの状態を確認
+        if(!NyLPC_cHttpdConnection_getReqStatus(i_connection._ref_inst)==NyLPC_cHttpdConnection_ReqStatus_REQPARSE)
+        {
+            return NyLPC_TBool_FALSE;
+        }        
         const NyLPC_TChar* in_url;
         in_url=NyLPC_cHttpdConnection_getUrlPrefix(i_connection._ref_inst);
         size_t base_url_len=strlen(this->_path);
--- a/mbed/ModLocalFileSystem.cpp	Fri Apr 26 14:55:24 2013 +0000
+++ b/mbed/ModLocalFileSystem.cpp	Sat Apr 27 13:31:57 2013 +0000
@@ -2,17 +2,17 @@
 #include "HttpdConnection.h"
 #include "UrlReader.h"
 #include "Http.h"
+#include "Httpd.h"
 #include "NyLPC_net.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <typeinfo>
 #include "mbed.h"
 #include "FATDirHandle.h"
-#define ModLocalFile_SIZE_OF_BUF 256
-static char buf[ModLocalFile_SIZE_OF_BUF];
+
 
 using namespace MiMic;
-static void retDirJson(UrlReader& url,HttpdConnection& i_connection)
+static void retDirJson(UrlReader& url,char* buf,HttpdConnection& i_connection)
 {
    //assert(HEAD or GET)
    //directory-list json
@@ -64,7 +64,7 @@
     }
     closedir(d);
 }
-static void retDirHtml(UrlReader& url,HttpdConnection& i_connection)
+static void retDirHtml(UrlReader& url,char* buf,HttpdConnection& i_connection)
 {
     //assert(HEAD or GET)
     buf[strlen(buf)-1]='\0';//convert to dir path
@@ -114,7 +114,7 @@
     }
     closedir(d);
 }
-static void retFile(UrlReader& url,HttpdConnection& i_connection)
+static void retFile(UrlReader& url,char* buf,HttpdConnection& i_connection)
 {
     //file contents
     {//split URL path and query
@@ -144,12 +144,18 @@
         if(!i_connection.isMethodType(Http::MT_GET)){
             //nothing to do
         }else{
+                    {DigitalOut led(LED1);led=0;}
+                    {DigitalOut led(LED2);led=0;}
+                    {DigitalOut led(LED3);led=0;}
+                    {DigitalOut led(LED4);led=1;}
+
             for(;;){
-                sz=fread(buf,1,ModLocalFile_SIZE_OF_BUF,fp);
+                sz=fread(buf,1,Httpd::SIZE_OF_HTTP_BUF,fp);
                 if(sz<1){
                     break;
                 }
                 if(!i_connection.sendBody(buf,sz)){
+                    {DigitalOut led(LED1);led=1;}
                     break;
                 }
                 //switch transport thread
@@ -161,6 +167,7 @@
             }
         }
     }
+                    {DigitalOut led(LED2);led=1;}
     fclose(fp);
 }    
 
@@ -201,14 +208,16 @@
         }
         //Httpd lock
         i_connection.lockHttpd();
+        char* buf=Httpd::_shared_buf;
+        
         //set file path
         {
             //call ModUrl
             NyLPC_TcModUrl_t mod;
             NyLPC_cModUrl_initialize(&mod);
-            if(!NyLPC_cModUrl_execute2(&mod,i_connection._ref_inst,buf,ModLocalFile_SIZE_OF_BUF,0)){
+            if(!NyLPC_cModUrl_execute2(&mod,i_connection._ref_inst,buf,Httpd::SIZE_OF_HTTP_BUF,0,NyLPC_cModUrl_ParseMode_ALL)){
                 NyLPC_cModUrl_finalize(&mod);
-                i_connection.releaseHttpd();
+                i_connection.unlockHttpd();
                 return true;
             }
             NyLPC_cModUrl_finalize(&mod);
@@ -216,15 +225,15 @@
         UrlReader url(buf);
         if(url.hasQueryKey("list")){
             // if path has '/?list' query key,return directory information
-            retDirJson(url,i_connection);
+            retDirJson(url,buf,i_connection);
         }else if(strchr(buf,'?')==NULL && strchr(buf,'#')==NULL && buf[strlen(buf)-1]=='/'){
             //return directory html when URL has not bookmark and URL query and terminated by '/'.
-            retDirHtml(url,i_connection);
+            retDirHtml(url,buf,i_connection);
         }else{
-            retFile(url,i_connection);
+            retFile(url,buf,i_connection);
         }
         //Httpd unlock
-        i_connection.releaseHttpd();
+        i_connection.unlockHttpd();
         return true;
         
     }