From 789bbba4e6dabe8671400a6b3997b398ce1045c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=83=B3=E5=BD=93=E5=BD=93?= <donghua.yan@alipay.com>
Date: Wed, 27 Aug 2014 15:24:30 +0800
Subject: [PATCH] anyproxy

---
 lib/requestHandler.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/requestHandler.js b/lib/requestHandler.js
index 72460b9..30c37b3 100644
--- a/lib/requestHandler.js
+++ b/lib/requestHandler.js
@@ -120,6 +120,9 @@ function userRequestHandler(req,userRes){
                 if(callback)callback(userRes);
                 userRes.end();
             });
+            res.on('error',function(error){
+                console.log('error',error);
+            });
 
         });
 
@@ -223,12 +226,17 @@ function mergeCORSHeader(reqHeader,originHeader){
     targetObj["access-control-allow-methods"]     = "GET, POST, PUT";
     targetObj["access-control-allow-headers"]     = reqHeader['access-control-request-headers'] || "-___-||";
 
+    //
+    targetObj["Transfer-Encoding"]                = "chunked";
+
     // Disable caching
     // If the response status is 304 not modified, the data event of response will not emmit
-    targetObj["Transfer-Encoding"]                = "chunked"
     targetObj["Cache-Control"]                    = "no-cache, no-store, must-revalidate";
     targetObj["Pragma"]                           = "no-cache";
     targetObj["Expires"]                          = 0;
+    //
+    targetObj["server"]                           = "anyproxy server";
+    targetObj["x-powered-by"]                     = "Alipay-ct-wd";
 
     return targetObj;
 }