Thread: [Cppcms-users] 502 Bad Gateway after Xhr posting plain text and some more questions
Brought to you by:
artyom-beilis
From: Stanimir M. <sta...@zo...> - 2010-04-30 09:44:18
|
Hi Artyom, I tried your chat example with dojo and it works. However, when I send plain text from dojo and not form post with form=some text i get "502 Bad Gateway" error. here is the post request: Host localhost:8080 User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100407 Ubuntu/9.10 (karmic) Firefox/3.6.3 Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language en,bg;q=0.7,en-us;q=0.3 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 115 Connection keep-alive Content-Type application/x-www-form-urlencoded;charset=utf-8 Referer http://localhost:8080/hello_world/chat Content-Length 7 Cookie test=1270049271 here is the content "sssssss" Also, sometimes when i click multiple times on my test cppcms application, I get "Segmentation Fault" and my cppcms application stops? Another problem is that I can't make the session work even from your hello_world example. It always refreshes the time? Greetings, Stanimir |
From: Artyom <art...@ya...> - 2010-04-30 12:40:37
|
Hello, > Hi Artyom, > > I tried your chat example with dojo and it works. > However, when I send plain text from dojo > and not form post with form=some text i get "502 Bad > Gateway" error. Ok, indeed there was an issue - I didn't written any response for POST. Actually the response was empty. Fixed in hello_world.cpp in trunk. I had to notice an application that output completed (if I do not write anything...) So just run svn update. > > here is the post request: > > Host localhost:8080 > User-Agent Mozilla/5.0 (X11; U; Linux > i686; en-US; rv:1.9.2.3) > Gecko/20100407 Ubuntu/9.10 (karmic) Firefox/3.6.3 > Accept > text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 > Accept-Language en,bg;q=0.7,en-us;q=0.3 > Accept-Encoding gzip,deflate > Accept-Charset > ISO-8859-1,utf-8;q=0.7,*;q=0.7 > Keep-Alive 115 > Connection keep-alive > Content-Type > application/x-www-form-urlencoded;charset=utf-8 > Referer http://localhost:8080/hello_world/chat > Content-Length 7 > Cookie test=1270049271 > > here is the content "sssssss" > Few notes: 1st you need to send POST request in form message=ssssss (meaning it expects "Form" behavior" > > Also, sometimes when i click multiple times on my test > cppcms > application, I get "Segmentation Fault" and my cppcms > application > stops? Can you bring me the backtrace of segmentation fault? You can do it with GDB gdb your_app > r Crashes > bt > > Another problem is that I can't make the session work even > from your > hello_world example. It always refreshes the time? Do you have any session backend defined? Give me the content of "session" object of the configuration? At least default build of hello world - going to http://localhost:8080/hello/session Make sure you are using latest CppCMS version. Also check if make test passes all tests, if not which one fail? > > Greetings, > Stanimir > > Best, Artyom |
From: Stanimir M. <sta...@zo...> - 2010-04-30 13:42:02
|
On Fri, Apr 30, 2010 at 3:40 PM, Artyom <art...@ya...> wrote: > Hello, > >> Hi Artyom, >> >> I tried your chat example with dojo and it works. >> However, when I send plain text from dojo >> and not form post with form=some text i get "502 Bad >> Gateway" error. > > Ok, indeed there was an issue - I didn't written any response for POST. > Actually the response was empty. Fixed in hello_world.cpp in trunk. > > I had to notice an application that output completed (if I do not > write anything...) > > So just run svn update. > >> >> here is the post request: >> >> Host localhost:8080 >> User-Agent Mozilla/5.0 (X11; U; Linux >> i686; en-US; rv:1.9.2.3) >> Gecko/20100407 Ubuntu/9.10 (karmic) Firefox/3.6.3 >> Accept >> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 >> Accept-Language en,bg;q=0.7,en-us;q=0.3 >> Accept-Encoding gzip,deflate >> Accept-Charset >> ISO-8859-1,utf-8;q=0.7,*;q=0.7 >> Keep-Alive 115 >> Connection keep-alive >> Content-Type >> application/x-www-form-urlencoded;charset=utf-8 >> Referer http://localhost:8080/hello_world/chat >> Content-Length 7 >> Cookie test=1270049271 >> >> here is the content "sssssss" >> > > Few notes: > > 1st you need to send POST request in form message=ssssss (meaning > it expects "Form" behavior" > Yes, I saw that. But what if I need just the content of the post which is not "Form" behavior. For example, sending json object without "message" name for it? > >> >> Also, sometimes when i click multiple times on my test >> cppcms >> application, I get "Segmentation Fault" and my cppcms >> application >> stops? > > Can you bring me the backtrace of segmentation fault? > > You can do it with GDB > > gdb your_app > > r > Crashes > > bt > I will do it after a while. > > >> >> Another problem is that I can't make the session work even >> from your >> hello_world example. It always refreshes the time? > > Do you have any session backend defined? > > Give me the content of "session" object of the configuration? > > At least default build of hello world - going to > > http://localhost:8080/hello/session > > Make sure you are using latest CppCMS version. > Also check if make test passes all tests, if not which one fail? > My mistake, it works. I somehow missed the file back end in the config. >> >> Greetings, >> Stanimir >> >> > > Best, > Artyom > > > > > > ------------------------------------------------------------------------------ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Artyom <art...@ya...> - 2010-04-30 13:59:07
|
Hello, > > Few notes: > > > > 1st you need to send POST request in form > message=ssssss (meaning > > it expects "Form" behavior" > > > > Yes, I saw that. But what if I need just the content of the > post which > is not "Form" behavior. > For example, sending json object without "message" name for > it? > You can access post data directly using raw_post_data() member function of http::request(). std::pair<void *,size_t> post_data = request().raw_post_data(); And analyze this. ------------------- BTW Json: CppCMS 1.x.x supports JSON-RPC as well... You may find an example of usage in tests/jsonrpc_test.cpp Best, Artyom |