You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by "James P. White (JIRA)" <ji...@apache.org> on 2008/07/22 07:42:31 UTC

[jira] Created: (IVY-864) HTTP Handlers ignore unsuccessful response codes.

HTTP Handlers ignore unsuccessful response codes.
-------------------------------------------------

                 Key: IVY-864
                 URL: https://issues.apache.org/jira/browse/IVY-864
             Project: Ivy
          Issue Type: Bug
            Reporter: James P. White


The HttpClientHander.download and BasicURLHandler.download methods don't bother to check the HTTP response code from the server.  As a result they will put anything that the server sends back as the contents of the artifact.  This isn't so good if it is something like the HTML message for a 404 or 503 and what you wanted was a JAR file.  In fact it is pretty bad because then the cache is poisoned and the user is left with purging the cache as the only solution.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (IVY-864) HTTP Handlers ignore unsuccessful response codes.

Posted by "James P. White (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IVY-864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12615624#action_12615624 ] 

James P. White commented on IVY-864:
------------------------------------

I make a lot of use of the 'url' attribute of 'dependency' in order to (ab)use Ivy for download & cache of JARs that aren't in Ivy or Maven repositories (of course I use repos when available).   That must not go through getURLInfo for some reason because download is called even when the host is unknown or the file is missing, so that may be another part of this problem.

I did do some minimal testing of the patch, but didn't create any test cases as you can see.

I'm also going to be looking into using Ivy RoundUp and the PackagerResolver.


> HTTP Handlers ignore unsuccessful response codes.
> -------------------------------------------------
>
>                 Key: IVY-864
>                 URL: https://issues.apache.org/jira/browse/IVY-864
>             Project: Ivy
>          Issue Type: Bug
>            Reporter: James P. White
>         Attachments: http_download_response_patch.txt
>
>
> The HttpClientHander.download and BasicURLHandler.download methods don't bother to check the HTTP response code from the server.  As a result they will put anything that the server sends back as the contents of the artifact.  This isn't so good if it is something like the HTML message for a 404 or 503 and what you wanted was a JAR file.  In fact it is pretty bad because then the cache is poisoned and the user is left with purging the cache as the only solution.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (IVY-864) HTTP Handlers ignore unsuccessful response codes.

Posted by "James P. White (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IVY-864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James P. White updated IVY-864:
-------------------------------

    Attachment: http_download_response_patch.txt

This is a patch to BasicURLHandler and HttpClientHandler so that they will only successfully download a file if the HTTP response code is 2XX.  I think that is pretty much the right thing to do for starters (more elaborate would be dealing with redirection 3XX).

> HTTP Handlers ignore unsuccessful response codes.
> -------------------------------------------------
>
>                 Key: IVY-864
>                 URL: https://issues.apache.org/jira/browse/IVY-864
>             Project: Ivy
>          Issue Type: Bug
>            Reporter: James P. White
>         Attachments: http_download_response_patch.txt
>
>
> The HttpClientHander.download and BasicURLHandler.download methods don't bother to check the HTTP response code from the server.  As a result they will put anything that the server sends back as the contents of the artifact.  This isn't so good if it is something like the HTML message for a 404 or 503 and what you wanted was a JAR file.  In fact it is pretty bad because then the cache is poisoned and the user is left with purging the cache as the only solution.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (IVY-864) HTTP Handlers ignore unsuccessful response codes.

Posted by "Maarten Coene (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IVY-864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maarten Coene resolved IVY-864.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0-RC1
         Assignee: Maarten Coene

I've applied your patch (with some modifications to reuse the code that was already checking the response code).
Please verify that it is still working for you...

Thanks for your contribution

> HTTP Handlers ignore unsuccessful response codes.
> -------------------------------------------------
>
>                 Key: IVY-864
>                 URL: https://issues.apache.org/jira/browse/IVY-864
>             Project: Ivy
>          Issue Type: Bug
>            Reporter: James P. White
>            Assignee: Maarten Coene
>             Fix For: 2.0-RC1
>
>         Attachments: http_download_response_patch.txt
>
>
> The HttpClientHander.download and BasicURLHandler.download methods don't bother to check the HTTP response code from the server.  As a result they will put anything that the server sends back as the contents of the artifact.  This isn't so good if it is something like the HTML message for a 404 or 503 and what you wanted was a JAR file.  In fact it is pretty bad because then the cache is poisoned and the user is left with purging the cache as the only solution.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (IVY-864) HTTP Handlers ignore unsuccessful response codes.

Posted by "Maarten Coene (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IVY-864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12615542#action_12615542 ] 

Maarten Coene commented on IVY-864:
-----------------------------------

Good catch.

Could you tell us where you encountered this problem, because the check already happens in the URLHandler.getURLInfo method.
But adding this check again to the download methods won't be a bad thing indeed.

> HTTP Handlers ignore unsuccessful response codes.
> -------------------------------------------------
>
>                 Key: IVY-864
>                 URL: https://issues.apache.org/jira/browse/IVY-864
>             Project: Ivy
>          Issue Type: Bug
>            Reporter: James P. White
>         Attachments: http_download_response_patch.txt
>
>
> The HttpClientHander.download and BasicURLHandler.download methods don't bother to check the HTTP response code from the server.  As a result they will put anything that the server sends back as the contents of the artifact.  This isn't so good if it is something like the HTML message for a 404 or 503 and what you wanted was a JAR file.  In fact it is pretty bad because then the cache is poisoned and the user is left with purging the cache as the only solution.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.