This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 187278 - "No Proxy Hosts" not regarded
Summary: "No Proxy Hosts" not regarded
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Options&Settings (show other bugs)
Version: 6.x
Hardware: All All
: P2 normal (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-07 15:32 UTC by Tomas Stupka
Modified: 2010-06-21 12:25 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Stupka 2010-06-07 15:32:08 UTC
taken from #187186

------ Comment #6 From elishae 2010-06-07 04:39:28 (-) [reply] -------

Though there seems to be a bug here.. To me, the root cause seems to be some
where else.

As per my understanding, Proxy Selector should NOT* return a Proxy for the uris
listed in 'No Proxy Hosts' text box. (Correct me if i'm wrong)

Here, the URI I'm trying to connect is an intranet URI and as such does NOT
require a proxy to connect to.

CVS update works fine *as long as* I dont set up the proxy (manual proxy).

These are my observations:

1. After setting up the proxy, the CVS update stops working.

2. Resetting the settings to use NO PROXY does not help either.

3. Recreating the user-dir solves the issue.

So, to me it looks like the code that sets the proxy settings is goofed up some
how. Please verify.

------- Comment #7 From elishae 2010-06-07 05:31:00 (-) [reply] -------

After Examining the Code of NbProxySelector.java, I *guess* that the problem
lies there.

At Line 279:
 dontUseProxy = host.startsWith(start) && host.endsWith(end);

instead, it should be 
 dontUseProxy = host.startsWith(start) || host.endsWith(end);


For, a non-proxy-host pattern:
   *.x matches host.endsWith(end) [but not with host.startsWith]
and 
   x.* matches host.startsWith(start) [but not with host.endsWith]

As this seems to be a global problem with proxy settings, I strongly suggest
that, it should be considered a candidate for pushing in 6.9 Release build.
Comment 1 Jiri Rechtacek 2010-06-07 18:37:01 UTC
Thanks for a hint, I'll look on.
Comment 2 elishae 2010-06-08 04:46:36 UTC
Raising the priority as P2.

This bug disables* Netbeans from talking to intranet sites, which are not served by proxy. (So, IMHO, this is a candidate for P2)

One Available Workaround is : to mention the 'exact' host name of the target host in the non-proxy pattern. When there is no '*' in the pattern, this bug would not appear.
Comment 3 Jiri Rechtacek 2010-06-08 15:01:09 UTC
elishae, your hint breaks a unit test (located in <netbeans-sources>/o.n.core/test/unit/src/org/netbeans/core/DontUseProxyTest.java). Could you look at the test and suggest your test-case for that test? That test fails (after your hint was applied) because www.dummynetbeans.org is regarded as non-proxy host in the case of pattern *.netbeans.org is for non-proxy hosts. Thank you
Comment 4 elishae 2010-06-09 15:14:16 UTC
Ah.. got the issue:
 When * is the first character, start is empty string.
 When * is the last character, end is empty string.

 earlier code was working for www.dummynetbeans.org because the end did not match, whereas start was always matching..
 Instead, the logic should be updated to compare start only when * is not first character. and compare end only when * is not last chararcter

As said earlier, Replace line 279 with below code. And it should satisfy all the test cases.

Code:

//Compare left of * if and only if * is not first character in token
final boolean compareStart = start > 0;
//Compare right of * if and only if * is not the last character in token
final boolean compareEnd = star < token.length();

dontUseProxy = (compareStart && host.startsWith(start)) || (compareEnd && host.endsWith(end));
Comment 5 elishae 2010-06-09 17:13:06 UTC
oops, typo: fix the code as ..

boolean compareStart = star > 0; // not first character

boolean compareEnd = star < (token.length() - 1); // not last character

dontUseProxy = (compareStart && host.startsWith(start)) || (compareEnd &&
host.endsWith(end));
Comment 6 Jiri Rechtacek 2010-06-10 12:46:24 UTC
Thank you for revisited hint, it works now. Please, verify if it works correctly once it will be part of Dev build of NetBeans in a few days. Thanks
core-main/rev/c226d46ee98b
Comment 7 Quality Engineering 2010-06-11 06:53:52 UTC
Integrated into 'main-golden', will be available in build *201006110001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/c226d46ee98b
User: Jiri Rechtacek <jrechtacek@netbeans.org>
Log: #187278:  "No Proxy Hosts" not regarded
Comment 8 rbalada 2010-06-16 08:56:27 UTC
Please verify bugfix for this bug, so it can be included in release691 repository.

Thanks,
-R
Comment 9 Petr Blaha 2010-06-17 11:51:49 UTC
verified
Comment 10 rbalada 2010-06-21 12:25:36 UTC
Transplanted into release691 #d82b0fdff64e