                 decode null, buf
         .on 'error', cb
 
-    req.setTimeout timeout, -> req.emit 'error', new Error 'timeout'
+    req.setTimeout timeout, ->
+        err = new Error "Request #{url.format opts} timeout."
+        err.code = "TIMEOUT"
+        req.emit 'error', err
+
     req.end()
     req
 

            when 'https:' then _require('https').request

    if not request
        cb new Error "Protocol #{opts.protocol} is not supported."

    req = request opts, (res) ->
        statusCode = res.statusCode


    if urlStr
        if urlStr.indexOf('.') < 0
            err = new TypeError "Unvalid url string #{opts}."
            err.code = 'UNVALID URL'
            return cb
        if urlStr.indexOf('http') < 0
            urlStr = 'http://' + urlStr

