> @@ -119,4 +129,9 @@ private static boolean hasPayload(final HttpResponse 
> response) {
>        return response.getPayload() != null && 
> response.getPayload().getRawContent() != null;
>     }
>  
> +   private static boolean isSoapPayload( final InputStream is ) throws 
> IOException {
> +      String content = CharStreams.toString( new InputStreamReader( is, 
> Charsets.UTF_8 ) );
> +      is.reset();
> +      return endSoapTag.matcher( content ).find();
> +   }

The reason behind this change is this: when I encountered a `503 Maintenance` 
from ProfitBricks, I noticed CommandExecutorService hung on the 
`faultHandler.parse(in);` itself. This was because (presumably) the HTML 
payload is actually a valid XML (it's [an 
XHTML](https://github.com/devcsrj/jclouds-labs/blob/master/profitbricks/src/test/resources/maintenance-503.html)
 even). It took forever, and doesn't timeout even if I override properties 
`Constants.PROPERTY_REQUEST_TIMEOUT` and 
`Constants.PROPERTY_CONNECTION_TIMEOUT` to `1000` when [testing 
this](https://github.com/devcsrj/jclouds-labs/blob/master/profitbricks/src/test/java/org/jclouds/profitbricks/http/ResponseStatusFromPayloadHttpCommandExecutorServiceTest.java#L125).

Further debugging the 
[ServiceFaultResponseHandler](https://github.com/devcsrj/jclouds-labs/blob/master/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ServiceFaultResponseHandler.java),
 it shows that it hungs just before it even reaches the `<html>` tag - hangs on 
the `~<!DOCTYPE...` line.

Any thoughts?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/128/files#r23743543

Reply via email to