i_inst->_content_length=i_content_length;\r
return;\r
}\r
-void NyLPC_cHttpHeaderWriter_setClose(NyLPC_TcHttpHeaderWriter_t* i_inst)\r
+void NyLPC_cHttpHeaderWriter_setConnectionClose(NyLPC_TcHttpHeaderWriter_t* i_inst,NyLPC_TBool i_is_close)\r
{\r
- i_inst->_is_close=NyLPC_TUInt8_TRUE;\r
+ i_inst->_is_close=i_is_close;\r
return;\r
}\r
\r
\r
\r
const static struct{\r
- const NyLPC_TUInt16 code;\r
+ NyLPC_TUInt16 code;\r
const NyLPC_TChar* message;\r
}status_line_tbl[]={\r
{200,"OK"},\r
+ {301,"Moved Permanently"},\r
+ {302,"Found"},\r
{400,"Bad Request"},\r
{403,"Forbidden"},\r
{404,"Not Found"},\r
+ {405,"Method Not Allowed"},\r
{500,"Internal Server Error"},\r
{0,NULL}//これ最後にしてね。\r
};\r
if(!NyLPC_iHttpPtrStream_write(i_inst->_ref_stream,"HTTP/1.1 ",9)){\r
NyLPC_OnErrorGoto(Error);\r
}\r
- itoa(i_status,v,10);\r
+ NyLPC_itoa(i_status,v,10);\r
if(!NyLPC_iHttpPtrStream_write(i_inst->_ref_stream,v,-1)){\r
NyLPC_OnErrorGoto(Error);\r
}\r
if(!NyLPC_iHttpPtrStream_write(i_inst->_ref_stream,"Content-Length: ",-1)){\r
NyLPC_OnErrorGoto(Error);\r
}\r
- itoa(i_inst->_content_length,v,10);\r
+ NyLPC_itoa(i_inst->_content_length,v,10);\r
if(!writeln(i_inst->_ref_stream,v,-1)){\r
NyLPC_OnErrorGoto(Error);\r
}\r
i_inst->_is_error=NyLPC_TUInt8_FALSE;\r
return NyLPC_TBool_FALSE;\r
}\r
+\r
/**\r
* 独自定義のメッセージヘッダを記述します。\r
*/\r
return NyLPC_TBool_FALSE;\r
}\r
\r
+\r
+NyLPC_TBool NyLPC_cHttpHeaderWriter_writeRawMessage(NyLPC_TcHttpHeaderWriter_t* i_inst,const NyLPC_TChar* i_additional_header)\r
+{\r
+ //エラー状態ならなにもしない。\r
+ if(i_inst->_is_error){\r
+ return NyLPC_TBool_FALSE;\r
+ }\r
+ if(!NyLPC_iHttpPtrStream_write(i_inst->_ref_stream,i_additional_header,strlen(i_additional_header))){\r
+ NyLPC_OnErrorGoto(Error);\r
+ }\r
+ return NyLPC_TBool_TRUE;\r
+Error:\r
+ i_inst->_is_error=NyLPC_TUInt8_FALSE;\r
+ return NyLPC_TBool_FALSE;\r
+}\r
+\r
/**\r
* Httpヘッダの書き込みを完了します。\r
* 続けてbody転送が可能な場合は、必要に応じてエンコーディングモードを更新します。\r