continuum-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Dale <robert.d...@duke.edu>
Subject problem with adding https M2 pom.xml
Date Wed, 13 Dec 2006 20:04:35 GMT
When I try to add a new Maven 2 project using https in the M2 POM Url,
I get the following error:

    Continuum Error
    Could not download https://mydomain.org/repos/project/trunk/pom.xml:
    Server returned HTTP response code: 401 for URL: 
https://mydomain.org/repos/project/trunk/pom.xml
    Check the logs for more details. 

However, in reality, it does work!  Mostly...

So I turned on javax.net debugging and discovered that the underlying 
mechanism
actually connects 3 times successfully before making a final attempt not 
using Auth Basic which causes it to fail.

The other part of it is that when it does connect successfully, for some 
reason it closes the connection prematurely
which is probably why it thinks those attempts failed.

You can see here one of the semi-successfull connects, but with the 
premature socket closing:

INFO   | jvm 1    | 2006/12/13 10:09:41 | SocketListener0-1, READ: TLSv1 
Application Data, length = 242
INFO   | jvm 1    | 2006/12/13 10:09:41 | Padded plaintext after 
DECRYPTION:  len = 242
INFO   | jvm 1    | 2006/12/13 10:09:41 | 0000: 48 54 54 50 2F 31 2E 31 20 
32 30 30 20 4F 4B 0D  HTTP/1.1 200 OK.
INFO   | jvm 1    | 2006/12/13 10:09:41 | 0010: 0A 44 61 74 65 3A 20 57 65 
64 2C 20 31 33 20 44  .Date: Wed, 13 D
INFO   | jvm 1    | 2006/12/13 10:09:41 | 0020: 65 63 20 32 30 30 36 20 31 
34 3A 34 37 3A 33 33  ec 2006 14:47:33
INFO   | jvm 1    | 2006/12/13 10:09:41 | 0030: 20 47 4D 54 0D 0A 53 65 72 
76 65 72 3A 20 41 70   GMT..Server: Ap
INFO   | jvm 1    | 2006/12/13 10:09:41 | 0040: 61 63 68 65 2F 32 2E 30 2E 
35 32 20 28 52 65 64  ache/2.0.52 (Red
INFO   | jvm 1    | 2006/12/13 10:09:41 | 0050: 20 48 61 74 29 0D 0A 45 54 
61 67 3A 20 22 32 36   Hat)..ETag: "26
INFO   | jvm 1    | 2006/12/13 10:09:41 | 0060: 34 34 2F 2F 52 53 53 2F 74 
72 75 6E 6B 2F 70 6F  44//xxx/trunk/po
INFO   | jvm 1    | 2006/12/13 10:09:41 | 0070: 6D 2E 78 6D 6C 22 0D 0A 41 
63 63 65 70 74 2D 52  m.xml"..Accept-R
INFO   | jvm 1    | 2006/12/13 10:09:41 | 0080: 61 6E 67 65 73 3A 20 62 79 
74 65 73 0D 0A 43 6F  anges: bytes..Co
INFO   | jvm 1    | 2006/12/13 10:09:41 | 0090: 6E 74 65 6E 74 2D 4C 65 6E 
67 74 68 3A 20 31 34  ntent-Length: 14
INFO   | jvm 1    | 2006/12/13 10:09:41 | 00A0: 38 33 0D 0A 43 6F 6E 6E 65 
63 74 69 6F 6E 3A 20  83..Connection: 
INFO   | jvm 1    | 2006/12/13 10:09:41 | 00B0: 63 6C 6F 73 65 0D 0A 43 6F 
6E 74 65 6E 74 2D 54  close..Content-T
INFO   | jvm 1    | 2006/12/13 10:09:41 | 00C0: 79 70 65 3A 20 74 65 78 74 
2F 70 6C 61 69 6E 3B  ype: text/plain;
INFO   | jvm 1    | 2006/12/13 10:09:41 | 00D0: 20 63 68 61 72 73 65 74 3D 
55 54 46 2D 38 0D 0A   charset=UTF-8..
INFO   | jvm 1    | 2006/12/13 10:09:41 | 00E0: 0D 0A 80 5E 1A D7 1C 1B B6 
0F E5 63 76 1D 27 D9  ...^.......cv.'.
INFO   | jvm 1    | 2006/12/13 10:09:41 | 00F0: 3B 3B     ;;
INFO   | jvm 1    | 2006/12/13 10:09:41 | SocketListener0-1, called 
close()
INFO   | jvm 1    | 2006/12/13 10:09:41 | SocketListener0-1, called 
closeInternal(true)
INFO   | jvm 1    | 2006/12/13 10:09:41 | SocketListener0-1, SEND TLSv1 
ALERT:  warning, description = close_notify

I wrote a piece of code which does a simple connect and retrieves the 
file.  It does so successfully and the header looks
the same as the above with the exception that it actually downloads the 
file.  Both use the same keystore, same url,
same user, same password.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

public class Foo {

        public static String readString(final InputStream is) throws 
IOException {
                String tmpStr;
                final StringBuilder sb = new StringBuilder();
                final BufferedReader reader = new BufferedReader(new 
InputStreamReader(is));
                while ((tmpStr = reader.readLine()) != null) {
                        sb.append(tmpStr).append('\n');
                }
                return sb.toString();
        }

        public static void main(String[] args) throws Exception {
                URL url = new URL(
"https://mydomain.org/repos/project/trunk/pom.xml");
                URLConnection conn = url.openConnection();
                String encoding = new sun.misc.BASE64Encoder().encode(
"user:pass".getBytes());
                conn.setRequestProperty("Authorization", "Basic " + 
encoding);
                InputStream istream = conn.getInputStream();
                String foo = readString(istream);
                istream.close();
                System.out.println(foo);

        }
}
 
-- 
Robert Dale

Mime
View raw message