update docblock
[linksys-wrt3g-tools.git] / Wrt3g / DummyRequest.php
index 97f3217bd644b05954fe519c30b913d98690a1a1..5a748afb78d8b8517518fc51f4329c99b447243c 100644 (file)
@@ -10,7 +10,8 @@ class Wrt3g_DummyRequest extends HTTP_Request2
      * @var array
      */
     public static $mapping = array(
-        '/Status_NoAuth.asp' => 'tests/status_noauth-connected.htm'
+        '/Status_NoAuth.asp'  => 'tests/status_noauth-connected.htm',
+        '/index_wstatus1.asp' => 'tests/index_wstatus1-connected-excellent.htm'
     );
 
 
@@ -32,7 +33,10 @@ class Wrt3g_DummyRequest extends HTTP_Request2
 
 
    /**
-    * Sends the request and returns the response
+    * Sends the request and returns the response.
+    * When the host is three-letter numeric string, it
+    * is used as HTTP response status code. No "proper" content
+    * is returned in that case.
     *
     * @return HTTP_Request2_Response
     *
@@ -41,6 +45,14 @@ class Wrt3g_DummyRequest extends HTTP_Request2
     */
     public function send()
     {
+        $host = $this->url->getHost();
+        if (strlen($host) == 3 && is_numeric($host)) {
+            $this->adapter->addResponse(
+                "HTTP/1.0 $host dummy\n\nnothing"
+            );
+            return parent::send();
+        }
+
         $path = $this->url->getPath();
         if (!isset(self::$mapping[$path])) {
             throw new HTTP_Request2_Exception(