LoginSignup
3
3

More than 5 years have passed since last update.

multipart/form-dataの扱いにPoco::Net::HTMLFormを使用してはいけない

Posted at

Poco 1.3.6あたりのお話。たぶん前後のバージョンでも同じ。

multipart/form-dataの扱いにPoco::Net::HTMLFormを使うのを避け、Poco::Net::MultipartReaderを使おう。

2つの理由

1つめの理由。

POSTのパラメータは自身のNameValueCollectionに格納し、アップロードファイルはPoco::Net::PartHandlerのhandlePartを呼び出し処理させる。アップロードファイルであるかどうかはContent-Dispositionにfilenameが存在するかどうかで判断しているためテスト時にリクエスト側で柔軟な対応がしにくい。

2つめの理由。

どうもmultipart/form-dataの2つめの以降のパートを読み飛ばす時がある。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3