Contributions
Re: Redirect HTTP 301 Location not used correctly (SoapUI 4.5.1)
Hi all, Just a note that this issue can be fixed by adding a line of code in the following class (in this case for 4.5.1, which the application I'm working on is using): https://github.com/SmartBear/soapui/blo ... sport.java The problem rises because all headers of the originating request (I mean: the one that repsonds with a 301) are copied to a new request if the redirect is followed. This also includes the Host header. This is incorrect if the Location header includes a different host in the new URI than the originating request. The new request should have the Host of the new URI. Adding the following to the class above at line 356: getMethod.setHeader("Host",uri.getHost()); Can this be fixed in the source code of SoapUI? Or should I create a pull request for that? And how to deal with this in other versions of SoapUI?10 years agoPlace ReadyAPI QuestionsReadyAPI Questions4.1KViews0likes0CommentsRe: Redirect HTTP 301 Location not used correctly (SoapUI 4.5.1)
Thanks for the quick repsonse Giscard. The FollowRedirects option is set to true. I also tested setting it to false (to check if it does affect anything). This results in not following the 301 at all. So changing the option itself works . But this does not solve the problem. The Location header of the first reponse (the 301 response) points to another URL, with another domain (geodata.nationaalgeoregister.nl) than the original request. SoapUI seems to recognize that it is a 301 redirect, because it creates another HTTP request. This HTTP request does use the correct path of the Location header. But still uses the domain of the first, original request (www.nationaalgeoregister.nl instead of geodata.nationaalgeoregister.nl). It seems like SoapUI is inspecting the value of the Location header and uses only the path of the URL, while it should use the entire URL. I tried it for the following HTTP requests/responses: a 301 : http://www.nationaalgeoregister.nl/geon ... anguage=nl which redirects to: http://geodata.nationaalgeoregister.nl/ ... ik2008.zip a 302 : http://newsonmaps.com/obj/statistiek/gr ... ten/GM0400 this one redirects to http://geodata.nationaalgeoregister.nl/ ... e='GM0400') a 302: http://newsonmaps.com/bgi/ which redirects to http://brentjensgeoict.nl/contact/ In all cases, using wget I do get the correct responses, but using SoapUI the path of the redirect is used, but not the domain. So for the 3rd example, the following HTTP request is sent: http://newsonmaps.com/contact/ instead of: http://brentjensgeoict.nl/contact/ I saw in the HTTP log that a cookie is set, also for the domain. Could this affect the result? And how to solve this?11 years agoPlace ReadyAPI QuestionsReadyAPI Questions4.1KViews0likes0CommentsRedirect HTTP 301 Location not used correctly (SoapUI 4.5.1)
Hi all, SoapUI (version 4.5.1) seems to be changing the Location header information in case a web page returns an HTTP 301 redirect. For example, I have this URL, using an HTTP test: http://www.nationaalgeoregister.nl:80/g ... anguage=nl This returns a 301 with location header (full log info below): HTTP/1.1 301 Moved Permanently Location: http://geodata.nationaalgeoregister.nl/ ... ik2008.zip The location then seems to be changed by SoapUI. Since the next HTTP request, created by SoapUI, is: GET /bestandbodemgebruik2008/extract/bestandbodemgebruik2008.zip Host: www.nationaalgeoregister.nl:80 This host is not correct. It should have been "geodata.nationaalgeoregister.nl", but SoapUI uses the previous host, the one where the initial request is sent to. Can someone confirm this? (Careful: the file which is redirected is quite large!!) If I use wget or a browser it works fine, the 301 Location is followed and returns the file. Below is some more logging information, if required: =============== Fri Feb 07 11:42:17 CET 2014:DEBUG:>> "GET /geonetwork/opensearch/dut/download?spatial_dataset_identifier_code=1339c2c0-ddc2-11de-2008-0800200c9a66&spatial_dataset_identifier_namespace=http://www.pdok.nl&crs=http://www.opengis.net/def/crs/EPSG/0/28992&language=nl HTTP/1.1[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:>> "Accept-Encoding: gzip,deflate[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:>> "Range: bytes=0-999[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:>> "Accept: application/x-compressed[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:>> "Host: www.nationaalgeoregister.nl:80[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:>> "Connection: Keep-Alive[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:>> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:>> "[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:<< "HTTP/1.1 301 Moved Permanently[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:<< "Server: Apache-Coyote/1.1[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:<< "Location: http://geodata.nationaalgeoregister.nl/ ... ik2008.zip[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:<< "Set-Cookie: JSESSIONID=9DED5CA988975A3B76596EB3F91C191C; Domain=www.nationaalgeoregister.nl; Path=/geonetwork/opensearch/dut[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:<< "Content-Encoding: gzip[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:<< "Content-Type: application/x-compressed[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:<< "Content-Length: 20[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:<< "Date: Fri, 07 Feb 2014 10:42:17 GMT[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:<< "[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:<< "[0x1f][0x8b][0x8][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x3][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0]" Fri Feb 07 11:42:17 CET 2014:DEBUG:>> "GET /bestandbodemgebruik2008/extract/bestandbodemgebruik2008.zip HTTP/1.1[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:>> "Accept-Encoding: gzip,deflate[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:>> "Range: bytes=0-999[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:>> "Accept: application/x-compressed[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:>> "Host: www.nationaalgeoregister.nl:80[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:>> "Connection: Keep-Alive[\r][\n]" Fri Feb 07 11:42:17 CET 2014:DEBUG:>> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]"11 years agoPlace ReadyAPI QuestionsReadyAPI Questions5.1KViews0likes4Comments