sixcooler 14 years ago
parent 0ce17d823a
commit 8ad4e10491

@ -270,9 +270,9 @@ public class HTTPClient {
* @throws IOException
*/
public byte[] GETbytes(final String uri, long maxBytes) throws IOException {
MultiProtocolURI url = new MultiProtocolURI(uri);
final MultiProtocolURI url = new MultiProtocolURI(uri);
final HttpGet httpGet = new HttpGet(url.toNormalform(true, false, true, false));
httpGet.setHeader("Host", url.getHost()); // overwrite resolved IP
// httpGet.setHeader("Host", url.getHost()); // overwrite resolved IP
return getContentBytes(httpGet, maxBytes);
}
@ -286,9 +286,9 @@ public class HTTPClient {
*/
public void GET(final String uri) throws IOException {
if (currentRequest != null) throw new IOException("Client is in use!");
MultiProtocolURI url = new MultiProtocolURI(uri);
final MultiProtocolURI url = new MultiProtocolURI(uri);
final HttpGet httpGet = new HttpGet(url.toNormalform(true, false, true, false));
httpGet.setHeader("Host", url.getHost()); // overwrite resolved IP
// httpGet.setHeader("Host", url.getHost()); // overwrite resolved IP
currentRequest = httpGet;
execute(httpGet);
}
@ -301,9 +301,9 @@ public class HTTPClient {
* @throws IOException
*/
public HttpResponse HEADResponse(final String uri) throws IOException {
MultiProtocolURI url = new MultiProtocolURI(uri);
final MultiProtocolURI url = new MultiProtocolURI(uri);
final HttpHead httpHead = new HttpHead(url.toNormalform(true, false, true, false));
httpHead.setHeader("Host", url.getHost()); // overwrite resolved IP
// httpHead.setHeader("Host", url.getHost()); // overwrite resolved IP
execute(httpHead);
finish();
ConnectionInfo.removeConnection(httpHead.hashCode());
@ -322,9 +322,9 @@ public class HTTPClient {
*/
public void POST(final String uri, final InputStream instream, long length) throws IOException {
if (currentRequest != null) throw new IOException("Client is in use!");
MultiProtocolURI url = new MultiProtocolURI(uri);
final MultiProtocolURI url = new MultiProtocolURI(uri);
final HttpPost httpPost = new HttpPost(url.toNormalform(true, false, true, false));
httpPost.setHeader("Host", url.getHost()); // overwrite resolved IP
// httpPost.setHeader("Host", url.getHost()); // overwrite resolved IP
final InputStreamEntity inputStreamEntity = new InputStreamEntity(instream, length);
// statistics
upbytes = length;
@ -342,9 +342,9 @@ public class HTTPClient {
* @throws IOException
*/
public byte[] POSTbytes(final String uri, final Map<String, ContentBody> parts, final boolean usegzip) throws IOException {
MultiProtocolURI url = new MultiProtocolURI(uri);
final MultiProtocolURI url = new MultiProtocolURI(uri);
final HttpPost httpPost = new HttpPost(url.toNormalform(true, false, true, false));
httpPost.setHeader("Host", url.getHost()); // overwrite resolved IP
// httpPost.setHeader("Host", url.getHost()); // overwrite resolved IP
final MultipartEntity multipartEntity = new MultipartEntity();
for (final Entry<String,ContentBody> part : parts.entrySet())

Loading…
Cancel
Save