wood burning stoves 2.0*
The moose likes Sockets and Internet Protocols and the fly likes HTTPS POST response format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "HTTPS POST response format" Watch "HTTPS POST response format" New topic
Author

HTTPS POST response format

Baz Matt
Greenhorn

Joined: Feb 26, 2013
Posts: 12
This may seem like a simple question. I`m reading the response from a HTTPS POST request that I made by getting hold of the input stream.

I`m sending the query parameters in the request by writing it into the output stream and reading back the response using the input stream..

I used to get the same query string that I sent, back to me with the token value populated.

For eg: Query String sent in Request: ID = value1 &key = value2&token = value3

Modified Query String sent back in response ID = value1&key = value2&token = 12345

The problem is that now they have changed the way they are sending back the response and are now forwarding the response to our proxy server with Query string in the URL.

By the time I read the response, I lose the query string because it gets modified by the proxy server and I get an entire HTML page corresponding to the URL.

So, from the perspective of the Server sending the response, it appears to be fine as they are sending the modified query string in the url. But from my perspective, I have no use for the URL(no use of browser, Im doing this at code level)..Im not sure how to explain to them that instead of forwarding the URL, I just need to read the response parameters in the input stream. Any advise in what format I should ask them to send the response.

Sample code:

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42371
    
  64
If I understand correctly, the proxy server is under your control - if that's the case, why is it set to mess with the URL?

It sounds a bit as if the "forwarding" actually converts a POST into a GET request - POST requests normally do not have query parameters, whereas GET requests do.


Ping & DNS - my free Android networking tools app
Baz Matt
Greenhorn

Joined: Feb 26, 2013
Posts: 12
Yes, you understood correctly...But I don't have access to the Proxy server. Otherwise, I could have maybe written a filter to intercept the incoming url and check for the query parameters. As a workaround, if I could get them to have the response sent through their output stream, I could just get the content in the POST response. But, this does not make sense to them in the live environment.
Since, I just need a string as the response, wouldn't it be better for them to send it in the Output stream? And I am using SSL, so data will be encrypted..
Baz Matt
Greenhorn

Joined: Feb 26, 2013
Posts: 12
Simply put, in this scenario, is it better to ask them to send the content I need in the body of the HTTP response?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTPS POST response format