Re: [Cppcms-users] get post data in cppcms 1.x.x
Brought to you by:
artyom-beilis
From: Artyom <art...@ya...> - 2010-03-15 07:22:51
|
Hello Daniel > Hello. > > In cppcms 0.0.5 I do > > std::string postdata = > env->getPostData(); > > to get post data. > > I can't find equivalent function in cppcms 1.x.x. > > What is the equivalent method to get post data in cppcms > 1.x.x ? class cppcms::http::request has a member raw_post_data() that returns std::pair<void *,size_t>; So you can write: std::pair<void *,size_t> data = request().raw_post_data(); std::string postdata(reinterpret_cast<char *>(data.first),data.second); Please note: this would not when content-type is "multipart/form-data" i.e. file upload, files data can be accessed via file interface and http::request::post() (files upload is not-implemented yet). Rationale: files maybe too big to put into process memory. Artyom |