devserver.py: Handle query strings for critical updates

Currently, the only way for devserver to return a response indicating a
critical update is to spawn it with '--critical_update' flag. This is
not an ideal implementation as the autotests that require a critical
update response will need to spawn a new devserver (probably along with
the lab devservers) to achieve this. A much easier approach is to pass
"critical_update=True" query string to the update URL passed to the
update_engine. This way the devserver/nebraska would know that response
to this specific request should be critical.

BUG=chromium:1004487
TEST=devserver_integration_test.py
TEST=manually started devserver.py and send a request to this URL:
http://127.0.0.1:8080/update/?critical_update=True

Change-Id: Ie9908ce7ae83d5ec29534b1e2cba6e60bf242dbc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/1996147
Commit-Queue: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: David Haddock <dhaddock@chromium.org>
diff --git a/devserver.py b/devserver.py
index dd54308..6230f8c 100755
--- a/devserver.py
+++ b/devserver.py
@@ -1458,7 +1458,7 @@
     return '<pre>\n%s</pre>' % method.__doc__
 
   @cherrypy.expose
-  def update(self, *args):
+  def update(self, *args, **kwargs):
     """Handles an update check from a Chrome OS client.
 
     The HTTP request should contain the standard Omaha-style XML blob. The URL
@@ -1500,7 +1500,7 @@
     body_length = int(cherrypy.request.headers.get('Content-Length', 0))
     data = cherrypy.request.rfile.read(body_length)
 
-    return updater.HandleUpdatePing(data, label)
+    return updater.HandleUpdatePing(data, label, **kwargs)
 
 
 def _CleanCache(cache_dir, wipe):
@@ -1557,6 +1557,7 @@
       'how the devserver serve update payloads. Please '
       'note that all of these option affect how a payload is generated and so '
       'do not work in archive-only mode.')
+  # TODO(crbug/1004487): Deprecate critical_update.
   group.add_option('--critical_update',
                    action='store_true', default=False,
                    help='Present update payload as critical')