private HttpStatus commit(HttpUriRequest method) throws IOException { HttpStatus status; HttpClient httpclient = createHttpClient(); // reduce the TIME_WAIT // method.addHeader("Connection", "close"); if (method.getFirstHeader("Referer") == null) { URI uri = method.getURI(); method.setHeader("Referer", uri.getScheme() + "://" + uri.getHost() + ":" + uri.getPort()); } ; try { HttpResponse resp = execute(method, httpclient); status = new HttpStatus(resp.getStatusLine()); if (resp.getEntity() != null) { status.setMessage(EntityUtils.toString(resp.getEntity(), "UTF-8")); } } catch (IOException e) { // cancel the connection when the error happen method.abort(); throw e; } finally { HttpClientUtils.abortConnection(method, httpclient); } return status; }