Did some debugging and digging and came up with this... It's fixed in subversion ;)
r432666 | carlos | 2006-08-18 14:04:40 -0400 (Fri, 18 Aug 2006) | 1 line [CONTINUUM-747] Continuum can't add a project with pom in https with authentication Thanks, -- Robert Dale "Jesse McConnell" <[EMAIL PROTECTED]> 12/15/2006 08:28 AM Please respond to [email protected] To [email protected] cc Subject Re: problem with adding https M2 pom.xml Are you interested in tracking this down into the actual plexus code and patching it there to work for your case? its been a year since I patched that up to work with a cert protected https svn repo I was working with at the time and it appears that you have something else going on here. pretty sure this would be in the MungedUrl in plexus-formica jesse On 12/13/06, Robert Dale <[EMAIL PROTECTED]> wrote: > 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 > -- jesse mcconnell [EMAIL PROTECTED]
