sahaya / rest-assured

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

If the baseURI contains an underscore _ character the entire domain gets ignored. #180

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. RestAssured.baseURI = "http://sub_domain.example.com";
2. Response res = get("test");
3. Receive the error org.apache.http.client.ClientProtocolException: URI does 
not specify a valid host name: http:/rest/test

What is the expected output? What do you see instead?
The expected output is that the program tests the REST resource. But it seems 
that the entire domain gets removed from the URI.

What version of the product are you using? On what operating system?
Version 1.6.2, Windows 7. (using the maven artifact 
com.jayway.restassured:rest-assured)

Please provide any additional information below.
1. Try to execute the attached Java source file.
2. You will receive a org.apache.http.client.ClientProtocolException: URI does 
not specify a valid host name: http:/rest/test exception.
3. Remove the underscore from the baseURI (therefore setting it to 
"http://subdomain.example.com")
4. You will now receive the expected UnknownHostException (because 
subdomain.example.com does not exist of course).

Original issue reported on code.google.com by bernhard...@gmail.com on 17 Jun 2012 at 6:41

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for reporting

Original comment by johan.ha...@gmail.com on 18 Jun 2012 at 5:40

GoogleCodeExporter commented 9 years ago
Any solution to use an hostname with underscore ?

Original comment by cha...@gmail.com on 29 Nov 2012 at 10:53

GoogleCodeExporter commented 9 years ago
Nope yet afaik. The best way I can think of as a work-around would be by using 
path parameters (not sure if that'll work either though):

get("{host}/test", myHost);

If this doesn't work either let me know. 

And of course if it's important to you and you want an urgent fix then please 
help out and with a pull request.

Original comment by johan.ha...@gmail.com on 30 Nov 2012 at 5:26

GoogleCodeExporter commented 9 years ago
Thanks Johan for your help.

Sorry but my question in not at the good place ! In fact I try to access an 
address with an hostname including a not allowed character (underscore for 
example) using HTTPClient in Java language (not JSON)... Sorry for that.

Anyway, it would be normal to access hostname with underscore in its name 
because internet nagicators allow it. So it's just to suppress the test if the 
hostname is valid or not according to RFC952 rules (in that case, a warning can 
be returned to warn that the hostname is not valid according the rule...

Thanks again.

Original comment by cha...@gmail.com on 7 Dec 2012 at 9:25

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Could you please provide me with an example URL that works that has an _ in its 
domain name so that I can try it out?

Original comment by johan.ha...@gmail.com on 19 Nov 2013 at 6:58

GoogleCodeExporter commented 9 years ago
I use HTTPclient in java, and I try to access my alarm (Somfy) via the hostname 
(instead of the ip address). For example http://toto_titi.alarmesomfy.net 
generate an error but http://tototiti.alarmesomfy.net is working.

The problem is that the underscore character is valid in the rules...

Original comment by cha...@gmail.com on 20 Nov 2013 at 6:52

GoogleCodeExporter commented 9 years ago

Original comment by johan.ha...@gmail.com on 20 Nov 2013 at 8:31

GoogleCodeExporter commented 9 years ago
Please try the latest snapshot, 1.8.2-SNAPSHOT after having added the following 
repo:

<repositories>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <snapshots />
        </repository>
</repositories>

Original comment by johan.ha...@gmail.com on 21 Nov 2013 at 6:34