What are the equivalent functions that I should use for HTTP handling?
These are the functions/methods/classes that should be used in Drupal 8.6.x code.


drupal_access_denied() has been replaced from the AccessDeniedHttpException class. Page callbacks that need to return the Access Denied error should used code similar to the following one.

// system_batch_page()
public function batchPage(Request $request) {
  require_once $this-&gt;root . '/core/includes/batch.inc';
  $output = _batch_page($request);
  if ($output === FALSE) {
    throw new AccessDeniedHttpException();
  }
  elseif ($output instanceof Response) {
    return $output;
  }
  elseif (isset($output)) {
    $title = isset($output['#title']) ? $output['#title'] : NULL;
    $page = [
      '#type' =&gt; 'page',
      '#title' =&gt; $title,
      '#show_messages' =&gt; FALSE,
      'content' =&gt; $output,
    ];

    // Also inject title as a page header (if available).
    if ($title) {
      $page['header'] = [
        '#type' =&gt; 'page_title',
        '#title' =&gt; $title,
      ];
    }
    return $page;
  }
}

Instead of drupal_get_query_array() there is parse_query() (a function in the GuzzleHttp\Psr7 namespace), which is part of Guzzle.
drupal_goto() has been replaced from the RedirectResponse class. Page callbacks that need to redirect users should use code similar to the following one. (Notice that form submission handlers should not use this class.)

// AddSectionController::build()
public function build(SectionStorageInterface $section_storage, $delta, $plugin_id) {
  $section_storage
    -&gt;insertSection($delta, new Section($plugin_id));
  $this-&gt;layoutTempstoreRepository
    -&gt;set($section_storage);
  if ($this-&gt;isAjax()) {
    return $this-&gt;rebuildAndClose($section_storage);
  }
  else {
    $url = $section_storage-&gt;getLayoutBuilderUrl();
    return new RedirectResponse($url-&gt;setAbsolute()-&gt;toString());
  }
}

drupal_http_request() has been replaced from a Drupal 8 service that implements the ClientInterface interface. Drupal 8 code should be similar to the following one.

// system_retrieve_file()
try {
  $data = (string) \Drupal::httpClient()-&gt;get($url)-&gt;getBody();
  $local = $managed ? file_save_data($data, $path, $replace) : file_unmanaged_save_data($data, $path, $replace);
} catch (RequestException $exception) {
  \Drupal::messenger()-&gt;addError(t('Failed to fetch file due to error "%error"', ['%error' =&gt; $exception-&gt;getMessage()]));
  return FALSE;
}

drupal_not_found() has been replaced from the NotFoundHttpException class. Page callbacks should use code similar to the following one.

// BookController::bookExport()
public function bookExport($type, NodeInterface $node) {
  $method = 'bookExport' . Container::camelize($type);

  // @todo Convert the custom export functionality to serializer.
  if (!method_exists($this-&gt;bookExport, $method)) {
    $this-&gt;messenger()-&gt;addStatus(t('Unknown export format.'));
    throw new NotFoundHttpException();
  }
  $exported_book = $this-&gt;bookExport-&gt;{$method}($node);
  return new Response($this-&gt;renderer-&gt;renderRoot($exported_book));
}

drupal_site_offline() should be replaced by an event subscriber, similar to the following one.

public static function getSubscribedEvents() {
  $events[KernelEvents::REQUEST][] = ['onKernelRequestMaintenance', 30];
  $events[KernelEvents::EXCEPTION][] = ['onKernelRequestMaintenance'];
  return $events;
}

public function onKernelRequestMaintenance(GetResponseEvent $event) {
  $request = $event-&gt;getRequest();
  $route_match = RouteMatch::createFromRequest($request);
  if ($this-&gt;maintenanceMode-&gt;applies($route_match)) {
    // Don't cache maintenance mode pages.
    \Drupal::service('page_cache_kill_switch')-&gt;trigger();
    if (!$this-&gt;maintenanceMode-&gt;exempt($this-&gt;account)) {
      // Deliver the 503 page if the site is in maintenance mode and the
      // logged in user is not allowed to bypass it.
      // If the request format is not 'html' then show default maintenance
      // mode page else show a text/plain page with maintenance message.
      if ($request-&gt;getRequestFormat() !== 'html') {
        $response = new Response($this-&gt;getSiteMaintenanceMessage(), %03, ['Content-Type' =&gt; 'text/plain']);
        $event-&gt;setResponse($response);
        return;
      }
      drupal_maintenance_theme();
      $response = $this-&gt;bareHtmlPageRenderer-&gt;renderBarePage([          '#markup' =&gt; $this-&gt;getSiteMaintenanceMessage()], $this-&gt;t('Site under maintenance'), 'maintenance_page');
      $response-&gt;setStatusCode(503);
      $event-&gt;setResponse($response);
    }
    else {
      // Display a message if the logged in user has access to the site in
      // maintenance mode. However, suppress it on the maintenance mode
      // settings page.
      if ($route_match-&gt;getRouteName() != 'system.site_maintenance_mode') {
        if ($this-&gt;account-&gt;hasPermission('administer site configuration')) {
          $this-&gt;messenger-&gt;addMessage($this
      -&gt;t('Operating in maintenance mode. &lt;a href=":url"&gt;Go online.&lt;/a&gt;', [':url' =&gt; $this-&gt;urlGenerator-&gt;generate('system.site_maintenance_mode')]), 'status', FALSE);
        }
        else {
          $this-&gt;messenger-&gt;addMessage($this-&gt;t('Operating in maintenance mode.'), 'status', FALSE);
        }
      }
    }
  }
}



drupal_encode_path() has been replaced by UrlHelper::encodePath()
drupal_get_query_parameters() has been replaced by UrlHelper::filterQueryParameters()
drupal_http_build_query() has been replaced by UrlHelper::buildQuery(), which will be removed once Drupal core requires at least PHP 5.4 (At that point, it will be possible to directly use  http_build_query().)
drupal_parse_url() has been replaced by UrlHelper::parse()



Notice that, compared with earlier Drupal versions, there are some important changes. For example, some methods that were in the Url class has been moved in the UrlHelper class; some of the Guzzle classes aren't used anymore.