javax.script.ScriptException: org.apache.http.NoHttpResponseException

127 views
Skip to first unread message

Hector Luna

unread,
Nov 21, 2022, 12:43:01 PM11/21/22
to OWASP ZAP User Group
I am getting the following error: 

javax.script.ScriptException: org.apache.http.NoHttpResponseException: {{URL}}:{{PORT}} failed to respond.

The problem I am trying to solve has to do with the URL I am trying to execute as part of a Zest script. All I get is the error message but get nothing generated as far as "request" or "response" and ZAP also stops execution of the Zest script with the offending URL

My question is: 
Is there a way to trap or debug the request as it is going out and what response (if any) I am getting from the server? Since I am not getting anything but the vague exception message, I am having a hard time trying to resolve the issue.

Any help would be most welcome.
Thanks!

thc...@gmail.com

unread,
Nov 21, 2022, 1:11:42 PM11/21/22
to zaprox...@googlegroups.com
Hi.

Did you change exception message, specifically "{{URL}}:{{PORT}}" ?
Seems that the Zest variables are not defined.

Best regards.

Hector Luna

unread,
Nov 21, 2022, 1:33:13 PM11/21/22
to OWASP ZAP User Group
Yes, I changed them to those values to represent variables. The actual error has the URL I am trying to POST to and the port number.
I just omitted them in order to post the question here. My apologies for the confusion.

Hector Luna

unread,
Nov 22, 2022, 9:28:56 PM11/22/22
to OWASP ZAP User Group
So any hints as to where to look so that I can attempt to debug the issue? Or at least see what ZAP is sending over to the server?

thc...@gmail.com

unread,
Nov 23, 2022, 3:36:39 AM11/23/22
to zaprox...@googlegroups.com
Enable debug logging for:
org.apache.hc.client5.http.header

https://www.zaproxy.org/faq/how-do-you-configure-zap-logging/

That should log what is being sent.

Best regards.

Hector Luna

unread,
Nov 28, 2022, 10:54:28 AM11/28/22
to OWASP ZAP User Group
Thank you for your help thc202. I am able to get more logging now after making that change.

When I look at the logs, I can see where Zap is generating the requests it is about to send. How it goes about traversing the path of the request, etc. The offending request doest not show at all in the logs when the exception bellow gets thrown. I can see ZAP building the request prior to the exception, and the first request of the following script I want to execute. My set up is as follows:

Main Zest Script
-- run standalone JS script for setup
-- run standalone Zest Script A
   * Good request
   * Good request
   * Good request
   * Request that throws exception
   * Good request that never executes
   * Good request that never executes
-- run standalone Zest Script B
   * Good request
   * Good request
   * Good request

I know the good requests work because commenting out the request that throws the exception allows the others to work just fine.

Here is a quick trace of the exception I am getting.
org.zaproxy.zest.core.v1.ZestActionFailException: javax.script.ScriptException: org.apache.http.NoHttpResponseException: URL:PORT failed to respond
at org.zaproxy.zest.core.v1.ZestActionInvoke.invoke(ZestActionInvoke.java:196) ~[zest-beta-38.zap:?]
at org.zaproxy.zest.impl.ZestBasicRunner.handleAction(ZestBasicRunner.java:226) ~[zest-beta-38.zap:?]
at org.zaproxy.zap.extension.zest.ZestZapRunner.handleAction(ZestZapRunner.java:300) ~[zest-beta-38.zap:?]
at org.zaproxy.zest.impl.ZestBasicRunner.runStatement(ZestBasicRunner.java:194) ~[zest-beta-38.zap:?]
at org.zaproxy.zap.extension.zest.ZestZapRunner.runStatement(ZestZapRunner.java:283) ~[zest-beta-38.zap:?]
at org.zaproxy.zest.impl.ZestBasicRunner.run(ZestBasicRunner.java:145) ~[zest-beta-38.zap:?]
at org.zaproxy.zap.extension.zest.ZestZapRunner.run(ZestZapRunner.java:168) ~[zest-beta-38.zap:?]
at org.zaproxy.zest.impl.ZestBasicRunner.run(ZestBasicRunner.java:110) ~[zest-beta-38.zap:?]
at org.zaproxy.zap.extension.zest.ZestZapRunner.run(ZestZapRunner.java:140) ~[zest-beta-38.zap:?]
at org.zaproxy.zest.impl.ZestBasicRunner.runScript(ZestBasicRunner.java:432) ~[zest-beta-38.zap:?]
at org.zaproxy.zest.impl.ZestScriptEngine.eval(ZestScriptEngine.java:45) ~[zest-beta-38.zap:?]
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) ~[java.scripting:?]
at org.zaproxy.zap.extension.script.ExtensionScript.invokeScriptImpl(ExtensionScript.java:1499) ~[zap-D-2022-10-31.jar:D-2022-10-31]
at org.zaproxy.zap.extension.script.ExtensionScript.invokeScript(ExtensionScript.java:1427) ~[zap-D-2022-10-31.jar:D-2022-10-31]
at org.zaproxy.zap.extension.scripts.ConsolePanel$ScriptExecutorThread.run(ConsolePanel.java:592) ~[scripts-release-34.zap:?]
Caused by: javax.script.ScriptException: org.apache.http.NoHttpResponseExceptionURL:PORT failed to respond
at org.zaproxy.zest.impl.ZestScriptEngine.eval(ZestScriptEngine.java:69) ~[zest-beta-38.zap:?]
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:212) ~[java.scripting:?]
at org.zaproxy.zest.core.v1.ZestActionInvoke.invoke(ZestActionInvoke.java:187) ~[zest-beta-38.zap:?]
... 14 more
Caused by: org.apache.http.NoHttpResponseException:URL:PORT failed to respond
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141) ~[zest-beta-38.zap:?]
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56) ~[zest-beta-38.zap:?]
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) ~[zest-beta-38.zap:?]
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163) ~[zest-beta-38.zap:?]
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157) ~[zest-beta-38.zap:?]
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273) ~[zest-beta-38.zap:?]
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) ~[zest-beta-38.zap:?]
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272) ~[zest-beta-38.zap:?]
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) ~[zest-beta-38.zap:?]
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[zest-beta-38.zap:?]
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) ~[zest-beta-38.zap:?]
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[zest-beta-38.zap:?]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) ~[zest-beta-38.zap:?]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56) ~[zest-beta-38.zap:?]
at org.zaproxy.zest.impl.ComponentsHttpClient.send(ComponentsHttpClient.java:224) ~[zest-beta-38.zap:?]
at org.zaproxy.zest.impl.ZestBasicRunner.send(ZestBasicRunner.java:364) ~[zest-beta-38.zap:?]
at org.zaproxy.zap.extension.zest.ZestZapRunner.send(ZestZapRunner.java:548) ~[zest-beta-38.zap:?]
at org.zaproxy.zest.impl.ZestBasicRunner.runStatement(ZestBasicRunner.java:171) ~[zest-beta-38.zap:?]
at org.zaproxy.zap.extension.zest.ZestZapRunner.runStatement(ZestZapRunner.java:283) ~[zest-beta-38.zap:?]
at org.zaproxy.zest.impl.ZestBasicRunner.run(ZestBasicRunner.java:145) ~[zest-beta-38.zap:?]
at org.zaproxy.zap.extension.zest.ZestZapRunner.run(ZestZapRunner.java:168) ~[zest-beta-38.zap:?]
at org.zaproxy.zest.impl.ZestBasicRunner.run(ZestBasicRunner.java:110) ~[zest-beta-38.zap:?]
at org.zaproxy.zap.extension.zest.ZestZapRunner.run(ZestZapRunner.java:140) ~[zest-beta-38.zap:?]
at org.zaproxy.zest.impl.ZestBasicRunner.runScript(ZestBasicRunner.java:424) ~[zest-beta-38.zap:?]
at org.zaproxy.zest.impl.ZestScriptEngine.eval(ZestScriptEngine.java:67) ~[zest-beta-38.zap:?]
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:212) ~[java.scripting:?]
at org.zaproxy.zest.core.v1.ZestActionInvoke.invoke(ZestActionInvoke.java:187) ~[zest-beta-38.zap:?]
... 14 more

The issue is that I still can't see why that particular URL keeps throwing this exception.
Thanks for your help. 

Oh... and I replaced the actual url and port with URL:PORT so that I show the exception here.

Hector Luna

unread,
Dec 5, 2022, 6:33:06 PM12/5/22
to OWASP ZAP User Group
I have still not found a solution for this issue, but when I run the exact same Zest scripts locally using release 2.11.0, then I get zero issues. It all works as expected so I know for a fact that it isn't the script, nor the target endpoints I am testing with zap.

The next step will be to find a version of the framework that does not break when I run it.

Hector Luna

unread,
Dec 6, 2022, 2:33:28 AM12/6/22
to OWASP ZAP User Group
Looks like the issue is when updated the network addon from 0.3.0 to 0.5.0.
As soon as I update the addon to that version, that is what breaks my script, resulting in the trace above.

What is the ZapProtocolExec class doing that ProtocolExec was not doing? Assuming that is the only change in that network module.
Any insights? Thanks!

thc...@gmail.com

unread,
Dec 6, 2022, 4:38:57 AM12/6/22
to zaprox...@googlegroups.com
Share the message (request and response) that leads to the exception.

What changed is mentioned in the changelog:
https://github.com/zaproxy/zap-extensions/blob/main/addOns/network/CHANGELOG.md

Best regards.

On 06/12/2022 07:33, Hector Luna wrote:
> Looks like the issue is when updated the network addon from 0.3.0 to 0.5.0.
> As soon as I update the addon to that version, that is what breaks my
> script, resulting in the trace above.
>
> What is the *ZapProtocolExec *class doing that *ProtocolExec* was not
> doing? Assuming that is the only change in that network module.
> Any insights? Thanks!
>
> On Monday, December 5, 2022 at 5:33:06 PM UTC-6 Hector Luna wrote:
>
>> I have still not found a solution for this issue, but when I run the exact
>> same Zest scripts locally using release 2.11.0, then I get zero issues. It
>> all works as expected so I know for a fact that it isn't the script, nor
>> the target endpoints I am testing with zap.
>>
>> The next step will be to find a version of the framework that does not
>> break when I run it.
>>
>> On Monday, November 28, 2022 at 9:54:28 AM UTC-6 Hector Luna wrote:
>>
>>> Thank you for your help thc202. I am able to get more logging now after
>>> making that change.
>>>
>>> When I look at the logs, I can see where Zap is generating the requests
>>> it is about to send. How it goes about traversing the path of the request,
>>> etc. The offending request doest not show at all in the logs when the
>>> exception bellow gets thrown. I can see ZAP building the request prior to
>>> the exception, and the first request of the following script I want to
>>> execute. My set up is as follows:
>>>
>>> Main Zest Script
>>> -- run standalone JS script for setup
>>> -- run standalone Zest Script A
>>> * Good request
>>> * Good request
>>> * Good request
>>> * *Request that throws exception*
>>> * *Good request that never executes*
>>> * *Good request that never executes*
>>> -- run standalone Zest Script B
>>> * Good request
>>> * Good request
>>> * Good request
>>>
>>> I know the good requests work because commenting out the request that
>>> throws the exception allows the others to work just fine.
>>>
>>> Here is a quick trace of the exception I am getting.
>>> org.zaproxy.zest.core.v1.ZestActionFailException:
>>> javax.script.ScriptException: org.apache.http.NoHttpResponseException:
>>> *URL:PORT* failed to respond
>>> org.apache.http.NoHttpResponseException: *URL:PORT* failed to respond
>>> at org.zaproxy.zest.impl.ZestScriptEngine.eval(ZestScriptEngine.java:69)
>>> ~[zest-beta-38.zap:?]
>>> at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:212)
>>> ~[java.scripting:?]
>>> at
>>> org.zaproxy.zest.core.v1.ZestActionInvoke.invoke(ZestActionInvoke.java:187)
>>> ~[zest-beta-38.zap:?]
>>> ... 14 more
>>> Caused by: org.apache.http.NoHttpResponseException:*URL:PORT* failed to
>>> Oh... and I replaced the actual url and port with *URL:PORT* so that I
Reply all
Reply to author
Forward
0 new messages