TCP tunneling through authenticating HTTP proxy

2012-10-25 Thread Vasiliy Baranov

Greetings,

And apologies if I am sending this to the wrong list...

Suppose I want my code to talk to a TCP server via an HTTP proxy, by 
setting up a proxy tunnel using the CONNECT method. By any chance, is 
there a mechanism in the Java SE networking stack that would allow me to 
do so? A mechanism that would handle proxy selection, tunneling, and, 
most importantly, authentication identically to HttpURLconnection?


If there is no such mechanism in JDK 7, could such a mechanism be added 
in JDK 8?


FWIW, proxy selection and tunneling through non-authenticating proxy is 
not too difficult to implement with ProxySelector and plain Sockets, 
using sun.net.www.protocol.http.HttpURLConnection.plainConnect as a 
reference. My code does so already.


Proxy authentication, however, is a totally different story. If I parse 
JDK code correctly, client code that does not use HttpURLConnection is 
unlikely to be able to integrate nicely with the AuthCacheValue cache or 
handle complex authentication schemes, unless it chooses to depend on 
some JDK-internal APIs and duplicate great amount of JDK code. My code 
probably cannot afford the latter two, that is why I am asking for help 
here on this list. Since I have proxy selection and non-authenticated 
tunneling already implemented, in my case it would actually be 
sufficient to only have some JDK support for proper integration with the 
AuthCacheValue cache and the standard authentication schemes. However, I 
gather a more universal HTTP tunneling facility, something that works 
like HttpURLConnection but skips the final HTTP handshake with the end 
server, is likely to be a cleaner solution.


If it matters, I am asking this in the context of adding support for 
WebSockets to JavaFX WebView: http://javafx-jira.kenai.com/browse/RT-14947


Thank you in advance,
-- Vasiliy


Re: TCP tunneling through authenticating HTTP proxy

2012-10-25 Thread Michael McMahon

There is a JSR for websockets, and they are doing a reference implementation
based on JDK 7 I believe.

As regards TCP sockets via Http proxies, JDK doesn't support that.
The closest thing is probably SOCKS. Can you use that?

- Michael

On 25/10/12 14:32, Vasiliy Baranov wrote:

Greetings,

And apologies if I am sending this to the wrong list...

Suppose I want my code to talk to a TCP server via an HTTP proxy, by 
setting up a proxy tunnel using the CONNECT method. By any chance, is 
there a mechanism in the Java SE networking stack that would allow me 
to do so? A mechanism that would handle proxy selection, tunneling, 
and, most importantly, authentication identically to HttpURLconnection?


If there is no such mechanism in JDK 7, could such a mechanism be 
added in JDK 8?


FWIW, proxy selection and tunneling through non-authenticating proxy 
is not too difficult to implement with ProxySelector and plain 
Sockets, using 
sun.net.www.protocol.http.HttpURLConnection.plainConnect as a 
reference. My code does so already.


Proxy authentication, however, is a totally different story. If I 
parse JDK code correctly, client code that does not use 
HttpURLConnection is unlikely to be able to integrate nicely with the 
AuthCacheValue cache or handle complex authentication schemes, unless 
it chooses to depend on some JDK-internal APIs and duplicate great 
amount of JDK code. My code probably cannot afford the latter two, 
that is why I am asking for help here on this list. Since I have proxy 
selection and non-authenticated tunneling already implemented, in my 
case it would actually be sufficient to only have some JDK support for 
proper integration with the AuthCacheValue cache and the standard 
authentication schemes. However, I gather a more universal HTTP 
tunneling facility, something that works like HttpURLConnection but 
skips the final HTTP handshake with the end server, is likely to be a 
cleaner solution.


If it matters, I am asking this in the context of adding support for 
WebSockets to JavaFX WebView: 
http://javafx-jira.kenai.com/browse/RT-14947


Thank you in advance,
-- Vasiliy




Re: TCP tunneling through authenticating HTTP proxy

2012-10-25 Thread Damjan Jovanovic
Guys, there was a patch for this feature (use of HTTP proxies with
CONNECT request in java.net.Socket) floating around in February/March
2010, the latest version of which is at
http://mail.openjdk.java.net/pipermail/net-dev/2010-March/001642.html

I helped write it so let me know if you need any help.

Regards
Damjan

On Thu, Oct 25, 2012 at 3:53 PM, Michael McMahon
 wrote:
> There is a JSR for websockets, and they are doing a reference implementation
> based on JDK 7 I believe.
>
> As regards TCP sockets via Http proxies, JDK doesn't support that.
> The closest thing is probably SOCKS. Can you use that?
>
> - Michael
>
>
> On 25/10/12 14:32, Vasiliy Baranov wrote:
>>
>> Greetings,
>>
>> And apologies if I am sending this to the wrong list...
>>
>> Suppose I want my code to talk to a TCP server via an HTTP proxy, by
>> setting up a proxy tunnel using the CONNECT method. By any chance, is there
>> a mechanism in the Java SE networking stack that would allow me to do so? A
>> mechanism that would handle proxy selection, tunneling, and, most
>> importantly, authentication identically to HttpURLconnection?
>>
>> If there is no such mechanism in JDK 7, could such a mechanism be added in
>> JDK 8?
>>
>> FWIW, proxy selection and tunneling through non-authenticating proxy is
>> not too difficult to implement with ProxySelector and plain Sockets, using
>> sun.net.www.protocol.http.HttpURLConnection.plainConnect as a reference. My
>> code does so already.
>>
>> Proxy authentication, however, is a totally different story. If I parse
>> JDK code correctly, client code that does not use HttpURLConnection is
>> unlikely to be able to integrate nicely with the AuthCacheValue cache or
>> handle complex authentication schemes, unless it chooses to depend on some
>> JDK-internal APIs and duplicate great amount of JDK code. My code probably
>> cannot afford the latter two, that is why I am asking for help here on this
>> list. Since I have proxy selection and non-authenticated tunneling already
>> implemented, in my case it would actually be sufficient to only have some
>> JDK support for proper integration with the AuthCacheValue cache and the
>> standard authentication schemes. However, I gather a more universal HTTP
>> tunneling facility, something that works like HttpURLConnection but skips
>> the final HTTP handshake with the end server, is likely to be a cleaner
>> solution.
>>
>> If it matters, I am asking this in the context of adding support for
>> WebSockets to JavaFX WebView: http://javafx-jira.kenai.com/browse/RT-14947
>>
>> Thank you in advance,
>> -- Vasiliy
>
>


Re: TCP tunneling through authenticating HTTP proxy

2012-10-25 Thread Vasiliy Baranov

On 25.10.2012 17:53, Michael McMahon wrote:

There is a JSR for websockets, and they are doing a reference
implementation
based on JDK 7 I believe.


Yes, we are aware of that effort, that is JSR 356, but we are unlikely 
to be able to make use of the implementation. First, it looks like their 
client side APIs are not going to be included in Java EE 7. Second, the 
scope of JSR 356 is Java EE, whereas we JavaFX ship with the JDK. Third, 
we don't need WebSocket implementation per se. The WebSocket protocol is 
already implemented in WebKit - the web browser engine that backs 
WebView - and that implementation is shared by all WebKit-based browsers 
including Chrome and Safari, which means we will probably want to stick 
with it for a while. For what it is worth, we already have WebSockets 
implemented in WebView, except for tunneling through authenticating 
proxies. Finally, the WebKit's architecture for WebSockets is not very 
pluggable, so even if we had WebSockets in JDK, it would be a major 
undertaking to hack WebKit to use them.



As regards TCP sockets via Http proxies, JDK doesn't support that.
The closest thing is probably SOCKS. Can you use that?


WebView needs to support both HTTP and SOCKS proxies.

Thank you,
-- Vasiliy


On 25/10/12 14:32, Vasiliy Baranov wrote:

Greetings,

And apologies if I am sending this to the wrong list...

Suppose I want my code to talk to a TCP server via an HTTP proxy, by
setting up a proxy tunnel using the CONNECT method. By any chance, is
there a mechanism in the Java SE networking stack that would allow me
to do so? A mechanism that would handle proxy selection, tunneling,
and, most importantly, authentication identically to HttpURLconnection?

If there is no such mechanism in JDK 7, could such a mechanism be
added in JDK 8?

FWIW, proxy selection and tunneling through non-authenticating proxy
is not too difficult to implement with ProxySelector and plain
Sockets, using
sun.net.www.protocol.http.HttpURLConnection.plainConnect as a
reference. My code does so already.

Proxy authentication, however, is a totally different story. If I
parse JDK code correctly, client code that does not use
HttpURLConnection is unlikely to be able to integrate nicely with the
AuthCacheValue cache or handle complex authentication schemes, unless
it chooses to depend on some JDK-internal APIs and duplicate great
amount of JDK code. My code probably cannot afford the latter two,
that is why I am asking for help here on this list. Since I have proxy
selection and non-authenticated tunneling already implemented, in my
case it would actually be sufficient to only have some JDK support for
proper integration with the AuthCacheValue cache and the standard
authentication schemes. However, I gather a more universal HTTP
tunneling facility, something that works like HttpURLConnection but
skips the final HTTP handshake with the end server, is likely to be a
cleaner solution.

If it matters, I am asking this in the context of adding support for
WebSockets to JavaFX WebView:
http://javafx-jira.kenai.com/browse/RT-14947

Thank you in advance,
-- Vasiliy






Re: TCP tunneling through authenticating HTTP proxy

2012-10-25 Thread Vasiliy Baranov

Hi Damjan,

This looks like exactly what I need. Thank you for sharing!

Now perhaps the question is whether this feature can be or already is 
included in the JDK or I am on my own to hack something together based 
on this patch.


Thank you,
-- Vasiliy

On 25.10.2012 18:29, Damjan Jovanovic wrote:

Guys, there was a patch for this feature (use of HTTP proxies with
CONNECT request in java.net.Socket) floating around in February/March
2010, the latest version of which is at
http://mail.openjdk.java.net/pipermail/net-dev/2010-March/001642.html

I helped write it so let me know if you need any help.

Regards
Damjan

On Thu, Oct 25, 2012 at 3:53 PM, Michael McMahon
  wrote:

There is a JSR for websockets, and they are doing a reference implementation
based on JDK 7 I believe.

As regards TCP sockets via Http proxies, JDK doesn't support that.
The closest thing is probably SOCKS. Can you use that?

- Michael


On 25/10/12 14:32, Vasiliy Baranov wrote:


Greetings,

And apologies if I am sending this to the wrong list...

Suppose I want my code to talk to a TCP server via an HTTP proxy, by
setting up a proxy tunnel using the CONNECT method. By any chance, is there
a mechanism in the Java SE networking stack that would allow me to do so? A
mechanism that would handle proxy selection, tunneling, and, most
importantly, authentication identically to HttpURLconnection?

If there is no such mechanism in JDK 7, could such a mechanism be added in
JDK 8?

FWIW, proxy selection and tunneling through non-authenticating proxy is
not too difficult to implement with ProxySelector and plain Sockets, using
sun.net.www.protocol.http.HttpURLConnection.plainConnect as a reference. My
code does so already.

Proxy authentication, however, is a totally different story. If I parse
JDK code correctly, client code that does not use HttpURLConnection is
unlikely to be able to integrate nicely with the AuthCacheValue cache or
handle complex authentication schemes, unless it chooses to depend on some
JDK-internal APIs and duplicate great amount of JDK code. My code probably
cannot afford the latter two, that is why I am asking for help here on this
list. Since I have proxy selection and non-authenticated tunneling already
implemented, in my case it would actually be sufficient to only have some
JDK support for proper integration with the AuthCacheValue cache and the
standard authentication schemes. However, I gather a more universal HTTP
tunneling facility, something that works like HttpURLConnection but skips
the final HTTP handshake with the end server, is likely to be a cleaner
solution.

If it matters, I am asking this in the context of adding support for
WebSockets to JavaFX WebView: http://javafx-jira.kenai.com/browse/RT-14947

Thank you in advance,
-- Vasiliy







Re: TCP tunneling through authenticating HTTP proxy

2012-10-25 Thread Chris Hegarty

Wow, I forgot just how far we got with this.

Let me refresh myself with this work and I'll get to the list shortly.

-Chris.

On 25/10/2012 16:14, Vasiliy Baranov wrote:

Hi Damjan,

This looks like exactly what I need. Thank you for sharing!

Now perhaps the question is whether this feature can be or already is
included in the JDK or I am on my own to hack something together based
on this patch.

Thank you,
-- Vasiliy

On 25.10.2012 18:29, Damjan Jovanovic wrote:

Guys, there was a patch for this feature (use of HTTP proxies with
CONNECT request in java.net.Socket) floating around in February/March
2010, the latest version of which is at
http://mail.openjdk.java.net/pipermail/net-dev/2010-March/001642.html

I helped write it so let me know if you need any help.

Regards
Damjan

On Thu, Oct 25, 2012 at 3:53 PM, Michael McMahon
 wrote:

There is a JSR for websockets, and they are doing a reference
implementation
based on JDK 7 I believe.

As regards TCP sockets via Http proxies, JDK doesn't support that.
The closest thing is probably SOCKS. Can you use that?

- Michael


On 25/10/12 14:32, Vasiliy Baranov wrote:


Greetings,

And apologies if I am sending this to the wrong list...

Suppose I want my code to talk to a TCP server via an HTTP proxy, by
setting up a proxy tunnel using the CONNECT method. By any chance,
is there
a mechanism in the Java SE networking stack that would allow me to
do so? A
mechanism that would handle proxy selection, tunneling, and, most
importantly, authentication identically to HttpURLconnection?

If there is no such mechanism in JDK 7, could such a mechanism be
added in
JDK 8?

FWIW, proxy selection and tunneling through non-authenticating proxy is
not too difficult to implement with ProxySelector and plain Sockets,
using
sun.net.www.protocol.http.HttpURLConnection.plainConnect as a
reference. My
code does so already.

Proxy authentication, however, is a totally different story. If I parse
JDK code correctly, client code that does not use HttpURLConnection is
unlikely to be able to integrate nicely with the AuthCacheValue
cache or
handle complex authentication schemes, unless it chooses to depend
on some
JDK-internal APIs and duplicate great amount of JDK code. My code
probably
cannot afford the latter two, that is why I am asking for help here
on this
list. Since I have proxy selection and non-authenticated tunneling
already
implemented, in my case it would actually be sufficient to only have
some
JDK support for proper integration with the AuthCacheValue cache and
the
standard authentication schemes. However, I gather a more universal
HTTP
tunneling facility, something that works like HttpURLConnection but
skips
the final HTTP handshake with the end server, is likely to be a cleaner
solution.

If it matters, I am asking this in the context of adding support for
WebSockets to JavaFX WebView:
http://javafx-jira.kenai.com/browse/RT-14947

Thank you in advance,
-- Vasiliy







hg: jdk8/tl/langtools: 7200915: convert TypeTags from a series of small ints to an enum

2012-10-25 Thread jonathan . gibbons
Changeset: c002fdee76fd
Author:jjg
Date:  2012-10-25 11:09 -0700
URL:   http://hg.openjdk.java.net/jdk8/tl/langtools/rev/c002fdee76fd

7200915: convert TypeTags from a series of small ints to an enum
Reviewed-by: jjg, mcimadamore
Contributed-by: vicente.rom...@oracle.com

! src/share/classes/com/sun/tools/javac/code/Attribute.java
! src/share/classes/com/sun/tools/javac/code/Kinds.java
! src/share/classes/com/sun/tools/javac/code/Printer.java
! src/share/classes/com/sun/tools/javac/code/Symbol.java
! src/share/classes/com/sun/tools/javac/code/Symtab.java
! src/share/classes/com/sun/tools/javac/code/Type.java
+ src/share/classes/com/sun/tools/javac/code/TypeTag.java
- src/share/classes/com/sun/tools/javac/code/TypeTags.java
! src/share/classes/com/sun/tools/javac/code/Types.java
! src/share/classes/com/sun/tools/javac/comp/Annotate.java
! src/share/classes/com/sun/tools/javac/comp/Attr.java
! src/share/classes/com/sun/tools/javac/comp/Check.java
! src/share/classes/com/sun/tools/javac/comp/ConstFold.java
! src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
! src/share/classes/com/sun/tools/javac/comp/Enter.java
! src/share/classes/com/sun/tools/javac/comp/Flow.java
! src/share/classes/com/sun/tools/javac/comp/Infer.java
! src/share/classes/com/sun/tools/javac/comp/Lower.java
! src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
! src/share/classes/com/sun/tools/javac/comp/Resolve.java
! src/share/classes/com/sun/tools/javac/comp/TransTypes.java
! src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
! src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
! src/share/classes/com/sun/tools/javac/jvm/Code.java
! src/share/classes/com/sun/tools/javac/jvm/Gen.java
! src/share/classes/com/sun/tools/javac/jvm/UninitializedType.java
! src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
! src/share/classes/com/sun/tools/javac/model/JavacElements.java
! src/share/classes/com/sun/tools/javac/parser/JavacParser.java
! src/share/classes/com/sun/tools/javac/tree/JCTree.java
! src/share/classes/com/sun/tools/javac/tree/Pretty.java
! src/share/classes/com/sun/tools/javac/tree/TreeInfo.java
! src/share/classes/com/sun/tools/javac/tree/TreeMaker.java
! src/share/classes/com/sun/tools/javac/util/Constants.java
! src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java
! src/share/classes/com/sun/tools/javadoc/AnnotationValueImpl.java
! src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
! src/share/classes/com/sun/tools/javadoc/FieldDocImpl.java
! src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java
! src/share/classes/com/sun/tools/javadoc/ParameterizedTypeImpl.java
! src/share/classes/com/sun/tools/javadoc/TypeMaker.java
! test/tools/javac/6889255/T6889255.java
! test/tools/javac/tree/MakeLiteralTest.java



Re: TCP tunneling through authenticating HTTP proxy

2012-10-25 Thread Damjan Jovanovic
Hi Vasiliy

It's not included in the JDK, you have to either patch and compile
OpenJDK on your side, or if that's not an option, use that hack with
sun.net.* classes that I posted before
(http://mail.openjdk.java.net/pipermail/net-dev/2010-February/001569.html).

Regards
Damjan

On Thu, Oct 25, 2012 at 5:14 PM, Vasiliy Baranov
 wrote:
> Hi Damjan,
>
> This looks like exactly what I need. Thank you for sharing!
>
> Now perhaps the question is whether this feature can be or already is
> included in the JDK or I am on my own to hack something together based on
> this patch.
>
> Thank you,
> -- Vasiliy
>
>
> On 25.10.2012 18:29, Damjan Jovanovic wrote:
>>
>> Guys, there was a patch for this feature (use of HTTP proxies with
>> CONNECT request in java.net.Socket) floating around in February/March
>> 2010, the latest version of which is at
>> http://mail.openjdk.java.net/pipermail/net-dev/2010-March/001642.html
>>
>> I helped write it so let me know if you need any help.
>>
>> Regards
>> Damjan
>>
>> On Thu, Oct 25, 2012 at 3:53 PM, Michael McMahon
>>   wrote:
>>>
>>> There is a JSR for websockets, and they are doing a reference
>>> implementation
>>> based on JDK 7 I believe.
>>>
>>> As regards TCP sockets via Http proxies, JDK doesn't support that.
>>> The closest thing is probably SOCKS. Can you use that?
>>>
>>> - Michael
>>>
>>>
>>> On 25/10/12 14:32, Vasiliy Baranov wrote:


 Greetings,

 And apologies if I am sending this to the wrong list...

 Suppose I want my code to talk to a TCP server via an HTTP proxy, by
 setting up a proxy tunnel using the CONNECT method. By any chance, is
 there
 a mechanism in the Java SE networking stack that would allow me to do
 so? A
 mechanism that would handle proxy selection, tunneling, and, most
 importantly, authentication identically to HttpURLconnection?

 If there is no such mechanism in JDK 7, could such a mechanism be added
 in
 JDK 8?

 FWIW, proxy selection and tunneling through non-authenticating proxy is
 not too difficult to implement with ProxySelector and plain Sockets,
 using
 sun.net.www.protocol.http.HttpURLConnection.plainConnect as a reference.
 My
 code does so already.

 Proxy authentication, however, is a totally different story. If I parse
 JDK code correctly, client code that does not use HttpURLConnection is
 unlikely to be able to integrate nicely with the AuthCacheValue cache or
 handle complex authentication schemes, unless it chooses to depend on
 some
 JDK-internal APIs and duplicate great amount of JDK code. My code
 probably
 cannot afford the latter two, that is why I am asking for help here on
 this
 list. Since I have proxy selection and non-authenticated tunneling
 already
 implemented, in my case it would actually be sufficient to only have
 some
 JDK support for proper integration with the AuthCacheValue cache and the
 standard authentication schemes. However, I gather a more universal HTTP
 tunneling facility, something that works like HttpURLConnection but
 skips
 the final HTTP handshake with the end server, is likely to be a cleaner
 solution.

 If it matters, I am asking this in the context of adding support for
 WebSockets to JavaFX WebView:
 http://javafx-jira.kenai.com/browse/RT-14947

 Thank you in advance,
 -- Vasiliy
>>>
>>>
>>>
>


hg: jdk8/tl/langtools: 6725230: Java Compilation with Jsr199 ignores Class-Path in manifest

2012-10-25 Thread jonathan . gibbons
Changeset: ea2616a6bd01
Author:jjg
Date:  2012-10-25 13:33 -0700
URL:   http://hg.openjdk.java.net/jdk8/tl/langtools/rev/ea2616a6bd01

6725230: Java Compilation with Jsr199 ignores Class-Path in manifest
Reviewed-by: jjg, mcimadamore
Contributed-by: vicente.rom...@oracle.com

! src/share/classes/com/sun/tools/javac/file/Locations.java
+ test/tools/javac/Paths/TestCompileJARInClassPath.java