719wangqi / chrome-rest-client

Automatically exported from code.google.com/p/chrome-rest-client
0 stars 0 forks source link

Improper Link header URL detection #287

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Send a request that will return a Link header with a URL formatted per the 
standard (http://www.w3.org/Protocols/9707-link-header.html)
2. Hover over the URL in the Link header response - note the Advanced REST 
client includes the ">;" as part of the URL.

What is the expected output? What do you see instead?

In this header example, I would expect the string "http://myapi.com/myresource" 
to be highlighted as the URL:

Link: <http://myapi.com/myresource>; rel=myresource

However, the string "http://myapi.com/myresource>;" is actually being 
interpreted as the URL.

On what operating system, browser and browser version?

Mac OSX, Chrome Version 38.0.2125.122

Original issue reported on code.google.com by hill.nic...@gmail.com on 17 Nov 2014 at 9:38

GoogleCodeExporter commented 8 years ago
I have experienced this same problem. Any word yet when this is going to be 
fixed? Link headers are commonly used in REST services.

Original comment by pdj...@gmail.com on 4 Aug 2015 at 11:39

GoogleCodeExporter commented 8 years ago
The Link header URLs are not being parsed correctly due to this regular 
expression in the "RestClient/src/org/rest/client/util/Utils.java" file:

        public static String autoLinkUrls(String input){
                RegExp r = RegExp.compile("(https?:\\/\\/(\\w|\\.)+(\\S+))","gim");
                return r.replace(input, "<a target=\"_blank\" href=\"$1\">$1</a>");
        }

The following should work:

RegExp r = RegExp.compile("(https?:\\/\\/([^\" >]*))","gim");

This will include everything after http(s):// that is not a " or a space or a >

Original comment by pdj...@gmail.com on 4 Aug 2015 at 12:32