[ 
https://issues.apache.org/jira/browse/NETBEANS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16243744#comment-16243744
 ] 

ASF GitHub Bot commented on NETBEANS-96:
----------------------------------------

lbruun commented on a change in pull request #161: [NETBEANS-96] New PAC Script 
evaluation environment
URL: https://github.com/apache/incubator-netbeans/pull/161#discussion_r149638473
 
 

 ##########
 File path: 
core.network/src/org/netbeans/core/network/utils/hname/win/HostnameUtilsWin.java
 ##########
 @@ -0,0 +1,110 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.core.network.utils.hname.win;
+
+import com.sun.jna.Native;
+import com.sun.jna.platform.win32.Kernel32Util;
+import com.sun.jna.platform.win32.Win32Exception;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.core.network.utils.IpAddressUtils;
+import org.netbeans.core.network.utils.NativeException;
+
+/**
+ * Hostname utilities for Microsoft Windows OS.
+ */
+public class HostnameUtilsWin {
+    
+    private static final Logger LOGGER = 
Logger.getLogger(HostnameUtilsWin.class.getName());
+    
+    /**
+     * Gets the computer name.
+     * 
+     * <p>This is the also known as the NetBIOS name, although NetBIOS is 
+     * hardly used anymore. It is the same value as can be seen from the
+     * {@code COMPUTERNAME} environment variable.
+     * 
+     * <p>
+     * Windows API equivalent: {@code GetComputerName()} function from 
+     * {@code Kernel32} library.
+     * 
+     * @return computer name
+     * @throws NativeException if there was an error executing the
+     *    system call.
+     */
+    public static String getComputerName() throws NativeException {
 
 Review comment:
   True, that it is not used in *my* implementation. I used to use it, but then 
I switched to using `getHostName` instead.  There are pros and cons on these 
two Win32 methods and someone implementing differently than me may feel 
differently about it. So I kept it.
   
   The dependency on JNA Platform will come back with a vengeance in the next 
iterations on the module where I improve further on the module. So no point in 
removing it now. Remember, as it says in the top text: The improved PAC script 
evaluator is just the beginning. To give you a taste: The next steps will for 
example add vastly improved config discovery and for this JNA Platform is 
needed. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> New PAC Script evaluator
> ------------------------
>
>                 Key: NETBEANS-96
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-96
>             Project: NetBeans
>          Issue Type: Improvement
>            Reporter: lbruun
>              Labels: pull-request-available
>
> The current [PAC script|https://en.wikipedia.org/wiki/Proxy_auto-config] 
> evaluator (in {{core.network}}) was developed pre-Nashorn and has a few 
> problems:
> * It simply fails with Nashorn - but not with Rhino - if the downloaded 
> script uses {{isInNet()}}. This was reported in [Bug 
> 245116|https://netbeans.org/bugzilla/show_bug.cgi?id=245116]. It fails 
> silently in this case and defaults to no proxy. The user will never know the 
> reason - not even by looking in the message log - that there was an error.
> * It doesn't  implement two mandatory JavaScript helper methods, 
> {{dnsResolve()}} and {{myIpAddress()}}. This is a known issue. This causes 
> many PAC scripts to silently fail. 
> * It doesn't implement Microsoft's IPv6-aware additions to the PAC standard. 
> This is a problem in MS shops because they will have designed their PAC 
> script to be compatible with MS IE and MS Edge (which unsurprisingly support 
> these functions .. as do Chrome).
> * It uses a small JavaScript helper, {{nsProxyAutoConfig.js}}, which uses a 
> license which is not compatible with Apache. This is described in NETBEANS-4.
> * Isn't executing the downloaded PAC script in a sandboxed environment. (The 
> PAC script should be treated as hostile because the download may have been 
> spoofed. Browsers indeed treat the PAC script as hostile and so should 
> NetBeans).
> Pull Request with a new implementation is on its way.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to