OSDN Git Service

update libMiMic
[mimic/MiMicSDK.git] / lib / src / net / httpd / NyLPC_cHttpdUtils.c
index 3286a0d..18125cc 100644 (file)
 \r
 NyLPC_TBool NyLPC_cHttpdUtils_sendFixedContentBatch(NyLPC_TcHttpdConnection_t* i_connection,const NyLPC_TChar* i_content_type,const NyLPC_TChar* i_content,NyLPC_TUInt32 i_size)\r
 {\r
-       //HEAD or GET\r
-       switch(NyLPC_cHttpdConnection_getMethod(i_connection))\r
-       {\r
-       case NyLPC_THttpMethodType_HEAD:\r
-               //HTTP Header\r
-               NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,200,i_content_type,i_size,NULL);\r
-               break;\r
-       case NyLPC_THttpMethodType_GET:\r
-               //HTTP Header\r
-               NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,200,i_content_type,i_size,NULL);\r
-               //HTTP Body\r
-               NyLPC_cHttpdConnection_sendResponseBody(i_connection,i_content,i_size);\r
-               break;\r
-       default:\r
-               //ERROR 405\r
-               NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,405,"text/html",0,NULL);\r
-               return NyLPC_TBool_FALSE;\r
-       }\r
-       return NyLPC_TBool_TRUE;\r
+    //HEAD or GET\r
+    switch(NyLPC_cHttpdConnection_getMethod(i_connection))\r
+    {\r
+    case NyLPC_THttpMethodType_HEAD:\r
+        //HTTP Header\r
+        NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,200,i_content_type,i_size,NULL);\r
+        break;\r
+    case NyLPC_THttpMethodType_GET:\r
+        //HTTP Header\r
+        NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,200,i_content_type,i_size,NULL);\r
+        //HTTP Body\r
+        NyLPC_cHttpdConnection_sendResponseBody(i_connection,i_content,i_size);\r
+        break;\r
+    default:\r
+        //ERROR 405\r
+        NyLPC_cHttpdConnection_sendResponseHeader2(i_connection,405,"text/html",0,NULL);\r
+        return NyLPC_TBool_FALSE;\r
+    }\r
+    return NyLPC_TBool_TRUE;\r
 }\r
 \r
 void NyLPC_cHttpdUtils_sendErrorResponse(NyLPC_TcHttpdConnection_t* i_connection,int i_status)\r
 {\r
-       NyLPC_TUInt8 mt=NyLPC_cHttpdConnection_getMethod(i_connection);\r
-       //ConnectionをCLOSEへセット\r
-       NyLPC_cHttpdConnection_setConnectionMode(i_connection,NyLPC_TcHttpdConnection_CONNECTION_MODE_CLOSE);\r
-       NyLPC_cHttpdConnection_sendResponseHeader(i_connection,i_status,"text/html",NULL);\r
-       if(mt!=NyLPC_THttpMethodType_HEAD){\r
-               NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,"<!DOCTYPE html><html><head><title>MiMicHTTPD</title></head><body>Status %d</body></html>",i_status);\r
-       }\r
+    NyLPC_TUInt8 mt=NyLPC_cHttpdConnection_getMethod(i_connection);\r
+    //ConnectionをCLOSEへセット\r
+    NyLPC_cHttpdConnection_setConnectionMode(i_connection,NyLPC_TcHttpdConnection_CONNECTION_MODE_CLOSE);\r
+    NyLPC_cHttpdConnection_sendResponseHeader(i_connection,i_status,"text/html",NULL);\r
+    if(mt!=NyLPC_THttpMethodType_HEAD){\r
+        NyLPC_cHttpdConnection_sendResponseBodyF(i_connection,"<!DOCTYPE html><html><head><title>MiMicHTTPD</title></head><body>Status %d</body></html>",i_status);\r
+    }\r
 }\r
 \r
 \r
@@ -50,11 +50,11 @@ void NyLPC_cHttpdUtils_sendErrorResponse(NyLPC_TcHttpdConnection_t* i_connection
  */\r
 NyLPC_TBool NyLPC_cHttpdUtils_sendJsonHeader(NyLPC_TcHttpdConnection_t* i_connection)\r
 {\r
-       const static char* additional_header=\r
-               "Access-Control-Allow-Origin:*\r\n"\r
-               "Pragma: no-cache\r\n"\r
-               "Cache-Control: no-cache\r\n";\r
-       const static char* content_type="application/json";\r
-       return NyLPC_cHttpdConnection_sendResponseHeader(i_connection,200,content_type,additional_header);\r
+    const static char* additional_header=\r
+        "Access-Control-Allow-Origin:*\r\n"\r
+        "Pragma: no-cache\r\n"\r
+        "Cache-Control: no-cache\r\n";\r
+    const static char* content_type="application/json";\r
+    return NyLPC_cHttpdConnection_sendResponseHeader(i_connection,200,content_type,additional_header);\r
 }\r
 \r