Thread: [Cppcms-users] 404 not found with valid URL and POST Request
Brought to you by:
artyom-beilis
|
From: SIMON A. <All...@su...> - 2013-03-10 19:11:08
|
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) |
|
From: Artyom B. <art...@ya...> - 2013-03-10 20:18:26
|
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 > > > |
|
From: SIMON A. <All...@su...> - 2013-03-11 03:26:03
|
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...<mailto:Cpp...@li...> https://lists.sourceforge.net/lists/listinfo/cppcms-users |
|
From: Artyom B. <art...@ya...> - 2013-03-11 06:02:43
|
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 > > > |
|
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 |
|
From: Artyom B. <art...@ya...> - 2013-03-11 08:45:36
|
Can you give a hexdump of your echo command, because with -e there is still a redundend new line (after content length) so the content that is sent is actually bigger than it should be. It seems that because you do not put '\r' than the Content-Length is ignored and not treated. Also can give the response of the web server. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ ----- Original Message ----- > From: SIMON Allan <All...@su...> > To: Artyom Beilis <art...@ya...>; "cpp...@li..." <cpp...@li...> > Cc: > Sent: Monday, March 11, 2013 8:11 AM > Subject: Re: [Cppcms-users] 404 not found with valid URL and POST Request > > 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 > > > > ------------------------------------------------------------------------------ > 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 > |
|
From: SIMON A. <All...@su...> - 2013-03-11 09:20:11
|
Hello Just to be sure we're not misunderstood, the one without \r , that i agree with you should not be working is actually the only one working, the correct one (see in second part) is the one not working //// first one working (with \r missing before content length) echo -e '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 it return me this HTTP/1.0 302 Found Server: CppCMS-Embedded/1.0.3 Connection: close Content-Type: text/html; charset=utf-8 Location: / Status: 302 Found X-Powered-By: CppCMS/1.0.3 Set-Cookie:cppcms_session=I01e13278542b89e62db1dfe541b8d790; Domain=.tatolocal:8080; Max-Age=604800; Path=/; Version=1 which what i expect dump of the echo 00000000 50 4f 53 54 20 2f 75 73 65 72 73 2f 72 65 67 69 |POST /users/regi| 00000010 73 74 65 72 2d 6e 65 77 5f 74 72 65 61 74 20 48 |ster-new_treat H| 00000020 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 65 |TTP/1.1..Host: e| 00000030 6e 2e 74 61 74 6f 6c 6f 63 61 6c 3a 38 30 38 30 |n.tatolocal:8080| 00000040 0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e |..Accept-Encodin| 00000050 67 3a 20 69 64 65 6e 74 69 74 79 0a 43 6f 6e 74 |g: identity.Cont| 00000060 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 33 0d 0a |ent-Length: 13..| 00000070 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 |Content-Type: ap| 00000080 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 2d |plication/x-www-| 00000090 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 0d |form-urlencoded.| 000000a0 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 6f |...username=toto| /////// second one (with \r\n everywhere but this Don't work , though we agree it should echo -e '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 output HTTP/1.0 404 Not Found Server: CppCMS-Embedded/1.0.3 Connection: close Content-Type: text/html; charset=utf-8 Status: 404 Not Found X-Powered-By: CppCMS/1.0.3 Set-Cookie:cppcms_session=I812cba2aefe6403e7998ff93f3e73189; Domain=.tatolocal:8080; Max-Age=604800; Path=/; Version=1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>404 — Not Found</title> </head> <body> <h1>404 — Not Found</h1> </body> </html> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>404 — Not Found</title> </head> <body> <h1>404 — Not Found</h1> </body> </html> 00000000 50 4f 53 54 20 2f 75 73 65 72 73 2f 72 65 67 69 |POST /users/regi| 00000010 73 74 65 72 2d 6e 65 77 5f 74 72 65 61 74 20 48 |ster-new_treat H| 00000020 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 65 |TTP/1.1..Host: e| 00000030 6e 2e 74 61 74 6f 6c 6f 63 61 6c 3a 38 30 38 30 |n.tatolocal:8080| 00000040 0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e |..Accept-Encodin| 00000050 67 3a 20 69 64 65 6e 74 69 74 79 0d 0a 43 6f 6e |g: identity..Con| 00000060 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 33 0d |tent-Length: 13.| 00000070 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 |.Content-Type: a| 00000080 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 |pplication/x-www| 00000090 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 |-form-urlencoded| 000000a0 0d 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 |....username=tot| 000000b0 6f 0a |o.| Regards, Allan SIMON Tatoeba Administrator (Sysko) ________________________________________ De : Artyom Beilis [art...@ya...] Envoyé : lundi 11 mars 2013 08:45 À : cpp...@li... Objet : Re: [Cppcms-users] 404 not found with valid URL and POST Request Can you give a hexdump of your echo command, because with -e there is still a redundend new line (after content length) so the content that is sent is actually bigger than it should be. It seems that because you do not put '\r' than the Content-Length is ignored and not treated. Also can give the response of the web server. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ ----- Original Message ----- > From: SIMON Allan <All...@su...> > To: Artyom Beilis <art...@ya...>; "cpp...@li..." <cpp...@li...> > Cc: > Sent: Monday, March 11, 2013 8:11 AM > Subject: Re: [Cppcms-users] 404 not found with valid URL and POST Request > > 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 > > > > ------------------------------------------------------------------------------ > 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 |
|
From: Artyom B. <art...@ya...> - 2013-03-11 09:09:54
|
Note this: > 000000a0 0d 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 |....username=tot| > 000000b0 6f 0a |o.| The "0a" at the end 1 byte longer than actual Content-Length Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ ----- Original Message ----- > From: SIMON Allan <All...@su...> > To: Artyom Beilis <art...@ya...>; "cpp...@li..." <cpp...@li...> > Cc: > Sent: Monday, March 11, 2013 11:03 AM > Subject: RE:[Cppcms-users] 404 not found with valid URL and POST Request > > Hello > > Just to be sure we're not misunderstood, the one without \r , that i > agree with you should not be working is actually the only one working, the > correct one (see in second part) is the one not working > > //// first one working (with \r missing before content length) > > echo -e '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 > > it return me this > > HTTP/1.0 302 Found > Server: CppCMS-Embedded/1.0.3 > Connection: close > Content-Type: text/html; charset=utf-8 > Location: / > Status: 302 Found > X-Powered-By: CppCMS/1.0.3 > Set-Cookie:cppcms_session=I01e13278542b89e62db1dfe541b8d790; > Domain=.tatolocal:8080; Max-Age=604800; Path=/; Version=1 > > which what i expect > > dump of the echo > > 00000000 50 4f 53 54 20 2f 75 73 65 72 73 2f 72 65 67 69 |POST /users/regi| > 00000010 73 74 65 72 2d 6e 65 77 5f 74 72 65 61 74 20 48 |ster-new_treat H| > 00000020 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 65 |TTP/1.1..Host: e| > 00000030 6e 2e 74 61 74 6f 6c 6f 63 61 6c 3a 38 30 38 30 |n.tatolocal:8080| > 00000040 0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e |..Accept-Encodin| > 00000050 67 3a 20 69 64 65 6e 74 69 74 79 0a 43 6f 6e 74 |g: identity.Cont| > 00000060 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 33 0d 0a |ent-Length: 13..| > 00000070 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 |Content-Type: ap| > 00000080 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 2d |plication/x-www-| > 00000090 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 0d |form-urlencoded.| > 000000a0 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 6f |...username=toto| > > /////// second one (with \r\n everywhere > > but this Don't work , though we agree it should > > echo -e '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 > > output > > > HTTP/1.0 404 Not Found > Server: CppCMS-Embedded/1.0.3 > Connection: close > Content-Type: text/html; charset=utf-8 > Status: 404 Not Found > X-Powered-By: CppCMS/1.0.3 > Set-Cookie:cppcms_session=I812cba2aefe6403e7998ff93f3e73189; > Domain=.tatolocal:8080; Max-Age=604800; Path=/; Version=1 > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/html4/loose.dtd"> > <html> > <head> > <title>404 — Not Found</title> > </head> > <body> > <h1>404 — Not Found</h1> > </body> > </html> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/html4/loose.dtd"> > <html> > <head> > <title>404 — Not Found</title> > </head> > <body> > <h1>404 — Not Found</h1> > </body> > </html> > > 00000000 50 4f 53 54 20 2f 75 73 65 72 73 2f 72 65 67 69 |POST /users/regi| > 00000010 73 74 65 72 2d 6e 65 77 5f 74 72 65 61 74 20 48 |ster-new_treat H| > 00000020 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 65 |TTP/1.1..Host: e| > 00000030 6e 2e 74 61 74 6f 6c 6f 63 61 6c 3a 38 30 38 30 |n.tatolocal:8080| > 00000040 0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e |..Accept-Encodin| > 00000050 67 3a 20 69 64 65 6e 74 69 74 79 0d 0a 43 6f 6e |g: identity..Con| > 00000060 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 33 0d |tent-Length: 13.| > 00000070 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 |.Content-Type: a| > 00000080 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 |pplication/x-www| > 00000090 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 |-form-urlencoded| > 000000a0 0d 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 |....username=tot| > 000000b0 6f 0a |o.| > > > > Regards, > > Allan SIMON > Tatoeba Administrator (Sysko) > > ________________________________________ > De : Artyom Beilis [art...@ya...] > Envoyé : lundi 11 mars 2013 08:45 > À : cpp...@li... > Objet : Re: [Cppcms-users] 404 not found with valid URL and POST Request > > Can you give a hexdump of your echo command, because with -e there is still a > redundend new line (after content length) so the content that is sent is > actually bigger than it should be. > > It seems that because you do not put '\r' than the Content-Length is > ignored and not treated. > > Also can give the response of the web server. > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > > > ----- Original Message ----- >> From: SIMON Allan <All...@su...> >> To: Artyom Beilis <art...@ya...>; > "cpp...@li..." > <cpp...@li...> >> Cc: >> Sent: Monday, March 11, 2013 8:11 AM >> Subject: Re: [Cppcms-users] 404 not found with valid URL and POST Request >> >> 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 >> >> >> >> > ------------------------------------------------------------------------------ >> 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 > |
|
From: SIMON A. <All...@su...> - 2013-03-11 09:22:12
|
Hello same request with -n to remove this final new line echo -ne '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 still 404 HTTP/1.0 404 Not Found Server: CppCMS-Embedded/1.0.3 Connection: close Content-Type: text/html; charset=utf-8 Status: 404 Not Found X-Powered-By: CppCMS/1.0.3 Set-Cookie:cppcms_session=I6c65243c1fa8ff04b2f811a299f8939d; Domain=.tatolocal:8080; Max-Age=604800; Path=/; Version=1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>404 — Not Found</title> </head> <body> <h1>404 — Not Found</h1> </body> </html> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>404 — Not Found</title> </head> <body> <h1>404 — Not Found</h1> </body> </html> 00000000 50 4f 53 54 20 2f 75 73 65 72 73 2f 72 65 67 69 |POST /users/regi| 00000010 73 74 65 72 2d 6e 65 77 5f 74 72 65 61 74 20 48 |ster-new_treat H| 00000020 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 65 |TTP/1.1..Host: e| 00000030 6e 2e 74 61 74 6f 6c 6f 63 61 6c 3a 38 30 38 30 |n.tatolocal:8080| 00000040 0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e |..Accept-Encodin| 00000050 67 3a 20 69 64 65 6e 74 69 74 79 0d 0a 43 6f 6e |g: identity..Con| 00000060 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 33 0d |tent-Length: 13.| 00000070 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 |.Content-Type: a| 00000080 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 |pplication/x-www| 00000090 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 |-form-urlencoded| 000000a0 0d 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 |....username=tot| 000000b0 6f |o| 000000b1 As you can see here this is with the correctly formed request (\r\n everywhere) Regards, Allan SIMON Tatoeba Administrator (Sysko) ________________________________________ De : Artyom Beilis [art...@ya...] Envoyé : lundi 11 mars 2013 09:09 À : cpp...@li... Objet : Re: [Cppcms-users] 404 not found with valid URL and POST Request Note this: > 000000a0 0d 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 |....username=tot| > 000000b0 6f 0a |o.| The "0a" at the end 1 byte longer than actual Content-Length Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ ----- Original Message ----- > From: SIMON Allan <All...@su...> > To: Artyom Beilis <art...@ya...>; "cpp...@li..." <cpp...@li...> > Cc: > Sent: Monday, March 11, 2013 11:03 AM > Subject: RE:[Cppcms-users] 404 not found with valid URL and POST Request > > Hello > > Just to be sure we're not misunderstood, the one without \r , that i > agree with you should not be working is actually the only one working, the > correct one (see in second part) is the one not working > > //// first one working (with \r missing before content length) > > echo -e '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 > > it return me this > > HTTP/1.0 302 Found > Server: CppCMS-Embedded/1.0.3 > Connection: close > Content-Type: text/html; charset=utf-8 > Location: / > Status: 302 Found > X-Powered-By: CppCMS/1.0.3 > Set-Cookie:cppcms_session=I01e13278542b89e62db1dfe541b8d790; > Domain=.tatolocal:8080; Max-Age=604800; Path=/; Version=1 > > which what i expect > > dump of the echo > > 00000000 50 4f 53 54 20 2f 75 73 65 72 73 2f 72 65 67 69 |POST /users/regi| > 00000010 73 74 65 72 2d 6e 65 77 5f 74 72 65 61 74 20 48 |ster-new_treat H| > 00000020 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 65 |TTP/1.1..Host: e| > 00000030 6e 2e 74 61 74 6f 6c 6f 63 61 6c 3a 38 30 38 30 |n.tatolocal:8080| > 00000040 0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e |..Accept-Encodin| > 00000050 67 3a 20 69 64 65 6e 74 69 74 79 0a 43 6f 6e 74 |g: identity.Cont| > 00000060 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 33 0d 0a |ent-Length: 13..| > 00000070 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 |Content-Type: ap| > 00000080 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 2d |plication/x-www-| > 00000090 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 0d |form-urlencoded.| > 000000a0 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 6f |...username=toto| > > /////// second one (with \r\n everywhere > > but this Don't work , though we agree it should > > echo -e '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 > > output > > > HTTP/1.0 404 Not Found > Server: CppCMS-Embedded/1.0.3 > Connection: close > Content-Type: text/html; charset=utf-8 > Status: 404 Not Found > X-Powered-By: CppCMS/1.0.3 > Set-Cookie:cppcms_session=I812cba2aefe6403e7998ff93f3e73189; > Domain=.tatolocal:8080; Max-Age=604800; Path=/; Version=1 > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/html4/loose.dtd"> > <html> > <head> > <title>404 — Not Found</title> > </head> > <body> > <h1>404 — Not Found</h1> > </body> > </html> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/html4/loose.dtd"> > <html> > <head> > <title>404 — Not Found</title> > </head> > <body> > <h1>404 — Not Found</h1> > </body> > </html> > > 00000000 50 4f 53 54 20 2f 75 73 65 72 73 2f 72 65 67 69 |POST /users/regi| > 00000010 73 74 65 72 2d 6e 65 77 5f 74 72 65 61 74 20 48 |ster-new_treat H| > 00000020 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 65 |TTP/1.1..Host: e| > 00000030 6e 2e 74 61 74 6f 6c 6f 63 61 6c 3a 38 30 38 30 |n.tatolocal:8080| > 00000040 0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e |..Accept-Encodin| > 00000050 67 3a 20 69 64 65 6e 74 69 74 79 0d 0a 43 6f 6e |g: identity..Con| > 00000060 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 33 0d |tent-Length: 13.| > 00000070 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 |.Content-Type: a| > 00000080 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 |pplication/x-www| > 00000090 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 |-form-urlencoded| > 000000a0 0d 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 |....username=tot| > 000000b0 6f 0a |o.| > > > > Regards, > > Allan SIMON > Tatoeba Administrator (Sysko) > > ________________________________________ > De : Artyom Beilis [art...@ya...] > Envoyé : lundi 11 mars 2013 08:45 > À : cpp...@li... > Objet : Re: [Cppcms-users] 404 not found with valid URL and POST Request > > Can you give a hexdump of your echo command, because with -e there is still a > redundend new line (after content length) so the content that is sent is > actually bigger than it should be. > > It seems that because you do not put '\r' than the Content-Length is > ignored and not treated. > > Also can give the response of the web server. > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > > > ----- Original Message ----- >> From: SIMON Allan <All...@su...> >> To: Artyom Beilis <art...@ya...>; > "cpp...@li..." > <cpp...@li...> >> Cc: >> Sent: Monday, March 11, 2013 8:11 AM >> Subject: Re: [Cppcms-users] 404 not found with valid URL and POST Request >> >> 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 >> >> >> >> > ------------------------------------------------------------------------------ >> 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 |
|
From: Artyom B. <art...@ya...> - 2013-03-11 10:11:11
|
Can you please send me a sample code that reproduces it Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ ----- Original Message ----- > From: SIMON Allan <All...@su...> > To: Artyom Beilis <art...@ya...>; "cpp...@li..." <cpp...@li...> > Cc: > Sent: Monday, March 11, 2013 11:21 AM > Subject: Re: [Cppcms-users] 404 not found with valid URL and POST Request > > Hello > same request with -n to remove this final new line > > echo -ne '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 > > still 404 > > HTTP/1.0 404 Not Found > Server: CppCMS-Embedded/1.0.3 > Connection: close > Content-Type: text/html; charset=utf-8 > Status: 404 Not Found > X-Powered-By: CppCMS/1.0.3 > Set-Cookie:cppcms_session=I6c65243c1fa8ff04b2f811a299f8939d; > Domain=.tatolocal:8080; Max-Age=604800; Path=/; Version=1 > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/html4/loose.dtd"> > <html> > <head> > <title>404 — Not Found</title> > </head> > <body> > <h1>404 — Not Found</h1> > </body> > </html> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/html4/loose.dtd"> > <html> > <head> > <title>404 — Not Found</title> > </head> > <body> > <h1>404 — Not Found</h1> > </body> > </html> > > 00000000 50 4f 53 54 20 2f 75 73 65 72 73 2f 72 65 67 69 |POST /users/regi| > 00000010 73 74 65 72 2d 6e 65 77 5f 74 72 65 61 74 20 48 |ster-new_treat H| > 00000020 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 65 |TTP/1.1..Host: e| > 00000030 6e 2e 74 61 74 6f 6c 6f 63 61 6c 3a 38 30 38 30 |n.tatolocal:8080| > 00000040 0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e |..Accept-Encodin| > 00000050 67 3a 20 69 64 65 6e 74 69 74 79 0d 0a 43 6f 6e |g: identity..Con| > 00000060 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 33 0d |tent-Length: 13.| > 00000070 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 |.Content-Type: a| > 00000080 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 |pplication/x-www| > 00000090 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 |-form-urlencoded| > 000000a0 0d 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 |....username=tot| > 000000b0 6f |o| > 000000b1 > > > As you can see here this is with the correctly formed request (\r\n > everywhere) > > > Regards, > > Allan SIMON > Tatoeba Administrator (Sysko) > > ________________________________________ > De : Artyom Beilis [art...@ya...] > Envoyé : lundi 11 mars 2013 09:09 > À : cpp...@li... > Objet : Re: [Cppcms-users] 404 not found with valid URL and POST Request > > Note this: > >> 000000a0 0d 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 > |....username=tot| >> 000000b0 6f 0a |o.| > > > The "0a" at the end 1 byte longer than actual Content-Length > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > > > ----- Original Message ----- >> From: SIMON Allan <All...@su...> >> To: Artyom Beilis <art...@ya...>; > "cpp...@li..." > <cpp...@li...> >> Cc: >> Sent: Monday, March 11, 2013 11:03 AM >> Subject: RE:[Cppcms-users] 404 not found with valid URL and POST Request >> >> Hello >> >> Just to be sure we're not misunderstood, the one without \r , that > i >> agree with you should not be working is actually the only one working, the >> correct one (see in second part) is the one not working >> >> //// first one working (with \r missing before content length) >> >> echo -e '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 >> >> it return me this >> >> HTTP/1.0 302 Found >> Server: CppCMS-Embedded/1.0.3 >> Connection: close >> Content-Type: text/html; charset=utf-8 >> Location: / >> Status: 302 Found >> X-Powered-By: CppCMS/1.0.3 >> Set-Cookie:cppcms_session=I01e13278542b89e62db1dfe541b8d790; >> Domain=.tatolocal:8080; Max-Age=604800; Path=/; Version=1 >> >> which what i expect >> >> dump of the echo >> >> 00000000 50 4f 53 54 20 2f 75 73 65 72 73 2f 72 65 67 69 |POST > /users/regi| >> 00000010 73 74 65 72 2d 6e 65 77 5f 74 72 65 61 74 20 48 |ster-new_treat > H| >> 00000020 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 65 |TTP/1.1..Host: > e| >> 00000030 6e 2e 74 61 74 6f 6c 6f 63 61 6c 3a 38 30 38 30 > |n.tatolocal:8080| >> 00000040 0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e > |..Accept-Encodin| >> 00000050 67 3a 20 69 64 65 6e 74 69 74 79 0a 43 6f 6e 74 |g: > identity.Cont| >> 00000060 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 33 0d 0a |ent-Length: > 13..| >> 00000070 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 |Content-Type: > ap| >> 00000080 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 2d > |plication/x-www-| >> 00000090 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 0d > |form-urlencoded.| >> 000000a0 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 6f > |...username=toto| >> >> /////// second one (with \r\n everywhere >> >> but this Don't work , though we agree it should >> >> echo -e '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 >> >> output >> >> >> HTTP/1.0 404 Not Found >> Server: CppCMS-Embedded/1.0.3 >> Connection: close >> Content-Type: text/html; charset=utf-8 >> Status: 404 Not Found >> X-Powered-By: CppCMS/1.0.3 >> Set-Cookie:cppcms_session=I812cba2aefe6403e7998ff93f3e73189; >> Domain=.tatolocal:8080; Max-Age=604800; Path=/; Version=1 >> >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >> "http://www.w3.org/TR/html4/loose.dtd"> >> <html> >> <head> >> <title>404 — Not Found</title> >> </head> >> <body> >> <h1>404 — Not Found</h1> >> </body> >> </html> >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >> "http://www.w3.org/TR/html4/loose.dtd"> >> <html> >> <head> >> <title>404 — Not Found</title> >> </head> >> <body> >> <h1>404 — Not Found</h1> >> </body> >> </html> >> >> 00000000 50 4f 53 54 20 2f 75 73 65 72 73 2f 72 65 67 69 |POST > /users/regi| >> 00000010 73 74 65 72 2d 6e 65 77 5f 74 72 65 61 74 20 48 |ster-new_treat > H| >> 00000020 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 65 |TTP/1.1..Host: > e| >> 00000030 6e 2e 74 61 74 6f 6c 6f 63 61 6c 3a 38 30 38 30 > |n.tatolocal:8080| >> 00000040 0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e > |..Accept-Encodin| >> 00000050 67 3a 20 69 64 65 6e 74 69 74 79 0d 0a 43 6f 6e |g: > identity..Con| >> 00000060 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 33 0d |tent-Length: > 13.| >> 00000070 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 |.Content-Type: > a| >> 00000080 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 > |pplication/x-www| >> 00000090 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 > |-form-urlencoded| >> 000000a0 0d 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 > |....username=tot| >> 000000b0 6f 0a |o.| >> >> >> >> Regards, >> >> Allan SIMON >> Tatoeba Administrator (Sysko) >> >> ________________________________________ >> De : Artyom Beilis [art...@ya...] >> Envoyé : lundi 11 mars 2013 08:45 >> À : cpp...@li... >> Objet : Re: [Cppcms-users] 404 not found with valid URL and POST Request >> >> Can you give a hexdump of your echo command, because with -e there is still > a >> redundend new line (after content length) so the content that is sent is >> actually bigger than it should be. >> >> It seems that because you do not put '\r' than the > Content-Length is >> ignored and not treated. >> >> Also can give the response of the web server. >> >> Artyom Beilis >> -------------- >> CppCMS - C++ Web Framework: http://cppcms.com/ >> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> >> >> >> ----- Original Message ----- >>> From: SIMON Allan <All...@su...> >>> To: Artyom Beilis <art...@ya...>; >> "cpp...@li..." >> <cpp...@li...> >>> Cc: >>> Sent: Monday, March 11, 2013 8:11 AM >>> Subject: Re: [Cppcms-users] 404 not found with valid URL and POST > Request >>> >>> 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 >>> >>> >>> >>> >> > ------------------------------------------------------------------------------ >>> 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 > > > > ------------------------------------------------------------------------------ > 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 > |
|
From: SIMON A. <All...@su...> - 2013-03-11 13:00:30
|
Hello Artyom Sure, it's true it will be easier to test like that, I'm trying to provide that to you ASAP. By the way thanks for the time you've spent today answering me :) Regards, Allan SIMON Tatoeba Administrator (Sysko) ________________________________________ De : Artyom Beilis [art...@ya...] Envoyé : lundi 11 mars 2013 10:11 À : cpp...@li... Objet : Re: [Cppcms-users] 404 not found with valid URL and POST Request Can you please send me a sample code that reproduces it Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ ----- Original Message ----- > From: SIMON Allan <All...@su...> > To: Artyom Beilis <art...@ya...>; "cpp...@li..." <cpp...@li...> > Cc: > Sent: Monday, March 11, 2013 11:21 AM > Subject: Re: [Cppcms-users] 404 not found with valid URL and POST Request > > Hello > same request with -n to remove this final new line > > echo -ne '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 > > still 404 > > HTTP/1.0 404 Not Found > Server: CppCMS-Embedded/1.0.3 > Connection: close > Content-Type: text/html; charset=utf-8 > Status: 404 Not Found > X-Powered-By: CppCMS/1.0.3 > Set-Cookie:cppcms_session=I6c65243c1fa8ff04b2f811a299f8939d; > Domain=.tatolocal:8080; Max-Age=604800; Path=/; Version=1 > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/html4/loose.dtd"> > <html> > <head> > <title>404 — Not Found</title> > </head> > <body> > <h1>404 — Not Found</h1> > </body> > </html> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/html4/loose.dtd"> > <html> > <head> > <title>404 — Not Found</title> > </head> > <body> > <h1>404 — Not Found</h1> > </body> > </html> > > 00000000 50 4f 53 54 20 2f 75 73 65 72 73 2f 72 65 67 69 |POST /users/regi| > 00000010 73 74 65 72 2d 6e 65 77 5f 74 72 65 61 74 20 48 |ster-new_treat H| > 00000020 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 65 |TTP/1.1..Host: e| > 00000030 6e 2e 74 61 74 6f 6c 6f 63 61 6c 3a 38 30 38 30 |n.tatolocal:8080| > 00000040 0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e |..Accept-Encodin| > 00000050 67 3a 20 69 64 65 6e 74 69 74 79 0d 0a 43 6f 6e |g: identity..Con| > 00000060 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 33 0d |tent-Length: 13.| > 00000070 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 |.Content-Type: a| > 00000080 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 |pplication/x-www| > 00000090 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 |-form-urlencoded| > 000000a0 0d 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 |....username=tot| > 000000b0 6f |o| > 000000b1 > > > As you can see here this is with the correctly formed request (\r\n > everywhere) > > > Regards, > > Allan SIMON > Tatoeba Administrator (Sysko) > > ________________________________________ > De : Artyom Beilis [art...@ya...] > Envoyé : lundi 11 mars 2013 09:09 > À : cpp...@li... > Objet : Re: [Cppcms-users] 404 not found with valid URL and POST Request > > Note this: > >> 000000a0 0d 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 > |....username=tot| >> 000000b0 6f 0a |o.| > > > The "0a" at the end 1 byte longer than actual Content-Length > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > > > ----- Original Message ----- >> From: SIMON Allan <All...@su...> >> To: Artyom Beilis <art...@ya...>; > "cpp...@li..." > <cpp...@li...> >> Cc: >> Sent: Monday, March 11, 2013 11:03 AM >> Subject: RE:[Cppcms-users] 404 not found with valid URL and POST Request >> >> Hello >> >> Just to be sure we're not misunderstood, the one without \r , that > i >> agree with you should not be working is actually the only one working, the >> correct one (see in second part) is the one not working >> >> //// first one working (with \r missing before content length) >> >> echo -e '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 >> >> it return me this >> >> HTTP/1.0 302 Found >> Server: CppCMS-Embedded/1.0.3 >> Connection: close >> Content-Type: text/html; charset=utf-8 >> Location: / >> Status: 302 Found >> X-Powered-By: CppCMS/1.0.3 >> Set-Cookie:cppcms_session=I01e13278542b89e62db1dfe541b8d790; >> Domain=.tatolocal:8080; Max-Age=604800; Path=/; Version=1 >> >> which what i expect >> >> dump of the echo >> >> 00000000 50 4f 53 54 20 2f 75 73 65 72 73 2f 72 65 67 69 |POST > /users/regi| >> 00000010 73 74 65 72 2d 6e 65 77 5f 74 72 65 61 74 20 48 |ster-new_treat > H| >> 00000020 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 65 |TTP/1.1..Host: > e| >> 00000030 6e 2e 74 61 74 6f 6c 6f 63 61 6c 3a 38 30 38 30 > |n.tatolocal:8080| >> 00000040 0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e > |..Accept-Encodin| >> 00000050 67 3a 20 69 64 65 6e 74 69 74 79 0a 43 6f 6e 74 |g: > identity.Cont| >> 00000060 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 33 0d 0a |ent-Length: > 13..| >> 00000070 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 |Content-Type: > ap| >> 00000080 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 2d > |plication/x-www-| >> 00000090 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 0d > |form-urlencoded.| >> 000000a0 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 6f > |...username=toto| >> >> /////// second one (with \r\n everywhere >> >> but this Don't work , though we agree it should >> >> echo -e '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 >> >> output >> >> >> HTTP/1.0 404 Not Found >> Server: CppCMS-Embedded/1.0.3 >> Connection: close >> Content-Type: text/html; charset=utf-8 >> Status: 404 Not Found >> X-Powered-By: CppCMS/1.0.3 >> Set-Cookie:cppcms_session=I812cba2aefe6403e7998ff93f3e73189; >> Domain=.tatolocal:8080; Max-Age=604800; Path=/; Version=1 >> >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >> "http://www.w3.org/TR/html4/loose.dtd"> >> <html> >> <head> >> <title>404 — Not Found</title> >> </head> >> <body> >> <h1>404 — Not Found</h1> >> </body> >> </html> >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >> "http://www.w3.org/TR/html4/loose.dtd"> >> <html> >> <head> >> <title>404 — Not Found</title> >> </head> >> <body> >> <h1>404 — Not Found</h1> >> </body> >> </html> >> >> 00000000 50 4f 53 54 20 2f 75 73 65 72 73 2f 72 65 67 69 |POST > /users/regi| >> 00000010 73 74 65 72 2d 6e 65 77 5f 74 72 65 61 74 20 48 |ster-new_treat > H| >> 00000020 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 65 |TTP/1.1..Host: > e| >> 00000030 6e 2e 74 61 74 6f 6c 6f 63 61 6c 3a 38 30 38 30 > |n.tatolocal:8080| >> 00000040 0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e > |..Accept-Encodin| >> 00000050 67 3a 20 69 64 65 6e 74 69 74 79 0d 0a 43 6f 6e |g: > identity..Con| >> 00000060 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 33 0d |tent-Length: > 13.| >> 00000070 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 |.Content-Type: > a| >> 00000080 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 > |pplication/x-www| >> 00000090 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 > |-form-urlencoded| >> 000000a0 0d 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 > |....username=tot| >> 000000b0 6f 0a |o.| >> >> >> >> Regards, >> >> Allan SIMON >> Tatoeba Administrator (Sysko) >> >> ________________________________________ >> De : Artyom Beilis [art...@ya...] >> Envoyé : lundi 11 mars 2013 08:45 >> À : cpp...@li... >> Objet : Re: [Cppcms-users] 404 not found with valid URL and POST Request >> >> Can you give a hexdump of your echo command, because with -e there is still > a >> redundend new line (after content length) so the content that is sent is >> actually bigger than it should be. >> >> It seems that because you do not put '\r' than the > Content-Length is >> ignored and not treated. >> >> Also can give the response of the web server. >> >> Artyom Beilis >> -------------- >> CppCMS - C++ Web Framework: http://cppcms.com/ >> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> >> >> >> ----- Original Message ----- >>> From: SIMON Allan <All...@su...> >>> To: Artyom Beilis <art...@ya...>; >> "cpp...@li..." >> <cpp...@li...> >>> Cc: >>> Sent: Monday, March 11, 2013 8:11 AM >>> Subject: Re: [Cppcms-users] 404 not found with valid URL and POST > Request >>> >>> 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 >>> >>> >>> >>> >> > ------------------------------------------------------------------------------ >>> 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 > > > > ------------------------------------------------------------------------------ > 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 |
|
From: SIMON A. <All...@su...> - 2013-03-11 15:47:05
|
Hello
My bad, after digging in the problems, it seems it was a "bug: on my side, the request are actually both correctly dispatched but were falling on this code
(pseud code)
void request_new_treat() {
if post empty => redirect to main page of the application
else if forms no valid => redirect to previous page
else save and redirect to result page
}
the not correct one ( \n only) was not considered as a POST ( request().post().empty() return true) and was getting redirected to the main page
but the second one was it seems not valid (i.e the data inside, after doing some SQL request etc.) and was getting redirected to the previous page and I've forggoten i had set up that if there's no referer in the header, we generate a 404
Well all of this to say it's a stupid mistake from me and i need to correct this behaviour in my code.
Regards,
Allan SIMON
Tatoeba Administrator (Sysko)
________________________________________
De : SIMON Allan [All...@su...]
Envoyé : lundi 11 mars 2013 12:45
À : Artyom Beilis; cpp...@li...
Objet : Re: [Cppcms-users] 404 not found with valid URL and POST Request
Hello Artyom
Sure, it's true it will be easier to test like that, I'm trying to provide that to you ASAP. By the way thanks for the time you've spent today answering me :)
Regards,
Allan SIMON
Tatoeba Administrator (Sysko)
________________________________________
De : Artyom Beilis [art...@ya...]
Envoyé : lundi 11 mars 2013 10:11
À : cpp...@li...
Objet : Re: [Cppcms-users] 404 not found with valid URL and POST Request
Can you please send me a sample code that reproduces it
Artyom Beilis
--------------
CppCMS - C++ Web Framework: http://cppcms.com/
CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
----- Original Message -----
> From: SIMON Allan <All...@su...>
> To: Artyom Beilis <art...@ya...>; "cpp...@li..." <cpp...@li...>
> Cc:
> Sent: Monday, March 11, 2013 11:21 AM
> Subject: Re: [Cppcms-users] 404 not found with valid URL and POST Request
>
> Hello
> same request with -n to remove this final new line
>
> echo -ne '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
>
> still 404
>
> HTTP/1.0 404 Not Found
> Server: CppCMS-Embedded/1.0.3
> Connection: close
> Content-Type: text/html; charset=utf-8
> Status: 404 Not Found
> X-Powered-By: CppCMS/1.0.3
> Set-Cookie:cppcms_session=I6c65243c1fa8ff04b2f811a299f8939d;
> Domain=.tatolocal:8080; Max-Age=604800; Path=/; Version=1
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <title>404 — Not Found</title>
> </head>
> <body>
> <h1>404 — Not Found</h1>
> </body>
> </html>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <title>404 — Not Found</title>
> </head>
> <body>
> <h1>404 — Not Found</h1>
> </body>
> </html>
>
> 00000000 50 4f 53 54 20 2f 75 73 65 72 73 2f 72 65 67 69 |POST /users/regi|
> 00000010 73 74 65 72 2d 6e 65 77 5f 74 72 65 61 74 20 48 |ster-new_treat H|
> 00000020 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 65 |TTP/1.1..Host: e|
> 00000030 6e 2e 74 61 74 6f 6c 6f 63 61 6c 3a 38 30 38 30 |n.tatolocal:8080|
> 00000040 0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e |..Accept-Encodin|
> 00000050 67 3a 20 69 64 65 6e 74 69 74 79 0d 0a 43 6f 6e |g: identity..Con|
> 00000060 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 33 0d |tent-Length: 13.|
> 00000070 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 |.Content-Type: a|
> 00000080 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 |pplication/x-www|
> 00000090 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 |-form-urlencoded|
> 000000a0 0d 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 |....username=tot|
> 000000b0 6f |o|
> 000000b1
>
>
> As you can see here this is with the correctly formed request (\r\n
> everywhere)
>
>
> Regards,
>
> Allan SIMON
> Tatoeba Administrator (Sysko)
>
> ________________________________________
> De : Artyom Beilis [art...@ya...]
> Envoyé : lundi 11 mars 2013 09:09
> À : cpp...@li...
> Objet : Re: [Cppcms-users] 404 not found with valid URL and POST Request
>
> Note this:
>
>> 000000a0 0d 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74
> |....username=tot|
>> 000000b0 6f 0a |o.|
>
>
> The "0a" at the end 1 byte longer than actual Content-Length
>
> Artyom Beilis
> --------------
> CppCMS - C++ Web Framework: http://cppcms.com/
> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
>
>
>
> ----- Original Message -----
>> From: SIMON Allan <All...@su...>
>> To: Artyom Beilis <art...@ya...>;
> "cpp...@li..."
> <cpp...@li...>
>> Cc:
>> Sent: Monday, March 11, 2013 11:03 AM
>> Subject: RE:[Cppcms-users] 404 not found with valid URL and POST Request
>>
>> Hello
>>
>> Just to be sure we're not misunderstood, the one without \r , that
> i
>> agree with you should not be working is actually the only one working, the
>> correct one (see in second part) is the one not working
>>
>> //// first one working (with \r missing before content length)
>>
>> echo -e '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
>>
>> it return me this
>>
>> HTTP/1.0 302 Found
>> Server: CppCMS-Embedded/1.0.3
>> Connection: close
>> Content-Type: text/html; charset=utf-8
>> Location: /
>> Status: 302 Found
>> X-Powered-By: CppCMS/1.0.3
>> Set-Cookie:cppcms_session=I01e13278542b89e62db1dfe541b8d790;
>> Domain=.tatolocal:8080; Max-Age=604800; Path=/; Version=1
>>
>> which what i expect
>>
>> dump of the echo
>>
>> 00000000 50 4f 53 54 20 2f 75 73 65 72 73 2f 72 65 67 69 |POST
> /users/regi|
>> 00000010 73 74 65 72 2d 6e 65 77 5f 74 72 65 61 74 20 48 |ster-new_treat
> H|
>> 00000020 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 65 |TTP/1.1..Host:
> e|
>> 00000030 6e 2e 74 61 74 6f 6c 6f 63 61 6c 3a 38 30 38 30
> |n.tatolocal:8080|
>> 00000040 0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e
> |..Accept-Encodin|
>> 00000050 67 3a 20 69 64 65 6e 74 69 74 79 0a 43 6f 6e 74 |g:
> identity.Cont|
>> 00000060 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 33 0d 0a |ent-Length:
> 13..|
>> 00000070 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 |Content-Type:
> ap|
>> 00000080 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 2d
> |plication/x-www-|
>> 00000090 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 0d
> |form-urlencoded.|
>> 000000a0 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74 6f
> |...username=toto|
>>
>> /////// second one (with \r\n everywhere
>>
>> but this Don't work , though we agree it should
>>
>> echo -e '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
>>
>> output
>>
>>
>> HTTP/1.0 404 Not Found
>> Server: CppCMS-Embedded/1.0.3
>> Connection: close
>> Content-Type: text/html; charset=utf-8
>> Status: 404 Not Found
>> X-Powered-By: CppCMS/1.0.3
>> Set-Cookie:cppcms_session=I812cba2aefe6403e7998ff93f3e73189;
>> Domain=.tatolocal:8080; Max-Age=604800; Path=/; Version=1
>>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>> "http://www.w3.org/TR/html4/loose.dtd">
>> <html>
>> <head>
>> <title>404 — Not Found</title>
>> </head>
>> <body>
>> <h1>404 — Not Found</h1>
>> </body>
>> </html>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>> "http://www.w3.org/TR/html4/loose.dtd">
>> <html>
>> <head>
>> <title>404 — Not Found</title>
>> </head>
>> <body>
>> <h1>404 — Not Found</h1>
>> </body>
>> </html>
>>
>> 00000000 50 4f 53 54 20 2f 75 73 65 72 73 2f 72 65 67 69 |POST
> /users/regi|
>> 00000010 73 74 65 72 2d 6e 65 77 5f 74 72 65 61 74 20 48 |ster-new_treat
> H|
>> 00000020 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 65 |TTP/1.1..Host:
> e|
>> 00000030 6e 2e 74 61 74 6f 6c 6f 63 61 6c 3a 38 30 38 30
> |n.tatolocal:8080|
>> 00000040 0d 0a 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e
> |..Accept-Encodin|
>> 00000050 67 3a 20 69 64 65 6e 74 69 74 79 0d 0a 43 6f 6e |g:
> identity..Con|
>> 00000060 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 31 33 0d |tent-Length:
> 13.|
>> 00000070 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 |.Content-Type:
> a|
>> 00000080 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77
> |pplication/x-www|
>> 00000090 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64
> |-form-urlencoded|
>> 000000a0 0d 0a 0d 0a 75 73 65 72 6e 61 6d 65 3d 74 6f 74
> |....username=tot|
>> 000000b0 6f 0a |o.|
>>
>>
>>
>> Regards,
>>
>> Allan SIMON
>> Tatoeba Administrator (Sysko)
>>
>> ________________________________________
>> De : Artyom Beilis [art...@ya...]
>> Envoyé : lundi 11 mars 2013 08:45
>> À : cpp...@li...
>> Objet : Re: [Cppcms-users] 404 not found with valid URL and POST Request
>>
>> Can you give a hexdump of your echo command, because with -e there is still
> a
>> redundend new line (after content length) so the content that is sent is
>> actually bigger than it should be.
>>
>> It seems that because you do not put '\r' than the
> Content-Length is
>> ignored and not treated.
>>
>> Also can give the response of the web server.
>>
>> Artyom Beilis
>> --------------
>> CppCMS - C++ Web Framework: http://cppcms.com/
>> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
>>
>>
>>
>> ----- Original Message -----
>>> From: SIMON Allan <All...@su...>
>>> To: Artyom Beilis <art...@ya...>;
>> "cpp...@li..."
>> <cpp...@li...>
>>> Cc:
>>> Sent: Monday, March 11, 2013 8:11 AM
>>> Subject: Re: [Cppcms-users] 404 not found with valid URL and POST
> Request
>>>
>>> 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
>>>
>>>
>>>
>>>
>>
> ------------------------------------------------------------------------------
>>> 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
>
>
>
> ------------------------------------------------------------------------------
> 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
|