diff --git a/httprl.async.inc b/httprl.async.inc
index f46d34e..2bf4ea8 100644
--- a/httprl.async.inc
+++ b/httprl.async.inc
@@ -43,7 +43,7 @@ function httprl_async_page() {
   }
 
   // If request was a non blocking one, cut the connection right here.
-  if (empty($_POST['mode'])) {
+  if (empty($_POST['mode']) && !empty($_POST['context']['session'])) {
     httprl_background_processing('httprl async function callback running', FALSE);
   }
 
@@ -51,13 +51,23 @@ function httprl_async_page() {
   httprl_lock_release($_POST['temp_key']);
 
   // Set time limit.
-  if (isset($_POST['php_timeout']) && is_numeric($_POST['php_timeout']))  {
+  if (isset($_POST['php_timeout']) && is_numeric($_POST['php_timeout'])) {
     // Copy of drupal_set_time_limit().
     if (function_exists('set_time_limit')) {
       @set_time_limit($_POST['php_timeout']);
     }
   }
 
+  // Set context.
+  if (!empty($_POST['context']) && is_array($_POST['context'])) {
+    if (!empty($_POST['context']['uid'])) {
+      httprl_set_user($_POST['context']['uid']);
+    }
+    if (!empty($_POST['context']['q'])) {
+      httprl_set_q($_POST['context']['q']);
+    }
+  }
+
   // Extract Data.
   $args = unserialize($_POST['args']);
 
diff --git a/httprl.module b/httprl.module
index ef6c542..d543f1b 100644
--- a/httprl.module
+++ b/httprl.module
@@ -2055,6 +2055,7 @@ function httprl_queue_background_callback(&$args, &$result = NULL) {
       'mode' => $mode,
       'php_timeout' => max($times),
       'function' => $callback_options['function'],
+      'context' => $callback_options['context'],
       'args' => serialize($args),
     ),
     'internal_states' => array(
@@ -2070,9 +2071,20 @@ function httprl_queue_background_callback(&$args, &$result = NULL) {
   if (isset($callback_options['options']) && is_array($callback_options['options'])) {
     $options += $callback_options['options'];
   }
+
+  // Set Host header.
   if (empty($options['headers']['Host']) && !empty($_SERVER['HTTP_HOST'])) {
     $options['headers']['Host'] = $_SERVER['HTTP_HOST'];
   }
+
+  // Set Session header if requested to.
+  if (!empty($callback_options['context']['session']) && !empty($_COOKIE[session_name()])) {
+    if (!isset($options['headers']['Cookie'])) {
+      $options['headers']['Cookie'] = '';
+    }
+    $options['headers']['Cookie'] = session_name() . '=' . $_COOKIE[session_name()] . ';';
+  }
+
   // Send Request.
   return httprl_request($url, $options);
 }
