Pipe in redirect url cause Illegal character error


i have redirection with pipes in url and it causes Illegal character error. I try to change param useRawUrl to true or false and it doesnt help.

Example headers and error:

Response DefaultHttpResponse(chunked: false)
HTTP/1.1 302 Found
Content-Type: text/html;charset=UTF-8
Content-Language: pl-PL
Pragma: no-cache
Cache-Control: no-cache, max-age=0, must-revalidate
Location: http://example/show|C|21732?showResult=true
Content-Length: 0
Server: Jetty(7.x.y-SNAPSHOT)

java.lang.IllegalArgumentException: Illegal character in path at index …
at java.net.URI.create(Unknown Source)
at com.ning.http.util.AsyncHttpProviderUtils.getRedirectUri(AsyncHttpProviderUtils.java:260)
at io.gatling.http.ahc.AsyncHandlerActor.redirect$1(AsyncHandlerActor.scala:135)
at io.gatling.http.ahc.AsyncHandlerActor.io$gatling$http$ahc$AsyncHandlerActor$$processResponse(AsyncHandlerActor.scala:173)
at io.gatling.http.ahc.AsyncHandlerActor$$anonfun$receive$1.applyOrElse(AsyncHandlerActor.scala:55)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425)
at akka.actor.ActorCell.invoke(ActorCell.scala:386)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230)
at akka.dispatch.Mailbox.run(Mailbox.scala:212)
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:506)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.net.URISyntaxException: Illegal character in path at …
at java.net.URI$Parser.checkChars(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.(Unknown Source)
… 14 more

How can i deal with it? I dont want to use disableFollowRedirect because i have to many request.

Im using 2.0.0-M3a version.


I’ll be frank: you shouldn’t have those pipes! Those are illegal in regards to the RFC for W3C and they should be encoded.
The real culprits here are browsers that accept crappy implementations, so that people are not encouraged to fix.

Sadly, I think we’ll have to choice but try to support those, as testers usually can’t have the application or even the server fixed. But it will take time as we’ll have to make the underlying HTTP framework (AsyncHttpClient) drop some very important Java primitives such as java.net.URI.

Sorry if I sound rude, but you don’t have any idea about the tons of crappy HTTP implementations we have to cope with and that make our lives a misery… Internet is messed up.

See http://stackoverflow.com/questions/7654207/what-charset-should-be-used-for-a-location-header-in-a-301-response