}
}
private HTTPSampler createSampler()
{
MultipartUrlConfig urlConfig = null;
HTTPSampler sampler = new HTTPSampler();
sampler.setDomain(serverName());
log.debug("Proxy: setting server: " + sampler.getDomain());
sampler.setMethod(method);
log.debug("Proxy: method server: " + sampler.getMethod());
sampler.setPath(serverUrl());
log.debug("Proxy: setting path: " + sampler.getEncodedPath());
sampler.setName(sampler.getPath());
sampler.setPort(serverPort());
log.debug("Proxy: setting port: " + sampler.getPort());
if (url.indexOf("//") > -1)
{
String protocol = url.substring(0, url.indexOf(":"));
log.debug("Proxy: setting protocol to : " + protocol);
sampler.setProtocol(protocol);
}
else if (sampler.getPort() == 443)
{
sampler.setProtocol("https");
log.debug("Proxy: setting protocol to https");
}
else
{
log.debug("Proxy setting default protocol to: http");
sampler.setProtocol("http");
}
if ((urlConfig = isMultipart(getContentType())) != null)
{
urlConfig.parseArguments(postData);
sampler.setArguments(urlConfig.getArguments());
sampler.setFileField(urlConfig.getFileFieldName());
sampler.setFilename(urlConfig.getFilename());
sampler.setMimetype(urlConfig.getMimeType());
}
else
{
sampler.parseArguments(postData);
}
return sampler;
}