Reviewers: johnfargo, zhoresh, shindig.remailer_gmail.com, dev-remailer_shindig.apache.org, cool-shindig-committers_googlegroups.com,

Description:
Returning the error http status code as the fetched resource. Since we
want to proxy the resource through, we want the user to see the exact
code returned by the server.

Please review this at http://codereview.appspot.com/1811042/show

Affected files:
  servlet/AccelHandler.java
  uri/UriUtils.java


Index: servlet/AccelHandler.java
===================================================================
--- servlet/AccelHandler.java   (revision 963121)
+++ servlet/AccelHandler.java   (working copy)
@@ -210,15 +210,12 @@
protected boolean handleErrors(HttpResponse results, HttpServletResponse response)
       throws IOException {
     if (results == null) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST, ERROR_FETCHING_DATA); + response.sendError(HttpServletResponse.SC_NOT_FOUND, ERROR_FETCHING_DATA);
       return false;
     }
-    if (results.getHttpStatusCode() == HttpServletResponse.SC_NOT_FOUND) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND, ERROR_FETCHING_DATA);
+    if (results.isError()) {
+      response.sendError(results.getHttpStatusCode(), ERROR_FETCHING_DATA);
       return false;
-    } else if (results.isError()) {
- response.sendError(HttpServletResponse.SC_BAD_GATEWAY, ERROR_FETCHING_DATA);
-      return false;
     }

     return true;
Index: uri/UriUtils.java
===================================================================
--- uri/UriUtils.java   (revision 963121)
+++ uri/UriUtils.java   (working copy)
@@ -123,10 +123,5 @@
         resp.setHeader(entry.getKey(), entry.getValue());
       }
     }
-
-    // External "internal error" should be mapped to gateway error.
- if (data.getHttpStatusCode() == HttpResponse.SC_INTERNAL_SERVER_ERROR) {
-      resp.sendError(HttpResponse.SC_BAD_GATEWAY);
-    }
   }
 }


Reply via email to