cppcms-users Mailing List for CppCMS C++ Web Framework (Page 61)
Brought to you by:
artyom-beilis
You can subscribe to this list here.
| 2009 |
Jan
|
Feb
(22) |
Mar
|
Apr
(3) |
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(15) |
Nov
(16) |
Dec
(13) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(4) |
Feb
|
Mar
(8) |
Apr
(8) |
May
(8) |
Jun
(36) |
Jul
(63) |
Aug
(126) |
Sep
(47) |
Oct
(66) |
Nov
(46) |
Dec
(42) |
| 2011 |
Jan
(87) |
Feb
(24) |
Mar
(54) |
Apr
(21) |
May
(22) |
Jun
(18) |
Jul
(22) |
Aug
(101) |
Sep
(57) |
Oct
(33) |
Nov
(34) |
Dec
(66) |
| 2012 |
Jan
(64) |
Feb
(76) |
Mar
(73) |
Apr
(105) |
May
(93) |
Jun
(83) |
Jul
(84) |
Aug
(88) |
Sep
(57) |
Oct
(59) |
Nov
(35) |
Dec
(49) |
| 2013 |
Jan
(67) |
Feb
(17) |
Mar
(49) |
Apr
(64) |
May
(87) |
Jun
(64) |
Jul
(93) |
Aug
(23) |
Sep
(15) |
Oct
(16) |
Nov
(62) |
Dec
(73) |
| 2014 |
Jan
(5) |
Feb
(23) |
Mar
(21) |
Apr
(11) |
May
(1) |
Jun
(19) |
Jul
(27) |
Aug
(16) |
Sep
(5) |
Oct
(37) |
Nov
(12) |
Dec
(9) |
| 2015 |
Jan
(7) |
Feb
(7) |
Mar
(44) |
Apr
(28) |
May
(5) |
Jun
(12) |
Jul
(8) |
Aug
|
Sep
(39) |
Oct
(34) |
Nov
(30) |
Dec
(34) |
| 2016 |
Jan
(66) |
Feb
(23) |
Mar
(33) |
Apr
(15) |
May
(11) |
Jun
(15) |
Jul
(26) |
Aug
(4) |
Sep
(1) |
Oct
(30) |
Nov
(10) |
Dec
|
| 2017 |
Jan
(52) |
Feb
(9) |
Mar
(24) |
Apr
(16) |
May
(9) |
Jun
(12) |
Jul
(33) |
Aug
(8) |
Sep
|
Oct
(1) |
Nov
(2) |
Dec
(6) |
| 2018 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
(14) |
Jun
(1) |
Jul
(9) |
Aug
(1) |
Sep
(13) |
Oct
(8) |
Nov
(2) |
Dec
(2) |
| 2019 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(9) |
Jul
(6) |
Aug
(25) |
Sep
(10) |
Oct
(10) |
Nov
(6) |
Dec
|
| 2021 |
Jan
|
Feb
|
Mar
(7) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(9) |
Oct
(1) |
Nov
|
Dec
|
| 2022 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
|
From: Artyom B. <art...@ya...> - 2013-03-13 09:42:15
|
----- Original Message ----- > From: Christian Gmeiner <chr...@gm...> > To: cpp...@li... > Cc: > Sent: Wednesday, March 13, 2013 10:39 AM > Subject: [Cppcms-users] Consumer producer problem > > Hi all. > > I am using a QProcess to run an external bash script. There I am > reading back stdout and stderr and > send these information back to the client via SSE. > Now I run into the problem that QProcess produces messages a lot > faster then they got send via SSE. > The result is that the used ring-buffer has overwritten elements and > not all "messages" got send. > At the moment I am using the sse::bounded_event_queue. > > Is there anything I need to take of when using condition_variable? > What is the best approach to get > this handled in a clean way? > > thanks > -- > Christian Gmeiner, MSc > First of all how they are generated, synchronously, asynchronously? how many client do you have? In general it is not a producer consumer problem but rather message broker problem. if you have 1 client and 1 source you don't really need an asynchronous SSE... you can do it easily synchronously as in any case process itself is synchronous. However if you have many clients and one source it is a different problem. What happens if somebody requests the date after the process started do you send it from the begging or from the last event? What happens on reconnect you need to start from the last point but how long do you want to keep the data? In general you can keep all events - all the output and send it from the beginning, in such case you can either make the ring buffer with a big ring or just alter the class http://sourceforge.net/p/cppcms/code/2238/tree/framework/trunk/contrib/server_side/sse/server_sent_events.h With the policy you need. You can derive the event_source class and provide the policy of keeping and throwing messages the way you need. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ |
|
From: Artyom B. <art...@ya...> - 2013-03-13 09:26:14
|
>________________________________
> From: Christian Gmeiner <chr...@gm...>
>
>Hi all.
>
>at the moment I am looking how to have one SSE stream per session. In
>general I would put the SSE stream object into the session storage but
>I am not sure how I could access it from other cppcms-apps.
>
I don't really understand what exactly you are doing as you can't
store "sse" object in session storage as is - you can probably
create its unique identification and store it in session object.
>Here is brief overview:
>
>I have an SSE application mounted at /sse/
>
> booster::intrusive_ptr<SSE> sse = new SSE(srv);
> Configuration::instance()->sse = sse.get();
> srv.applications_pool().mount(sse, cppcms::mount_point("/sse(.*)", 1));
>
>It is possible for all other cppcms apps running to send data via SSE
>to the browser.
>
> Configuration::instance()->sse->enqueue("event", "data");
>
>
>class SSE : public cppcms::application {
>public:
> SSE(cppcms::service &srv);
>
> void post();
> void get();
> void redirect();
>
> void enqueue(std::string const &event, std::string const &data);
>
>private:
> booster::shared_ptr<sse::bounded_event_queue> stream_;
>};
>
Yes, however you should remember that SEE object is asynchronous one
and runs in the event loop stream.
That means that you can't just call sse->enqueue("event","data")
from synchronous applications from the other thread
but rather you need to "post" it to event loop's thread:
Using C++11 lambdass:
std::string message = ...;
service().post([=]() {
see->equeue("event",message);
});
>
>
>At the moment all clients are using the same SSE stream and this is a
>no-go security wise.
>So I want to extend my current approach to have multiple SSE streams -
>for each session one.
>As this "website" is used for embedded device configuration I think I
>will not run into any
>resource problems.
>
>Or is there a better way to deliver each session their own data-packages only?
Use multiple sse stream object and for each one of them create unique id that
would be stored in session and thus if user request sse with some id
give it to him, this way you can even give multiple users same sse stream.
>
>thanks
>--
>Christian Gmeiner, MSc
>
Regards,
Artyom Beilis
--------------
CppCMS - C++ Web Framework: http://cppcms.com/
CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
|
|
From: Christian G. <chr...@gm...> - 2013-03-13 08:39:26
|
Hi all. I am using a QProcess to run an external bash script. There I am reading back stdout and stderr and send these information back to the client via SSE. Now I run into the problem that QProcess produces messages a lot faster then they got send via SSE. The result is that the used ring-buffer has overwritten elements and not all "messages" got send. At the moment I am using the sse::bounded_event_queue. Is there anything I need to take of when using condition_variable? What is the best approach to get this handled in a clean way? thanks -- Christian Gmeiner, MSc |
|
From: Christian G. <chr...@gm...> - 2013-03-13 08:33:54
|
Hi all.
at the moment I am looking how to have one SSE stream per session. In
general I would put the SSE stream object into the session storage but
I am not sure how I could access it from other cppcms-apps.
Here is brief overview:
I have an SSE application mounted at /sse/
booster::intrusive_ptr<SSE> sse = new SSE(srv);
Configuration::instance()->sse = sse.get();
srv.applications_pool().mount(sse, cppcms::mount_point("/sse(.*)", 1));
It is possible for all other cppcms apps running to send data via SSE
to the browser.
Configuration::instance()->sse->enqueue("event", "data");
class SSE : public cppcms::application {
public:
SSE(cppcms::service &srv);
void post();
void get();
void redirect();
void enqueue(std::string const &event, std::string const &data);
private:
booster::shared_ptr<sse::bounded_event_queue> stream_;
};
At the moment all clients are using the same SSE stream and this is a
no-go security wise.
So I want to extend my current approach to have multiple SSE streams -
for each session one.
As this "website" is used for embedded device configuration I think I
will not run into any
resource problems.
Or is there a better way to deliver each session their own data-packages only?
thanks
--
Christian Gmeiner, MSc
|
|
From: Artyom B. <art...@ya...> - 2013-03-12 12:29:40
|
I think you miss DLL_EXPORT... Make sure the view is: 1. Linked with both cppcms and booster libraries 2. Build with DLL_EXPORT define See: http://cppcms.com/wikipp/en/page/notes_for_windows_users#Compilation Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: pitt <hi...@fo...> >To: cppcms-users <cpp...@li...> >Sent: Tuesday, March 12, 2013 1:35 PM >Subject: [Cppcms-users] locale translate link error > > >Dear All, > >cppcms: 1.0.3 >os: windows 7 x86_64 >compiler: VS2012 > >I used the "translate function" in cppcms::application link successfully, but used "cppcms::locale::translate()" in view link error. > >Template: >.. ><td height="30" align="right" style="padding-left:10px;"><% gt "Account:" %></td> >.. > >By cppcms_tmpl_cc: > " <td height=\"30\" align=\"right\" style=\"padding-left:10px;\">"; > out() << cppcms::locale::translate("Account:"); > out()<<"</td>\n" > >error LNK2001: unresolved external symbol "public: static class std::locale::id booster::locale::base_message_format<char>::id" (?id@?$base_message_format@D@locale@booster@@2V02std@@A) >3>G:\VSWork\vigor\Debug\vmanage.dll : fatal error LNK1120: 1 Unresolved external symbol > >Link parameter: >/OUT:"G:\VSWork\vigor\Debug\vmanage.dll" /MANIFEST /NXCOMPAT /PDB:"G:\VSWork\vigor\Debug\vmanage.pdb" /DYNAMICBASE "G:\CLibrary\lib\booster-d.lib" "G:\CLibrary\lib\cppcms-d.lib" "G:\VSWork\vigor\Debug\module.lib" "G:\VSWork\vigor\Debug\vbase.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /IMPLIB:"G:\VSWork\vigor\Debug\vmanage.lib" /DEBUG /DLL /MACHINE:X86 /INCREMENTAL /PGD:"G:\VSWork\vigor\Debug\vmanage.pgd" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Debug\vmanage.dll.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /TLBID:1 > > >Pitt >------------------------------------------------------------------------------ >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: p. <hi...@fo...> - 2013-03-12 12:06:20
|
Dear All,
cppcms: 1.0.3
os: windows 7 x86_64
compiler: VS2012
I used the "translate function" in cppcms::application link successfully, but used "cppcms::locale::translate()" in view link error.
Template:
..
<td height="30" align="right" style="padding-left:10px;"><% gt "Account:" %></td>
..
By cppcms_tmpl_cc:
" <td height=\"30\" align=\"right\" style=\"padding-left:10px;\">";
out() << cppcms::locale::translate("Account:");
out()<<"</td>\n"
error LNK2001: unresolved external symbol "public: static class std::locale::id booster::locale::base_message_format<char>::id" (?id@?$base_message_format@D@locale@booster@@2V02std@@A)
3>G:\VSWork\vigor\Debug\vmanage.dll : fatal error LNK1120: 1 Unresolved external symbol
Link parameter:
/OUT:"G:\VSWork\vigor\Debug\vmanage.dll" /MANIFEST /NXCOMPAT /PDB:"G:\VSWork\vigor\Debug\vmanage.pdb" /DYNAMICBASE "G:\CLibrary\lib\booster-d.lib" "G:\CLibrary\lib\cppcms-d.lib" "G:\VSWork\vigor\Debug\module.lib" "G:\VSWork\vigor\Debug\vbase.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /IMPLIB:"G:\VSWork\vigor\Debug\vmanage.lib" /DEBUG /DLL /MACHINE:X86 /INCREMENTAL /PGD:"G:\VSWork\vigor\Debug\vmanage.pgd" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Debug\vmanage.dll.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /TLBID:1
Pitt |
|
From: Sander Xi <pit...@gm...> - 2013-03-12 11:42:22
|
Dear All,
cppcms: 1.0.3
os: windows 7 x86_64
compiler: VS2012
I used the "translate function" in cppcms::application link successfully,
but used "cppcms::locale::translate()" in view link error.
*Template:*
..
<td height="30" align="right" style="padding-left:10px;"><% gt "Account:"
%></td>
..
*By cppcms_tmpl_cc:*
" <td height=\"30\" align=\"right\" style=\"padding-left:10px;\">";
out() << cppcms::locale::translate("Account:");
out()<<"</td>\n"
error LNK2001: unresolved external symbol "public: static class
std::locale::id booster::locale::base_message_format<char>::id" (
?id@?$base_message_format@D@locale@booster@@2V02std@@A)
3>G:\VSWork\vigor\Debug\vmanage.dll : fatal error LNK1120: 1 Unresolved
external symbol
*Link parameter:*
/OUT:"G:\VSWork\vigor\Debug\vmanage.dll" /MANIFEST /NXCOMPAT
/PDB:"G:\VSWork\vigor\Debug\vmanage.pdb" /DYNAMICBASE
"G:\CLibrary\lib\booster-d.lib" "G:\CLibrary\lib\cppcms-d.lib"
"G:\VSWork\vigor\Debug\module.lib" "G:\VSWork\vigor\Debug\vbase.lib"
"kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib"
"advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib"
"odbc32.lib" "odbccp32.lib" /IMPLIB:"G:\VSWork\vigor\Debug\vmanage.lib"
/DEBUG /DLL /MACHINE:X86 /INCREMENTAL
/PGD:"G:\VSWork\vigor\Debug\vmanage.pgd" /MANIFESTUAC:"level='asInvoker'
uiAccess='false'" /ManifestFile:"Debug\vmanage.dll.intermediate.manifest"
/ERRORREPORT:PROMPT /NOLOGO /TLBID:1
*Pitt*
|
|
From: Markus R. <us...@ma...> - 2013-03-11 20:17:13
|
Hello!
Btw, this code (also seen in many other examples floating around):
> booster::intrusive_ptr<async> c (new async(app));
> app.applications_pool().mount(c, cppcms::mount_point("/async(/(.*))?",
> 1));
typically crashes here at shutdown because intrusive_ptr holds the async
object longer then the app itself which may lead to shutdown crashes like:
#0 0x00007f5028e9e624 in cppcms::application::root() () from
/usr/lib/libcppcms.so.1
#1 0x00007f5028e9ea93 in
booster::intrusive_ptr_release(cppcms::application*) () from
/usr/lib/libcppcms.so.1
#2 0x0000000000404a1d in booster::intrusive_ptr<async>::~intrusive_ptr() ()
#3 0x000000000040263b in main ()
or
#0 0xb7a71587 in cppcms::applications_pool::put(cppcms::application*) ()
from /usr/lib/libcppcms.so.1
#1 0xb7a73c4e in booster::intrusive_ptr_release(cppcms::application*) ()
from /usr/lib/libcppcms.so.1
#2 0x08494f40 in
booster::intrusive_ptr<LVDC_service::Scan_data_service>::~intrusive_ptr
(this=0xb4f2c21c, __in_chrg=<optimized out>) at
/home/markus/LVDC/dev/lvdc/lvdc_pp/../../libs/booster/include/booster/intrusive_ptr.h:68
also wrong would be to put above two lines in a scope, or having
booster::intrusive_ptr<async> c (new async(app));
because then the application would not be mounted correctly and it would
lead to a 404 Not found.
Intrusive ptr is hardly documented (neither in booster nor in boost),
so here would be a (imho) correct version:
145 cppcms::service app(argc,argv);
146 {
147
app.applications_pool().mount(cppcms::applications_factory<myapp>(),
cppcms::mount_point("/myapp(/(.*))?", 1));
148
app.applications_pool().mount(cppcms::applications_factory<numbers>(),
cppcms::mount_point("/numbers(/(.*))?", 1));
149
app.applications_pool().mount(cppcms::applications_factory<letters>(),
cppcms::mount_point("/letters(/(.*))?", 1));
150
151 booster::intrusive_ptr<async> c (new async(app));
152 app.applications_pool().mount(c,
cppcms::mount_point("/async(/(.*))?", 1));
153
app.applications_pool().mount(cppcms::applications_factory<sync>(),
cppcms::mount_point("/sync(/(.*))?", 1));
154 app.run();
155 }
That would terminate the async object after app.run() but before service is
deallocated. Please correct me if I am wrong.
best regards
Markus Raab
P.s. sorry for missing debug symbols, I could not find a libcppcms-dbg
debian package?
And what is http://apt.cppcms.com/dists/squeezy? Do you mean wheezy?
|
|
From: Markus R. <us...@ma...> - 2013-03-11 18:31:38
|
Hello! Artyom Beilis wrote: >> See attached file for full example, there are small issues with double >> mounting in the example: the URL mapper does not always work correctly. > Can you explain what is the problem? The problem is within the example mount.cpp (urls with scriptname /hello, config is attached) When you go to: http://localhost:8080/hello/myapp/numbers or http://localhost:8080/myapp/numbers the URL for odd is correct (works): http://localhost:8080/myapp/numbers/odd But when you go to: http://localhost:8080/hello/numbers or http://localhost:8080/numbers the generated URL for odd numbers is http://localhost:8080/odd which does not work (404 - Not found). best regards Markus Raab |
|
From: <un...@fu...> - 2013-03-11 18:13:08
|
hi,
(if I understand your question correctly)
you can iterate through form and do something like this
virtual bool validate_2m( data::flash_messages &m ) {
if( !cppcms::form::validate() ) {
for( cppcms::form::iterator it = begin(); it != end(); ++it )
if( ! it->valid() )
m.add_e( it->error_message() );
return false;
}
return true;
}
On Mon, 11 Mar 2013 16:45:11 +0000, SIMON Allan wrote:
> Hello
>
> It would be nice to be able to have some way to know during the
> validation of a form, the reason why it fails (while still using the
> function 'validate') i.e being able to stack the error message or
> error code and being able to get them after.
>
> Regards,
>
> Allan SIMON
> Tatoeba Administrator (Sysko)
|
|
From: SIMON A. <All...@su...> - 2013-03-11 16:45:26
|
Hello It would be nice to be able to have some way to know during the validation of a form, the reason why it fails (while still using the function 'validate') i.e being able to stack the error message or error code and being able to get them after. Regards, Allan SIMON Tatoeba Administrator (Sysko) |
|
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
|
|
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: 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 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: 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: 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: Artyom B. <art...@ya...> - 2013-03-11 08:41:36
|
> > See attached file for full example, there are small issues with double > mounting in the example: the URL mapper does not always work correctly. > Can you explain what is the problem? Artyom |
|
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 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 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-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-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: Markus R. <us...@ma...> - 2013-03-09 16:50:14
|
Hi users! Here are some questions (with answers) which could be of interest: 1.) Is it possible to use gzip compression on async connections? Artyom Beilis wrote: > No you can't, for two reasons: > > 1. You can't really do streaming with gzip compression > as the stream becomes buffered. > 2. The compression process costs a lot so it not wise > to use it in the single event-loop's thread. 2.) What is the difference between booster::intrusive_ptr<App> c=new App(service); service.applications_pool().mount(c); and: service.applications_pool().mount(cppcms::applications_factory<App>()); Artyom Beilis wrote: > in the first case you have a single application > instance that only being executed in a single thread > of the event loop, in the second case multiple applications > are created on demand and run in the thread pool. See: http://cppcms.com/cppcms_ref/1.0.2/classcppcms_1_1applications__pool.html 3.) Are there some examples how to mount multiple applications (both sync and async; with dispatcher and using main; mounting the same application twice) using mount_points? Now there is: cppcms::service app(argc,argv); app.applications_pool().mount(cppcms::applications_factory<myapp>(), cppcms::mount_point("/myapp(/(.*))?", 1)); app.applications_pool().mount(cppcms::applications_factory<numbers>(), cppcms::mount_point("/numbers(/(.*))?", 1)); app.applications_pool().mount(cppcms::applications_factory<letters>(), cppcms::mount_point("/letters(/(.*))?", 1)); booster::intrusive_ptr<async> c (new async(app)); app.applications_pool().mount(c, cppcms::mount_point("/async(/(.*))?", 1)); app.applications_pool().mount(cppcms::applications_factory<sync>(), cppcms::mount_point("/sync(/(.*))?", 1)); app.run(); See attached file for full example, there are small issues with double mounting in the example: the URL mapper does not always work correctly. See also http://cppcms.com/cppcms_ref/1.0.2/classcppcms_1_1mount__point.html Best regards Markus |