Skip to content

New Bugzilla version requires HTTP Referer header for auth request

public InputStream
    httpGet(String path) throws IOException
    {
        HttpGet get = new HttpGet(rootURL + "/" + path + authorization);
        get.addHeader("Referer", rootURL);
        HttpResponse response = httpClient.execute(get, cntxt);
        StatusLine status = response.getStatusLine();
        
        if (status.getStatusCode() != HttpStatus.SC_OK) {
            throw new IOException(status.getReasonPhrase());
        }
        
        return response.getEntity().getContent();
    }

cc @El-khoury