Http bad request

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
gmccarthy
Posts: 62
Joined: Sat Feb 17, 2007 4:56 am
Location: Australia

Http bad request

Post by gmccarthy » Sat Mar 05, 2016 10:05 pm

What might be happening on one persons computer when a POST to a website results in a bad request while the same POST to a website results in a successful POST on most peoples computers?
The log returned
HTTP/1.1 400 Bad request
on one user's computer while it works on other computers:
HTTP/1.1 200 OK
How do I go about trying to find out the cause of the bad request if it is only happening on another persons computer but not on mine when the same actions are done in a standalone?
gmcrev

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7238
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Http bad request

Post by jacque » Sun Mar 06, 2016 5:03 pm

Immediately after the POST command, get the result. If it isn't empty then log it or display it so the user can tell you what it says, it may provide more information.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

gmccarthy
Posts: 62
Joined: Sat Feb 17, 2007 4:56 am
Location: Australia

Re: Http bad request

Post by gmccarthy » Sun Mar 06, 2016 9:25 pm

Doesn't the http log already record that in the set filed for the log?
There are no clues as to the cause of the 400 error in the log.
gmcrev

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Http bad request

Post by SparkOut » Sun Mar 06, 2016 9:38 pm

It's really hard to know without seeing more of the code and data. I would first try to see what the post data contains. Is the content determined by the user? Sanitising input is very important. It could be some basic thing like a linefeed in the data - if you have a single line field with a blank line in it, new data will look like it's on one line, but the contents contain extra chars. Otherwise see if there are any differences on the user's computer, such as regional settings that change decimal separator to comma versus point, or DD/mm/yyyy date format. Is the post data a JSON array? Other general things to try are to flush the DNS cache or try using a regular browser on that computer to make sure the website can be accessed. Otherwise... need more info.

gmccarthy
Posts: 62
Joined: Sat Feb 17, 2007 4:56 am
Location: Australia

Re: Http bad request

Post by gmccarthy » Mon Mar 07, 2016 2:11 am

Thanks for that.
The post is to the dropbox api. The post contains json data. Setting headers is involved. All seems properly formed. It works on the majority of user computers.
The post is identical on each user computer. I know that the user can ping the website. The first part of the log indicates that the post was sent to the dropbox api website.
I might try flushing the DNS cache.
gmcrev

Post Reply

Return to “Internet”