ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ludwig, Michael" <Michael.Lud...@delphi-mb.de>
Subject ant-contrib: HTTPS <post> and unverifiable certificate
Date Thu, 04 Nov 2010 10:57:04 GMT
I'd like to capture and process the response from the ant-contrib <post> task. There
are two documented ways of capturing the response, neither of which appears to work for me.
Is there anything I'm missing?

Yes, I found out myself. The URL I was posting to was HTTPS with an unverifiable certificate.
It works fine for the simple case:

<!-- vim: set filetype=ant: -->
<project default="post">
  <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
  <!-- für HTTP POST -->
  <target name="post">
    <property name="url" value="http://example.com"/>
    <post to="${url}" verbose="false" property="post.response">
      <!-- verbose="true" logfile="post.log" -->
      <prop name="bla" value="blub"/>
    </post>
    <echo>${post.response}</echo>
  </target>
</project>

Does anyone know if I can instruct the <post> task, or rather the HTTP library it is
using to continue in the face of an unverifiable certificate, in the way curl can be configured
accordingly using the -k/--insecure switch?

When trying the standard <get> task in that situation, I'm getting a javax.net.ssl.SSLHandshakeException.

<project default="get">
  <target name="get">
    <!--
    <property name="url" value="http://example.com"/>
    -->
    <property name="url" value="https://your.unverif.cert.site"/>
    <property name="file" location="get.got"/>
    <get src="${url}" dest="${file}" /><!-- verbose="true" -->
    <concat>
      <filelist files="${file}"/>
    </concat>
  </target>
</project>

This is Java 1.6.

-- 
Michael Ludwig 
Mime
View raw message