Class HttpUtil

java.lang.Object
ghidra.net.http.HttpUtil

public class HttpUtil extends Object
  • Constructor Details

    • HttpUtil

      public HttpUtil()
  • Method Details

    • getContent

      public static HttpURLConnection getContent(String httpUrlString, Properties httpRequestProperties, boolean allowRedirect) throws MalformedURLException, IOException
      Execute an HTTP/HTTPS GET request and return the resulting HttpURLConnection.
      Parameters:
      httpUrlString - HTTP/HTTPS URL
      httpRequestProperties - optional HTTP request header values to be included (may be null)
      allowRedirect - allow site redirects to be handled if true
      Returns:
      HttpURLConnection which contains information about the URL
      Throws:
      MalformedURLException - bad httpUrlString specified
      IOException - if an error occurs while executing request
    • getFile

      public static String getFile(String httpUrlString, Properties httpRequestProperties, boolean allowRedirect, File destFile) throws MalformedURLException, IOException
      Download a file by executing an HTTP/HTTPS GET request.
      Parameters:
      httpUrlString - HTTP/HTTPS URL
      httpRequestProperties - optional HTTP request header values to be included (may be null)
      allowRedirect - allow site redirects to be handled if true
      destFile - destination file
      Returns:
      String representing the content-type of the file, or null if the information is not available
      Throws:
      MalformedURLException - bad httpUrlString specified
      IOException - if an error occurs while executing request