Is there away to verify in a request header that weather http or https was sent
I am looking to create some logs based on the actual traffic, and was wondering if there was a way to determine if a request was sent using http or https, within a script. I know I can pull the initial url, but I was looking for more of a header option, internal value like input.get("Request HTTP Headers"), or such.
Best Answer
-
Trivial Groovy script for Extension Tool chained to client's "Traffic Object" output:
import com.parasoft.api.* import soaptest.api.* import java.net.* import java.util.* void getTraffic(Map input, ScriptingContext context) { String endpoint = input.get(SOAPUtil.END_POINT) Application.showMessage("endpoint is " + endpoint) URI endpointUri = new URI(endpoint) String scheme = endpointUri.getScheme() Application.showMessage("protocol is " + scheme) }
5
Answers
-
You cannot check anything in the HTTP header, since the HTTP header is identical between HTTP and HTTPS. When using SSL, the transport changes but the HTTP headers and payloads do not.
0 -
See my comment in this other thread:
get Data From Traffic Viewer ObjectI think you can get the endpoint URL (which includes the protocol) using input.get(SOAPUtil.END_POINT).
0 -
@jakubiak - is it possible to capture just the transport method, rather than having to parse to url? That is more what I am looking for.
0