@@ -340,29 +340,34 @@ def on_request(cli, req, obj)
340
340
341
341
resp [ 'Content-Type' ] = 'application/octet-stream'
342
342
343
- # generate the stage, but pass in the existing UUID and connection id so that
344
- # we don't get new ones generated.
345
- blob = obj . stage_payload (
346
- uuid : uuid ,
347
- uri : conn_id ,
348
- lhost : uri . host ,
349
- lport : uri . port
350
- )
351
-
352
- resp . body = encode_stage ( blob )
353
-
354
- # Short-circuit the payload's handle_connection processing for create_session
355
- create_session ( cli , {
356
- :passive_dispatcher => obj . service ,
357
- :conn_id => conn_id ,
358
- :url => url ,
359
- :expiration => datastore [ 'SessionExpirationTimeout' ] . to_i ,
360
- :comm_timeout => datastore [ 'SessionCommunicationTimeout' ] . to_i ,
361
- :retry_total => datastore [ 'SessionRetryTotal' ] . to_i ,
362
- :retry_wait => datastore [ 'SessionRetryWait' ] . to_i ,
363
- :ssl => ssl? ,
364
- :payload_uuid => uuid
365
- } )
343
+ begin
344
+ # generate the stage, but pass in the existing UUID and connection id so that
345
+ # we don't get new ones generated.
346
+ blob = obj . stage_payload (
347
+ uuid : uuid ,
348
+ uri : conn_id ,
349
+ lhost : uri . host ,
350
+ lport : uri . port
351
+ )
352
+
353
+ resp . body = encode_stage ( blob )
354
+
355
+ # Short-circuit the payload's handle_connection processing for create_session
356
+ create_session ( cli , {
357
+ :passive_dispatcher => obj . service ,
358
+ :conn_id => conn_id ,
359
+ :url => url ,
360
+ :expiration => datastore [ 'SessionExpirationTimeout' ] . to_i ,
361
+ :comm_timeout => datastore [ 'SessionCommunicationTimeout' ] . to_i ,
362
+ :retry_total => datastore [ 'SessionRetryTotal' ] . to_i ,
363
+ :retry_wait => datastore [ 'SessionRetryWait' ] . to_i ,
364
+ :ssl => ssl? ,
365
+ :payload_uuid => uuid
366
+ } )
367
+ rescue NoMethodError
368
+ print_error ( "Staging failed. This can occur when stageless listeners are used with staged payloads." )
369
+ return
370
+ end
366
371
367
372
when :connect
368
373
print_status ( "Attaching orphaned/stageless session ..." )
0 commit comments