8000 Response Headers should be allowed to be null (or at least empty if not set) · Issue #182 · AsyncHttpClient/async-http-client · GitHub
[go: up one dir, main page]

Skip to content
Response Headers should be allowed to be null (or at least empty if not set) #182
Closed
@randomcoder

Description

@randomcoder

Whilst running a Gatling test on a server that does not generate any headers at all I get the following exception:

java.lang.IllegalStateException: Response's headers hasn't been computed by your AsyncHandler.
        at com.ning.http.client.providers.netty.NettyResponse.getCookies(NettyResponse.java:184)
        at com.excilys.ebi.gatling.http.response.ExtendedResponse.getCookies(ExtendedResponse.scala:89)
        at com.excilys.ebi.gatling.http.ahc.GatlingAsyncHandlerActor.com$excilys$ebi$gatling$http$ahc$GatlingAsyncHandlerActor$$processResponse(GatlingAsyncHandlerActor.scala:198)
        at com.excilys.ebi.gatling.http.ahc.GatlingAsyncHandlerActor$$anonfun$receive$1.apply(GatlingAsyncHandlerActor.scala:107)
        at com.excilys.ebi.gatling.http.ahc.GatlingAsyncHandlerActor$$anonfun$receive$1.apply(GatlingAsyncHandlerActor.scala:83)
        at akka.actor.Actor$class.apply(Actor.scala:318)
        at com.excilys.ebi.gatling.core.action.BaseActor.apply(BaseActor.scala:23)
        at akka.actor.ActorCell.invoke(ActorCell.scala:626)
        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197)
        at akka.dispatch.Mailbox.run(Mailbox.scala:179)
        at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:516)
        at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259)
        at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975)
        at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1479)
        at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)

The problem is that the headers in the response are null which causes the exception to be thrown.

However, the HTTP Response RFC states that the headers are optional and that only the status line and a single CRLF are required.

The RFC is at http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html

with the relevant Augmented BNF being:

Response = Status-Line
           *(( general-header
           response-header
           entity-header ) CRLF)
           CRLF
           [ message-body ]

where the *((...)) indicates that 0 or more of the elements after the * are permitted.

Therefore it is not in keeping with the standard to throw an exception if there are no headers, simply to use empty headers if there are none.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0