3

I'm using curl to get a web page with chunked Transfer-Encoding header.

When I execute the command on linux bash (CentOS) I receive the pid of the process and I get back the shell, it seems curl is executed in background and after some minutes on the shell itself it appears the output html, I'm assuming it is having this behavior because of the chuncked transfer encoding.

How can I prevent this curl behavior? Is there any way to force a sync connection to wait for the output?

Bagbyte
  • 845
  • 2
  • 18
  • 34

1 Answers1

0

Generally, this happens when you try to pass GET params via the command line. The & symbol used to differentiate parameters is also used by the shell to send jobs to the background. The curl command is still running, but the passed arguments are shorter than you expect. They have to be quoted.

For instance, you will get this behaviour with the following command:

curl http://127.0.0.1:8081/streamhtml?nblocks=4&block_size=1600

(In this example, streamhtml creates 4 blocks of size 1600). The correct call has the URL quoted:

curl 'http://127.0.0.1:8081/streamhtml?nblocks=4&block_size=1600'

As @axelrose mentioned in the comments, it is difficult to be sure without an example command line and output.

Omer Anson
  • 310
  • 2
  • 8