Office Hours — Today, April 7

Friday, April 3

Apr 7
8:55 AM
Mark M.
has entered the room
Mark M.
turned on guest access
Refael O.
has entered the room
Mark M.
hello, Refael
how can I help you today?
Refael O.
Hi Mark !
9:00 AM
Refael O.
first of all I would like to say how much I love your book! it's amazing and it's one of the best purchases I made this year !
Mark M.
thanks for the kind words!
Refael O.
I came here because I have a problem and I kinda looked everywhere we no solution
I have an app that is working just fine for a while now, and I'm using Volley library to get and post data to my server using REST API
Mark M.
OK
I have not used Volley personally, but I still may be able to help
what is your issue?
Refael O.
View paste
my server side changed from http to https yesterday,
and since that change, I always get '400 bad input' from the server.
note that both iOS version and me trying in POSTMAN works just fine.
but on android version i get 400 errors.
after exploring and diving into it for a few hours I discovered that if I don't send any headers my request is GOOD!
but I still need to pass the headers somehow..
Mark M.
are your server-side logs showing anything useful?
Refael O.
up until now I used to pass them Overriding the getHeaders(); method
9:05 AM
Refael O.
what do you mean "useful"? my server side guy is sitting next to me
Mark M.
something that tells you what the server did not like about the request that returned a 400
Refael O.
View paste
well, 400 says bad input, meaning I'm not sending something correctly,
but after trying many kind of headers and playing with it, nothing works..
only empty headers pass.
Mark M.
I was hoping that your server would indicate what specifically it did not like about the headers that you were sending
a 400 suggests that the SSL handshaking went OK
so the fact that this is now an https:// URL versus an http:// URL, in theory, should have no impact
rather than fumbling in the dark, trying to guess what the server doesn't like about your headers, it would be useful if the server would *tell* you what it doesn't like about your headers
since you control the server
in cases where you don't control the server, then you're stuck with the "fumbling in the dark" bit
9:10 AM
Refael O.
hmm, my server side is currently trying to answer that for me..
View paste
while he does, you said you never used Volley..
what do you recommend using then?
I'm kinda new to android and never used anything other than volley with rest api
Mark M.
I prefer libraries with actual documentation, support, and packaging, all of which Volley lacks
if I wanted an all-in-one library like Volley, I'd probably go with Ion
I have also used Retrofit for Web service accesses
and there are tons of image-processing libraries with built-in HTTP stacks (Picasso, Universal Image Loader, etc.)
now, some of them may have limitations that would impact you -- for example, I have no idea which of those allow you to customize HTTP headers, as I have not had to deal with that
Refael O.
View paste
well, moving to Ion is a viable option if it can support my customizable HTTP headers,
it's a lot of work tho since i already have my whole app based on volley with 40-50 server calls.
it's all well written and organised in one class, but still it's a lot of writing.
9:15 AM
Refael O.
so i came here to see if I can avoid that with your help
9:15 AM
Mark M.
well, I cannot tell you how to package headers in Volley
Refael O.
ok, so my server guy checked, and I am sending the exact headers required
Mark M.
I fail to see how a change from HTTP to HTTPS would affect it
that would suggest that the issue may be more on the server itself, failing to interpret the headers for some reason
Refael O.
View paste
well, I know what you're saying Mark.
weird thing is that on our testing server which is still on http everything works normally.
but on the https it's going bad, and I'm not changing even one line of code
Mark M.
then that would suggest that there is some difference, server-side, between the testing server and the other server (the one using HTTPS)
again, if the server shows that the headers are coming over properly, it's unlikely that you can somehow improve upon what is already working :-)
Refael O.
View paste
Got it.
i'll have a little sit down with my server guy then and try to work it out,
because until now he told me "it's working on iOS, it's not a server problem".
thanks a lot for your help Mark, this Office Hours is so useful !!
Mark M.
I am glad that I was able to be of some help
9:40 AM
Refael O.
has left the room
9:55 AM
Refael O.
has entered the room
Refael O.
Hi Mark
me again =]
Mark M.
hi!
the chat is nearly over -- do you have a quick question?
Refael O.
View paste
apparently I found the problem, for some reason volley with https is reacting differently in the headers.
the charset=utf8 doesn't work, but charset=utf-8 does work!
View paste
the " - " makes that difference.
so it's solved, just wanted to say thanks again !
10:00 AM
Refael O.
have a good day ;]
10:00 AM
Mark M.
OK, glad to hear that you got it working!
Refael O.
has left the room
Mark M.
turned off guest access

Friday, April 3

 

Office Hours

People in this transcript

  • Mark Murphy
  • Refael Ozeri