Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(28)

Issue 1696059: Catching recoverable errors in ProxyHandler and returning original results (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 5 months ago by gagan.goku
Modified:
15 years, 5 months ago
Reviewers:
johnfargo, zhoresh, chirag
CC:
cool-shindig-committers_googlegroups.com, anupama.dutta
Base URL:
http://svn.apache.org/repos/asf/shindig/trunk/
Visibility:
Public.

Description

Proxy servlet should not throw INTERNAL_SERVER_ERRORS whenever there is a rewriting exception. If it is possible to return the original content and the RETURN_ORIGINAL_CONTENT_ON_ERROR is set as "true", ProxyHandler should return the original content. To reproduce the exception, do the following: 1) Override ParseModule to use CajaHtmlParser instead of Neko. 2) Proxy a web page which caja fails on, so for example.org, load: gadgets/proxy?container=default&gadget=test&url=http%3A%2F%2Fwww.example.org%2F ProxyHandler then throws INTERNAL_SERVER_ERROR: org.apache.shindig.gadgets.rewrite.RewritingException: content.getDocument is null. Content: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- server: 155 mcn: in:/ci/content/current/site/index.html hostname: wci033, country: in, cluster: ind, created: 2010-08-03 14:51:45 --> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://developers.example.com/schema/" > <head> <title>Example.org </title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> .....

Patch Set 1 #

Patch Set 2 : catching_recoverable_errors #

Total comments: 8

Patch Set 3 : 'adding_test' #

Patch Set 4 : 'adding_test' #

Total comments: 2

Patch Set 5 : updating_patch #

Patch Set 6 : adding_anupamas_test #

Patch Set 7 : not_returning_original_content_if_sanitize_request #

Patch Set 8 : not_returning_original_content_if_sanitize_request #

Patch Set 9 : reverting_clearing_headers_change #

Patch Set 10 : uploading_after_syncing #

Patch Set 11 : adding_return_original_content_on_error #

Patch Set 12 : svn_up #

Patch Set 13 : updating_test #

Patch Set 14 : updating_test #

Total comments: 10

Patch Set 15 : addressing_anupamas_comments #

Patch Set 16 : adding_returnOriginalContentOnError_to_more_places #

Unified diffs Side-by-side diffs Delta from patch set Stats (+158 lines, -21 lines) Patch
M java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ProxyHandler.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 5 chunks +38 lines, -14 lines 0 comments Download
M java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/ProxyUriManager.java View 11 12 13 14 15 6 chunks +20 lines, -2 lines 0 comments Download
M java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/UriCommon.java View 11 12 13 14 15 1 chunk +1 line, -0 lines 0 comments Download
M java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/ProxyHandlerTest.java View 3 4 5 6 7 8 9 10 11 12 13 14 15 4 chunks +99 lines, -5 lines 0 comments Download

Messages

Total messages: 30
anupama.dutta
http://codereview.appspot.com/1696059/diff/2001/3001 File java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ProxyHandler.java (right): http://codereview.appspot.com/1696059/diff/2001/3001#newcode141 java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ProxyHandler.java:141: LOG.log(Level.FINE, "Caught RewritingException when proxying: " "WARNING" would be ...
15 years, 5 months ago (2010-08-03 17:21:12 UTC) #1
gagan.goku
http://codereview.appspot.com/1696059/diff/2001/3001 File java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ProxyHandler.java (right): http://codereview.appspot.com/1696059/diff/2001/3001#newcode141 java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ProxyHandler.java:141: LOG.log(Level.FINE, "Caught RewritingException when proxying: " On 2010/08/03 17:21:13, ...
15 years, 5 months ago (2010-08-03 19:42:04 UTC) #2
johnfargo
http://codereview.appspot.com/1696059/diff/9001/10002 File java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ProxyHandler.java (right): http://codereview.appspot.com/1696059/diff/9001/10002#newcode141 java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ProxyHandler.java:141: if (!isRecoverable(results)) { HttpResponse is immutable, so if we ...
15 years, 5 months ago (2010-08-03 21:50:25 UTC) #3
gagan.goku
http://codereview.appspot.com/1696059/diff/9001/10002 File java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ProxyHandler.java (right): http://codereview.appspot.com/1696059/diff/9001/10002#newcode141 java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ProxyHandler.java:141: if (!isRecoverable(results)) { On 2010/08/03 21:50:26, johnfargo wrote: > ...
15 years, 5 months ago (2010-08-04 06:29:45 UTC) #4
johnfargo
On Tue, Aug 3, 2010 at 11:29 PM, <gagan.goku@gmail.com> wrote: > > http://codereview.appspot.com/1696059/diff/9001/10002 > File ...
15 years, 5 months ago (2010-08-04 08:02:19 UTC) #5
gagan.goku
On Wed, Aug 4, 2010 at 1:32 PM, John Hjelmstad <johnfargo@gmail.com> wrote: > On Tue, ...
15 years, 5 months ago (2010-08-04 10:17:47 UTC) #6
johnfargo
SGTM. Want me to complete the review or hold off for updates? On Wed, Aug ...
15 years, 5 months ago (2010-08-04 22:02:21 UTC) #7
gagan.goku
On Thu, Aug 5, 2010 at 3:32 AM, John Hjelmstad <johnfargo@gmail.com> wrote: > SGTM. Want ...
15 years, 5 months ago (2010-08-05 05:57:47 UTC) #8
johnfargo
Sounds good to me -- could you resolve this against current @head? I'd be happy ...
15 years, 5 months ago (2010-08-06 00:45:59 UTC) #9
chirag
The original content shouldn't be returned if the "sanitize" parameter is set to 1 since ...
15 years, 5 months ago (2010-08-06 05:43:43 UTC) #10
gagan.goku
On 2010/08/06 05:43:43, chirag wrote: > The original content shouldn't be returned if the "sanitize" ...
15 years, 5 months ago (2010-08-06 13:55:26 UTC) #11
johnfargo
@Chirag, that's a great point. While it's easy to work around this particular issue, this ...
15 years, 5 months ago (2010-08-06 18:16:28 UTC) #12
johnfargo
Gagan, thoughts on my latest response? There are several situations in which users of the ...
15 years, 5 months ago (2010-08-11 18:18:55 UTC) #13
chirag
I agree. I've been operating under the assumption that proxied content can only be mutated ...
15 years, 5 months ago (2010-08-12 07:30:29 UTC) #14
gagan.goku
@John I didn't realize you were asking me for comments :) On Wed, Aug 11, ...
15 years, 5 months ago (2010-08-12 07:56:51 UTC) #15
johnfargo
Soudns like a quite reasonable strategy to me. Feel free to attach this behavior to ...
15 years, 5 months ago (2010-08-12 07:57:32 UTC) #16
johnfargo
PS. Pre-nit: I'd recommend a short queryparam name, since our URLs are getting long enough ...
15 years, 5 months ago (2010-08-12 07:58:21 UTC) #17
gagan.goku
@John I didn't realize you were asking me for comments :) On Wed, Aug 11, ...
15 years, 5 months ago (2010-08-12 08:02:18 UTC) #18
gagan.goku
Cool. Let me add the http request param in this change and make another cl ...
15 years, 5 months ago (2010-08-12 08:08:34 UTC) #19
gagan.goku
Cool. Let me add the http request param in this change and make another cl ...
15 years, 5 months ago (2010-08-12 08:09:51 UTC) #20
gagan.goku
Cool. Let me add the http request param in this change and make another cl ...
15 years, 5 months ago (2010-08-12 08:22:59 UTC) #21
gagan.goku
Cool. Let me add the http request param in this change and make another cl ...
15 years, 5 months ago (2010-08-12 08:30:05 UTC) #22
gagan.goku
Hi Anumapa, John I added a RETURN_ORIGINAL_CONTENT_ON_ERROR param to ProxyUri and HttpRequest and ProxyHandler will ...
15 years, 5 months ago (2010-08-12 09:34:49 UTC) #23
anupama.dutta
Good tests! http://codereview.appspot.com/1696059/diff/38002/49004 File java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/ProxyUriManager.java (right): http://codereview.appspot.com/1696059/diff/38002/49004#newcode180 java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/ProxyUriManager.java:180: req.setParam(Param.RETURN_ORIGINAL_CONTENT_ON_ERROR.getKey(), Add a newline before this to ...
15 years, 5 months ago (2010-08-12 10:32:33 UTC) #24
gagan.goku
http://codereview.appspot.com/1696059/diff/38002/49004 File java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/ProxyUriManager.java (right): http://codereview.appspot.com/1696059/diff/38002/49004#newcode180 java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/ProxyUriManager.java:180: req.setParam(Param.RETURN_ORIGINAL_CONTENT_ON_ERROR.getKey(), On 2010/08/12 10:32:33, anupama.dutta wrote: > Add a ...
15 years, 5 months ago (2010-08-12 12:33:25 UTC) #25
anupama.dutta
LGTM.
15 years, 5 months ago (2010-08-12 13:24:16 UTC) #26
gagan.goku
On 2010/08/12 13:24:16, anupama.dutta wrote: > LGTM. Thanks for the thorough review Anupama. @John, Chirag: ...
15 years, 5 months ago (2010-08-12 16:12:46 UTC) #27
gagan.goku
Hi Ziv, John, Chirag Could you please take a look and commit this cl if ...
15 years, 5 months ago (2010-08-18 10:55:42 UTC) #28
johnfargo
LGTM. I'm making a few slight modifications, and committing. Let me know if you would ...
15 years, 5 months ago (2010-08-18 16:54:06 UTC) #29
gagan.goku
15 years, 5 months ago (2010-08-19 05:23:32 UTC) #30
Thanks John.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b