Re: [Cppcms-users] 404 not found with valid URL and POST Request
Brought to you by:
artyom-beilis
|
From: SIMON A. <All...@su...> - 2013-03-11 06:26:56
|
Artyom Sorry my echo has an alias on -e , so actually my previous are to read like echo -e , and as said I first discover the problem in my python script that use httplib to generate the http request. Regards, Allan SIMON Tatoeba Administrator (Sysko) ________________________________________ De : Artyom Beilis [art...@ya...] Envoyé : lundi 11 mars 2013 06:02 À : cpp...@li... Objet : Re: [Cppcms-users] 404 not found with valid URL and POST Request Allan, You are missing something important: $ echo echo 'POST /users/register-new_treat HTTP/1.1\r\nHost: en.tatolocal:8080\r\nAccept-Encoding: identity\nContent-Length: 13\r\ent-Type: application/x-www-form-urlencoded\r\n\r\nusername=toto' | hexdump -C 00000000 65 63 68 6f 20 50 4f 53 54 20 2f 75 73 65 72 73 |echo POST /users| 00000010 2f 72 65 67 69 73 74 65 72 2d 6e 65 77 5f 74 72 |/register-new_tr| 00000020 65 61 74 20 48 54 54 50 2f 31 2e 31 5c 72 5c 6e |eat HTTP/1.1\r\n| 00000030 48 6f 73 74 3a 20 65 6e 2e 74 61 74 6f 6c 6f 63 |Host: en.tatoloc| 00000040 61 6c 3a 38 30 38 30 5c 72 5c 6e 41 63 63 65 70 |al:8080\r\nAccep| 00000050 74 2d 45 6e 63 6f 64 69 6e 67 3a 20 69 64 65 6e |t-Encoding: iden| 00000060 74 69 74 79 5c 6e 43 6f 6e 74 65 6e 74 2d 4c 65 |tity\nContent-Le| 00000070 6e 67 74 68 3a 20 31 33 5c 72 5c 6e 43 6f 6e 74 |ngth: 13\r\nCont| 00000080 65 6e 74 2d 54 79 70 65 3a 20 61 70 70 6c 69 63 |ent-Type: applic| 00000090 61 74 69 6f 6e 2f 78 2d 77 77 77 2d 66 6f 72 6d |ation/x-www-form| 000000a0 2d 75 72 6c 65 6e 63 6f 64 65 64 5c 72 5c 6e 5c |-urlencoded\r\n\| 000000b0 72 5c 6e 75 73 65 72 6e 61 6d 65 3d 74 6f 74 6f |r\nusername=toto| 000000c0 0a |.| 000000c1 $ echo '\r\n' gives output "\r\n" (4 bytes "\" "r" "\" "n") And not 2 bytes CR-LF bytes \x13\x10 Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: SIMON Allan <All...@su...> >To: Artyom Beilis <art...@ya...>; "cpp...@li..." <cpp...@li...> >Sent: Monday, March 11, 2013 5:25 AM >Subject: Re: [Cppcms-users] 404 not found with valid URL and POST Request > > > >Hello > >Actually that's the one with only \n which is working (though as you said it's supposed to be the \r\n which should work), maybe my previous mail wasn't clear. >Note that the echo here is only to make simpler to see/test , I'm actually using python and httplib, and I've dumped the request using set_debuglevel > > > >Regards, > >Allan SIMON >Tatoeba Administrator (Sysko) > > >________________________________ > >De : Artyom Beilis [art...@ya...] >Envoyé : dimanche 10 mars 2013 20:18 >À : cpp...@li... >Objet : Re: [Cppcms-users] 404 not found with valid URL and POST Request > > >HTTP requires that the headers are separated with CR/LF i.e. \r\n. >The request that uses "\n" only is not an HTTP request, also many >web servers accept it as well. > > >Internal CppCMS web server designed mostly for embedded applications >and debugging and requires confirming headers. > > >Also note that in echo you can't path "\r\n" the way you do :-) > >Artyom Beilis >-------------- >CppCMS - C++ Web Framework: http://cppcms.com/ >CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > > >>________________________________ >> From: SIMON Allan <All...@su...> >>To: "cpp...@li..." <cpp...@li...> >>Sent: Sunday, March 10, 2013 8:55 PM >>Subject: [Cppcms-users] 404 not found with valid URL and POST Request >> >> >> >>Hello >> >>When I try to test my code with the embedded http server (there's no problem when using the FastCGI interface) the following request fail >> >>echo 'POST /users/register-new_treat HTTP/1.1\r\nHost: en.tatolocal:8080\r\nAccept-Encoding: identity\r\nContent-Length: 13\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\nusername=toto' | nc en.tatolocal 8080 >> >>but if I remove the \r just before ContentLength, it works correctly >> >> >>echo 'POST /users/register-new_treat HTTP/1.1\r\nHost: en.tatolocal:8080\r\nAccept-Encoding: identity\nContent-Length: 13\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\nusername=toto' | nc en.tatolocal 8080 >> >>I suppose it's certainly a little problem in the code which is parsing the HTTP request ? >> >> >> >> >> >>Regards, >> >>Allan SIMON >>Tatoeba Administrator (Sysko) >> >>------------------------------------------------------------------------------ >>Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester >>Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the >>endpoint security space. For insight on selecting the right partner to >>tackle endpoint security challenges, access the full report. >>http://p.sf.net/sfu/symantec-dev2dev >>_______________________________________________ >>Cppcms-users mailing list >>Cpp...@li... >>https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> >> >------------------------------------------------------------------------------ >Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester >Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the >endpoint security space. For insight on selecting the right partner to >tackle endpoint security challenges, access the full report. >http://p.sf.net/sfu/symantec-dev2dev >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > ------------------------------------------------------------------------------ Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report. http://p.sf.net/sfu/symantec-dev2dev _______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |