Android Question Log RAW HTTP request

Mike1970

Well-Known Member
Licensed User
Longtime User
Hi everyone I'm using OkHttpUtils2 to perform some HTTP requests but I need to debug phone-side because the server crashes and I have no way to see why.
So I need to log ALL the request content that the phone is sending: headers, body, everything.

thanks in advance
 

Sandman

Expert
Licensed User
Longtime User
That's not how you usually do it. Instead you have something sitting between the device and the backend.

Historically I've used Charles Proxy for some things:

Currently I'm using ngrok:

The latter might seem complicated, but once you install it, it's almost dead simple to use.

There are many alternatives to the two above:
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
So you're telling me that from B4A I can't print the request that it itself is making?
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Nope, that's not what I'm telling you. I'm just telling you how most people do it.

If you want the info directly from the phone, I imagine you would have to root it and install some sort of network sniffer. Seems like a lot of work, but go ahead and please report back to the forum - I'd love to hear how it went.

Also, in fairness, it might be possible to get OkHttpUtils2 to produce some sort of verbose report, but I've never heard of it.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
there are online test servers available or you could run one locally. just send your
request to it and display what it sees: headers, body, everything.

if a server crashes, there is no network connection. nothing to report back, no way to
report it. that someone could crash a modern-day server with an okhttputils2 http
request is pretty amazing on its face. i reckon erel is more of a genius than we thought.

in the event of some exception, an http server will report what it has been
programmed to report; in most - if not all - cases, that will be a 50x
http error. occasionally, as in the case of ssl failures, the caller may receive
a little more information. what the server may report to itself will be to itself. okhttputils2
does not have any enhanced interrogation methods to find out.

okhttputils2 is a conduit using square's ok technology. square has developed all
the request- and response-related code. okhttputils2 wraps it. blaming okhttputils2
is a stretch.
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
blaming okhttputils2 is a stretch.
I don't think anybody did that.


that someone could crash a modern-day server with an okhttputils2 http
request is pretty amazing on its face
Not really. If by "server" you mean the backend that is called behind the actual webserver (Apache, for instance). Any bug in there might very well result in a crash in the backend code.

But yes, if you did mean the actual webserver (Apache, for instance again), then it is exceptionally unlikely.
 
Last edited:
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
The server is not developed by you?
Otherwise why not handle the error using Try-Catch?
Yes, the backend is developed by me, but the client receives an error BEFORE the request arrives on the server , so it is a big mistery.

Edit: the problem is solved, somehow the internal configuration of the webserver has changed autonomously (maybe some update of the webhosting center, i don't know) and the maximumRequestLenght parameter has changed so the requests were trashed before reaching the code because too long for the "new" limit...
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
BTW would be useful to have such a manner to log the http request i'm sending directly from B4A.. you know.. debug purpose, understand what the phone is actually sending out
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…