Curt Hibbs
2006-Oct-11 03:04 UTC
[Instantrails-users] What could be causing this BAD CLIENT error?
Zed, I''ve copied a thread from the Instant Rais mailing list below. Could you take a quick look and see if you have any idea what might be going on here? Thanks Curt *[Instantrails-users] Mongrel BAD CLIENT errors* 6 messages ------------------------------ * Dave Havard <david.havard at gmail.com> * * Mon, Oct 9, 2006 at 3:46 PM * Reply-To: instantrails-users at rubyforge.org To: instantrails-users at rubyforge.org Hi I have just installed InstantRails and (after some work) have got my existing app working. I am now getting BAD CLIENT errors on some form posts but have no idea why. Having looked at the mongrel docs it seems I should be able to get to the bottom of this if I can get debug set to true but I cannot see where to do this in InstantRails? Any pointers? Thanks Dave _______________________________________________ Instantrails-users mailing list Instantrails-users at rubyforge.org http://rubyforge.org/mailman/listinfo/instantrails-users ------------------------------ * Curt Hibbs <curt.hibbs at gmail.com> * * Mon, Oct 9, 2006 at 10:51 PM * Reply-To: curt at hibbs.com To: instantrails-users at rubyforge.org On 10/9/06, Dave Havard <david.havard at gmail.com> wrote:> > Hi > > I have just installed InstantRails and (after some work) have got my > existing app working. I am now getting BAD CLIENT errors on some form posts > but have no idea why. Having looked at the mongrel docs it seems I should be > able to get to the bottom of this if I can get debug set to true but I > cannot see where to do this in InstantRails? > > Any pointers? >You''ll need to start mongrel by hand. Use Instant Rails to open a ruby console window (menu command "Rails Applications>Open Ruby Console Window"), change your current directory to move in to your Rails application''s root directory, and then type in the "mongrel_rails" command with whatever options you like. Curt ------------------------------ * Dave Havard <david.havard at gmail.com> * * Tue, Oct 10, 2006 at 4:39 AM * To: curt at hibbs.com, instantrails-users at rubyforge.org Thank you Curt. That has got debugging working but has made things no clearer on why some of my form posts are not working. The post does not seem to get logged - only reported as a bad client to the console window. Any ideas what I should be looking for? My view contains the following code: <% @title = "Sign up" %> <%= error_messages_for ''user'' %> <%= form_tag %> <table> <tr> <td>Username:</td> <td><%= text_field("user", "username") %></td> </tr> <tr> <td>Password:</td> <td><%= password_field("user", "password") %></td> </tr> <tr> <td>Confirm Password:</td> <td><%= password_field("user", "confirm_password") %></td> </tr> <tr> <td>Email Address:</td> <td><%= text_field("user", "email") %></td> <tr> <td>First Name:</td> <td><%= text_field("user", "first_name") %></td> </tr> <tr> <td>Last Name:</td> <td><%= text_field("user", "last_name") %></td> </tr> <tr> <td>Screen Name:</td> <td><%= text_field("user", "screen_name") %></td> </tr> <tr> <td></td> <td><input type="submit" value="Sign up"/></td> </tr> </table> <%= end_form_tag %> Whilst my controller looks like: def signup if request.get? @user = User.new else if params[:user][:password] != params[:user][:confirm_password] flash[:notice] = "Passwords do not match!" else @user = User.new(params[:user]) if @user.save session[:user] = @user.id redirect_to :controller => "pages", :action => "show", :id => 1 end end end end The get part of the view is being rendered fine. Only when I post back is it failing. Thanks Dave On 10/10/06, Curt Hibbs <curt.hibbs at gmail.com> wrote:> > On 10/9/06, Dave Havard <david.havard at gmail.com > wrote: > > > > Hi > > > > I have just installed InstantRails and (after some work) have got my > > existing app working. I am now getting BAD CLIENT errors on some form posts > > but have no idea why. Having looked at the mongrel docs it seems I should be > > able to get to the bottom of this if I can get debug set to true but I > > cannot see where to do this in InstantRails? > > > > Any pointers? > > > > You''ll need to start mongrel by hand. Use Instant Rails to open a ruby > console window (menu command "Rails Applications>Open Ruby Console Window"), > change your current directory to move in to your Rails application''s root > directory, and then type in the "mongrel_rails" command with whatever > options you like. > > Curt > > _______________________________________________ > Instantrails-users mailing list > Instantrails-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/instantrails-users > >------------------------------ * David Morton <mortonda at dgrmm.net> * * Tue, Oct 10, 2006 at 9:38 AM * To: instantrails-users at rubyforge.org Cc: curt at hibbs.com -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Dave Havard wrote:> Thank you Curt. > > That has got debugging working but has made things no clearer on why > some of my form posts are not working. The post does not seem to get > logged - only reported as a bad client to the console window. Any ideas > what I should be looking for? My view contains the following code:According to http://mongrel.rubyforge.org/faq.html, a BAD CLIENT error means the web browser sent an invalid HTTP request; it has nothing to do with rails. What browser are you using? - From that FAQ: What does BAD CLIENT mean? It means that a request came in which Mongrel rejects because it doesn?t follow the RFC grammar. Mongrel is pretty relaxed about most requests, but in order to block the majority of security attacks for web servers it is strict about characters used, header formats, status line formats, etc. This is also based on matching the RFC?s grammar specification to a Ragel grammar specification, so it?s easy to compare. If you need to know why the client is triggering this, then simply hit your Mongrel processes with USR1 signals and they?ll log the full request data and parameters that were collected. Then, if you think the request is valid send me this data and I?ll look. If it?s not valid than fix the client. Mongrel takes the stance that all clients are written by software developers and that they should follow the standard. By doing this it reduces the bugs and potential security holes found in many other web servers. It also means that if you absolutely have to allow a bad client, then you?ll need to not use Mongrel. - -- David Morton Maia Mailguard - http://www.maiamailguard.com Morton Software Design and Consulting - http://www.dgrmm.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFK7BVUy30ODPkzl0RAma3AKDRcqL3oQJ5tvk3XyX1YJzuJHkvuQCglr2d 1fx9ureC6X0dzEDqSo1JgaM=397F -----END PGP SIGNATURE----- ------------------------------ * David Morton <mortonda at dgrmm.net> * * Tue, Oct 10, 2006 at 2:01 PM * To: instantrails-users at rubyforge.org Cc: curt at hibbs.com -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Oct 10, 2006, at 9:38 AM, David Morton wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Dave Havard wrote: >> Thank you Curt. >> >> That has got debugging working but has made things no clearer on why >> some of my form posts are not working. The post does not seem to get >> logged - only reported as a bad client to the console window. Any >> ideas >> what I should be looking for? My view contains the following code: > > > According to http://mongrel.rubyforge.org/faq.html, a BAD CLIENT > error means the > web browser sent an invalid HTTP request; it has nothing to do with > rails.actually, now that I think about it, perhaps a request has a bad character in it, or isn''t properly url encoded? David Morton Maia Mailguard http://www.maiamailguard.com mortonda at dgrmm.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin) iD8DBQFFK+4DUy30ODPkzl0RAs07AKC41WT2g+7DCvw9wudA1pFe3UN3YgCgkLVP SmJILQExLXV0SppFk96d2SY=qYsA -----END PGP SIGNATURE----- ------------------------------ * Dave Havard <david.havard at gmail.com> * * Tue, Oct 10, 2006 at 6:16 PM * Reply-To: instantrails-users at rubyforge.org To: instantrails-users at rubyforge.org Thanks David So are they saying that mongrel will fail if the browser is not right? I am testing on IE6.0.29 and FF1.5. Would be surprised if mongrel does not work with these browsers - how could it be used in production? Have you heard about this problem much? Seems like mongrel is become the server of choice for rails, but even the scaffold code is failing - can''t believe it is rails or this issue would be plastered all over the net by now. At the same time a web server which will not work with FF1.5 seem unrealistic. Could it be something else? Maybe apache is changing something before passing the request to mongrel? Given InstantRails is installing elsewhere without fuss i''ll test on some more machines... Thanks for your help. Dave On 10/10/06, David Morton <mortonda at dgrmm.net> wrote:> > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > On Oct 10, 2006, at 9:38 AM, David Morton wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Dave Havard wrote: > >> Thank you Curt. > >> > >> That has got debugging working but has made things no clearer on why > >> some of my form posts are not working. The post does not seem to get > >> logged - only reported as a bad client to the console window. Any > >> ideas > >> what I should be looking for? My view contains the following code: > > > > > > According to http://mongrel.rubyforge.org/faq.html, a BAD CLIENT > > error means the > > web browser sent an invalid HTTP request; it has nothing to do with > > rails. > > actually, now that I think about it, perhaps a request has a bad > character in it, or isn''t properly url encoded? > > > > David Morton > Maia Mailguard http://www.maiamailguard.com > mortonda at dgrmm.net > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/instantrails-users/attachments/20061010/28615300/attachment-0001.html
Dave Havard
2006-Oct-11 10:28 UTC
[Instantrails-users] What could be causing this BAD CLIENT error?
Hi Curt Ok, I have now tested from another windows box running IE (same version) and all works fine. Have also tested from my SUSE10.1 box running FF (same version) and both work fine. Strangley IE is now working on my development box (XP) today - not sure if changed something or just got confused in the battle yesterday!? Anyway now it is just FF not working. I have tried uninstalling each extension but none had an effect, also tried reinstalling FF but still no change. Any suggestions on what to try next? Thanks Dave On 11/10/06, Curt Hibbs <curt.hibbs at gmail.com> wrote:> > Zed, I''ve copied a thread from the Instant Rais mailing list below. Could > you take a quick look and see if you have any idea what might be going on > here? > > Thanks > Curt > > *[Instantrails-users] Mongrel BAD CLIENT errors * > 6 messages > ------------------------------ > * Dave Havard <david.havard at gmail.com> * * Mon, Oct 9, 2006 at 3:46 PM > * Reply-To: instantrails-users at rubyforge.org > To: instantrails-users at rubyforge.org > Hi > > I have just installed InstantRails and (after some work) have got my > existing app working. I am now getting BAD CLIENT errors on some form posts > but have no idea why. Having looked at the mongrel docs it seems I should be > able to get to the bottom of this if I can get debug set to true but I > cannot see where to do this in InstantRails? > > Any pointers? > > Thanks > Dave > > _______________________________________________ > Instantrails-users mailing list > Instantrails-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/instantrails-users > > ------------------------------ > * Curt Hibbs <curt.hibbs at gmail.com> * * Mon, Oct 9, 2006 at 10:51 PM * Reply-To: > curt at hibbs.com > To: instantrails-users at rubyforge.org > On 10/9/06, Dave Havard <david.havard at gmail.com > wrote: > > > > Hi > > > > I have just installed InstantRails and (after some work) have got my > > existing app working. I am now getting BAD CLIENT errors on some form posts > > but have no idea why. Having looked at the mongrel docs it seems I should be > > able to get to the bottom of this if I can get debug set to true but I > > cannot see where to do this in InstantRails? > > > > Any pointers? > > > > You''ll need to start mongrel by hand. Use Instant Rails to open a ruby > console window (menu command "Rails Applications>Open Ruby Console Window"), > change your current directory to move in to your Rails application''s root > directory, and then type in the "mongrel_rails" command with whatever > options you like. > > Curt > ------------------------------ > * Dave Havard <david.havard at gmail.com> * * Tue, Oct 10, 2006 at 4:39 AM > * To: curt at hibbs.com, instantrails-users at rubyforge.org > Thank you Curt. > > That has got debugging working but has made things no clearer on why some > of my form posts are not working. The post does not seem to get logged - > only reported as a bad client to the console window. Any ideas what I should > be looking for? My view contains the following code: > > <% @title = "Sign up" %> > <%= error_messages_for ''user'' %> > <%= form_tag %> > <table> > <tr> > <td>Username:</td> > <td><%= text_field("user", "username") %></td> > </tr> > <tr> > <td>Password:</td> > <td><%= password_field("user", "password") %></td> > </tr> > <tr> > <td>Confirm Password:</td> > <td><%= password_field("user", "confirm_password") %></td> > </tr> > <tr> > <td>Email Address:</td> > <td><%= text_field("user", "email") %></td> > <tr> > <td>First Name:</td> > <td><%= text_field("user", "first_name") %></td> > </tr> > <tr> > <td>Last Name:</td> > <td><%= text_field("user", "last_name") %></td> > </tr> > <tr> > <td>Screen Name:</td> > <td><%= text_field("user", "screen_name") %></td> > </tr> > <tr> > <td></td> > <td><input type="submit" value="Sign up"/></td> > </tr> > </table> > <%= end_form_tag %> > > Whilst my controller looks like: > > def signup > if request.get? > @user = User.new > else > if params[:user][:password] != params[:user][:confirm_password] > flash[:notice] = "Passwords do not match!" > else > @user = User.new(params[:user]) > if @user.save > session[:user] = @user.id > redirect_to :controller => "pages", :action => "show", :id => 1 > end > end > end > end > > The get part of the view is being rendered fine. Only when I post back is > it failing. > > Thanks > Dave > > On 10/10/06, Curt Hibbs <curt.hibbs at gmail.com> wrote: > > > > On 10/9/06, Dave Havard < david.havard at gmail.com > wrote: > > > > > > Hi > > > > > > I have just installed InstantRails and (after some work) have got my > > > existing app working. I am now getting BAD CLIENT errors on some form posts > > > but have no idea why. Having looked at the mongrel docs it seems I should be > > > able to get to the bottom of this if I can get debug set to true but I > > > cannot see where to do this in InstantRails? > > > > > > Any pointers? > > > > > > > You''ll need to start mongrel by hand. Use Instant Rails to open a ruby > > console window (menu command "Rails Applications>Open Ruby Console Window"), > > change your current directory to move in to your Rails application''s root > > directory, and then type in the "mongrel_rails" command with whatever > > options you like. > > > > Curt > > > > _______________________________________________ > > Instantrails-users mailing list > > Instantrails-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/instantrails-users > > > > > ------------------------------ > * David Morton <mortonda at dgrmm.net> * * Tue, Oct 10, 2006 at 9:38 AM * To: > instantrails-users at rubyforge.org > Cc: curt at hibbs.com > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Dave Havard wrote: > > Thank you Curt. > > > > That has got debugging working but has made things no clearer on why > > some of my form posts are not working. The post does not seem to get > > logged - only reported as a bad client to the console window. Any ideas > > what I should be looking for? My view contains the following code: > > > According to http://mongrel.rubyforge.org/faq.html, a BAD CLIENT error > means the > web browser sent an invalid HTTP request; it has nothing to do with rails. > > What browser are you using? > > - From that FAQ: > > What does BAD CLIENT mean? > > It means that a request came in which Mongrel rejects because it doesn?t > follow > the RFC grammar. Mongrel is pretty relaxed about most requests, but in > order to > block the majority of security attacks for web servers it is strict about > characters used, header formats, status line formats, etc. This is also > based on > matching the RFC?s grammar specification to a Ragel grammar specification, > so > it?s easy to compare. > > If you need to know why the client is triggering this, then simply hit > your > Mongrel processes with USR1 signals and they?ll log the full request data > and > parameters that were collected. Then, if you think the request is valid > send me > this data and I?ll look. If it?s not valid than fix the client. > > Mongrel takes the stance that all clients are written by software > developers and > that they should follow the standard. By doing this it reduces the bugs > and > potential security holes found in many other web servers. It also means > that if > you absolutely have to allow a bad client, then you?ll need to not use > Mongrel. > > > > > - -- > David Morton > Maia Mailguard - http://www.maiamailguard.com > Morton Software Design and Consulting - http://www.dgrmm.net > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.2.2 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFFK7BVUy30ODPkzl0RAma3AKDRcqL3oQJ5tvk3XyX1YJzuJHkvuQCglr2d > 1fx9ureC6X0dzEDqSo1JgaM> =397F > -----END PGP SIGNATURE----- > ------------------------------ > * David Morton <mortonda at dgrmm.net> * * Tue, Oct 10, 2006 at 2:01 PM * To: > instantrails-users at rubyforge.org > Cc: curt at hibbs.com > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > On Oct 10, 2006, at 9:38 AM, David Morton wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Dave Havard wrote: > >> Thank you Curt. > >> > >> That has got debugging working but has made things no clearer on why > >> some of my form posts are not working. The post does not seem to get > >> logged - only reported as a bad client to the console window. Any > >> ideas > >> what I should be looking for? My view contains the following code: > > > > > > According to http://mongrel.rubyforge.org/faq.html, a BAD CLIENT > > error means the > > web browser sent an invalid HTTP request; it has nothing to do with > > rails. > > actually, now that I think about it, perhaps a request has a bad > character in it, or isn''t properly url encoded? > > > > David Morton > Maia Mailguard http://www.maiamailguard.com > mortonda at dgrmm.net > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.5 (Darwin) > > iD8DBQFFK+4DUy30ODPkzl0RAs07AKC41WT2g+7DCvw9wudA1pFe3UN3YgCgkLVP > SmJILQExLXV0SppFk96d2SY> =qYsA > -----END PGP SIGNATURE----- > ------------------------------ > * Dave Havard <david.havard at gmail.com> * * Tue, Oct 10, 2006 at 6:16 PM > * Reply-To: instantrails-users at rubyforge.org > To: instantrails-users at rubyforge.org > Thanks David > > So are they saying that mongrel will fail if the browser is not right? I > am testing on IE6.0.29 and FF1.5. Would be surprised if mongrel does not > work with these browsers - how could it be used in production? > > Have you heard about this problem much? Seems like mongrel is become the > server of choice for rails, but even the scaffold code is failing - can''t > believe it is rails or this issue would be plastered all over the net by > now. At the same time a web server which will not work with FF1.5 seem > unrealistic. > > Could it be something else? Maybe apache is changing something before > passing the request to mongrel? > > Given InstantRails is installing elsewhere without fuss i''ll test on some > more machines... > > Thanks for your help. > Dave > > > > On 10/10/06, David Morton < mortonda at dgrmm.net> wrote: > > > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > > > On Oct 10, 2006, at 9:38 AM, David Morton wrote: > > > > > -----BEGIN PGP SIGNED MESSAGE----- > > > Hash: SHA1 > > > > > > Dave Havard wrote: > > >> Thank you Curt. > > >> > > >> That has got debugging working but has made things no clearer on why > > >> some of my form posts are not working. The post does not seem to get > > >> logged - only reported as a bad client to the console window. Any > > >> ideas > > >> what I should be looking for? My view contains the following code: > > > > > > > > > According to http://mongrel.rubyforge.org/faq.html, a BAD CLIENT > > > error means the > > > web browser sent an invalid HTTP request; it has nothing to do with > > > rails. > > > > actually, now that I think about it, perhaps a request has a bad > > character in it, or isn''t properly url encoded? > > > > > > > > David Morton > > Maia Mailguard http://www.maiamailguard.com > > mortonda at dgrmm.net > > > > > > > > _______________________________________________ > Instantrails-users mailing list > Instantrails-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/instantrails-users > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/instantrails-users/attachments/20061011/d6c07ac7/attachment-0001.html