Bug? http bad request

qsrtech

Active Member
Licensed User
Longtime User
I'm finding I'm having an issue with Httputils. Seems to happen after 1000's of requests. Restarting the app seems to resolve it, unfortunately I have some widgets that run into this problem and they have to be completely re-installed, unless I wanna restart my device which I hate doing cause you never know if it will restart! (esp windows!)
 

qsrtech

Active Member
Licensed User
Longtime User
2 and no they range from mins to 30 mins. Is there a way to "reset" the httputils like after a certain number of requests cause like I said once the app is restarted it's fine and other apps running (that use httputils as well) aren't affected.

edit: other apps which use the same Web service as well aren't affected
 
Last edited:

qsrtech

Active Member
Licensed User
Longtime User
Yes job.release.
b4a doesn't get any specific error, just the result returns HTML stating "
<BODY><h2>Bad Request - Request Too Long</h2>
" and "
<hr><p>HTTP Error 400. The size of the request headers is too long.</p>" among-st other basic html error stuff. I don't include any other header stuff than what is sent automatically and my post data is just a basic SQL storedprocedure call so less than 100 chars.

EDIT: Miraculously my widget starting working again today. not sure if httputils reset itself somehow. I'm going to change to using a GET and see if it happens again. It will take several days to weeks to determine if that's the cause, assuming my phone doesn't get restarted.
 
Last edited:

qsrtech

Active Member
Licensed User
Longtime User
Erel said:
It might be related to an endless list of cookies. You can try to call StopService(HttpUtils2Service) and then start it again. It will create a new HttpClient.
Thanks. Now that I learned how to do a GET I'm switching everything to Get except one call that can and does go over the GET length limitations. I skipped over the download2 method cause it's somewhat misleading, also your original SQL tutorial used poststring. I'll also incorporate a daily "cleanse" by restarting the httputils service as a precaution. On a side note it does seem like GET's are faster, at least in my cases.
 
Last edited:

qsrtech

Active Member
Licensed User
Longtime User
UPDATE: Unfortunately switching to GET did not seem to resolve the issue. Same HTTP error code. Last option is to try and "cleanse" by stopping/restarting the httputilsservice everyday.
 

qsrtech

Active Member
Licensed User
Longtime User
Do you think it could have something to do with the server's timeouts? Maybe the timeouts are too high and the app's connection is never "recycled" so it just keeps compounding?
 

warwound

Expert
Licensed User
Longtime User
Do you have access to the server?
If so then could you write some code to log the request headers to a file when there is an error.
Then you could take a look at that file to see exactly what these 'too long' request headers are.

Martin.
 
Top