Re: [cgi-devel] post data with illegal characters
Status: Beta
Brought to you by:
drrngrvy
From: <jc...@ol...> - 2011-01-12 01:43:02
|
Hello Darren I am still struggling with that issue. I know for sure the problem is the presence of nul terminators at the two ends of post values. I must apologize because I have not yet put together a little program showing the issue. I really like your library (and I use it) and I would like to hep you a bit. Par of the problem is that I noticed the issue when getting post values from the upload of file throug nginx and the nginx_upload_module. This module allows the upload of the file to be done by nginx and, once the file on the server, the request is transferred from the nginx module to the fascgi backends. To make it harder to write a small code, I was also using plupload on the client side to manage the upload od several files at the same time. I have a little function that cleans the null terminators from every post value that is used by my program, which solves the consequences of the problem but is not a satisfactory solution. Let me revisit the issue and produce something useful to track the issue. Thanks again Jean-Christophe Hi Guys, > > Just following this up - are you able to reproduce this? > > The function described below should be redundant since the problem is most > likely in the CGI library. > > I'm wondering if this is coming from reusing an fcgi::request object > without > calling fcgi::request::clear() between requests? > > As I mentioned, if you can respond with a minimal example that exhibits > the > behaviour I can take a look. > > Cheers, > Darren > > On 2 November 2010 14:17, Scott Bailey <Ba...@in...> wrote: > >> There's a defect in that function. The behavior of operations on an >> iterator after erase() is undefined. Do NOT get in the habit of using >> dead iterators, it will eventually bite you. Also, I think using >> isgraph and isalnum is redundant? >> >> Here's an improvement, BUT I'd be willing to be theres a better way, >> still. >> >> void remove_non_graph(std::string& str) >> { >> std::string::iterator i=str.begin(); >> while( i != str.end() ) >> { >> if( isgraph(*i) ) >> ++i; >> else >> i=str.erase(i); >> } >> } >> >> >> >> >> On Tue, Nov 2, 2010 at 6:11 AM, <jc...@ol...> wrote: >> >> Hello, >> >> >> >> Some of my POST variable are been added illegal characters at the >> end. >> >> >> >> 1986^@^@^@^@^@ >> >> >> >> insead of >> >> 1986 >> > >> > APplying the following function: >> > void >> > remove_non_graph(std::string& str) >> > { >> > for(std::string::iterator i=str.end()-1; i>=str.begin(); --i) >> > { >> > if ( !isalnum(*i) && !isgraph(*i) ) >> > { >> > str.erase(i); >> > } >> > } >> > } >> > to a variable fixes the issue. >> > >> > Do you think this is a solid patch? >> > If so, where in the source codes, should I add it so that all the >> > variables are cleaned this way? >> > >> > Thanks! >> > >> >> >> >> to read those data I am using: >> >> >> >> for(typename Map::const_iterator i = m.begin(); i != m.end(); ++i) >> >> { >> >> os << i->first << " = " << i->second << "\n"; >> >> } >> >> and >> >> >> >> req.post.pick("task","default"); >> >> >> >> with the illegal characters been added in both cases. >> >> >> >>>From the html, I don't see any reason why that would happen. >> >> >> >> Any idea on how I could fix this problem? >> >> >> >> Thanks you >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> >> Nokia and AT&T present the 2010 Calling All Innovators-North America >> >> contest >> >> Create new apps & games for the Nokia N8 for consumers in U.S. and >> Canada >> >> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in >> >> marketing >> >> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi >> Store >> >> http://p.sf.net/sfu/nokia-dev2dev >> >> _______________________________________________ >> >> cgi-devel mailing list >> >> cgi...@li... >> >> https://lists.sourceforge.net/lists/listinfo/cgi-devel >> >> >> > >> > >> > >> > >> ------------------------------------------------------------------------------ >> > Nokia and AT&T present the 2010 Calling All Innovators-North America >> contest >> > Create new apps & games for the Nokia N8 for consumers in U.S. and >> Canada >> > $10 million total in prizes - $4M cash, 500 devices, nearly $6M in >> marketing >> > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi >> Store >> > http://p.sf.net/sfu/nokia-dev2dev >> > _______________________________________________ >> > cgi-devel mailing list >> > cgi...@li... >> > https://lists.sourceforge.net/lists/listinfo/cgi-devel >> > >> >> >> >> -- >> Scott Bailey >> >> >> ------------------------------------------------------------------------------ >> Nokia and AT&T present the 2010 Calling All Innovators-North America >> contest >> Create new apps & games for the Nokia N8 for consumers in U.S. and >> Canada >> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in >> marketing >> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store >> http://p.sf.net/sfu/nokia-dev2dev >> _______________________________________________ >> cgi-devel mailing list >> cgi...@li... >> https://lists.sourceforge.net/lists/listinfo/cgi-devel >> > |