JoeDog / siege

Siege is an http load tester and benchmarking utility
GNU General Public License v3.0
5.91k stars 386 forks source link

-p does not print response headers, -g does not allow file (-f) for URLs #148

Open ebob9 opened 5 years ago

ebob9 commented 5 years ago

I've got a list of URLs I want to hit with siege. I want to print the response headers, as i'm looking for some specific X headers to debug some issues under load.

However, siege does not seem to allow this. First, in the help:

  -g, --get                 GET, pull down HTTP headers and display the
                            transaction. Great for application debugging.
  -p, --print               PRINT, like GET only it prints the entire page.

If I do siege with -g, I get response headers:

edwards-mbp-pro:Desktop aaron$ siege -g http://captive.apple.com
HEAD / HTTP/1.0
Host: captive.apple.com
Accept: */*
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (apple-x86_64-darwin17.0.0) Siege/4.0.4
Connection: close

HTTP/1.0 200 OK
x-amz-id-2: AiN2RXSkIG4DpFn5ENUS2Va4oGSWs/ggMwvc8kSy2jVCl16eeqhCtu9sr3BvD6NRRnFU6N50j/I=
x-amz-request-id: 4ADBC292E04D1BD9
Date: Fri, 28 Dec 2018 23:13:17 GMT
Last-Modified: Fri, 17 Feb 2017 20:36:28 GMT
Cache-Control: max-age=300
Accept-Ranges: bytes
Content-Type: text/html
Content-Length: 69
Server: ATS/8.0.1
Via: http/1.1 ussjc2-edge-lx-011.ts.apple.com (ApacheTrafficServer/8.0.1), http/1.1 ussjc2-edge-bx-021.ts.apple.com (ApacheTrafficServer/8.0.1)
CDNUUID: 082c9cdf-a459-45f5-8bf1-a2d9f0718433-2099989834
X-Cache: hit-fresh, hit-fresh
Etag: "41ba060eb1c0898e0a4a0cca36a8ca91"
Age: 43

Transactions:                  1 hits
Availability:             100.00 %
Elapsed time:               0.04 secs
Data transferred:           0.00 MB
Response time:              0.04 secs
Transaction rate:          25.00 trans/sec
Throughput:             0.00 MB/sec
Concurrency:                1.00
Successful transactions:           1
Failed transactions:               0
Longest transaction:            0.04
Shortest transaction:           0.04

edwards-mbp-pro:Desktop aaron$ 

However, siege with -g does not work with a URL list:

edwards-mbp-pro:Desktop aaron$ siege -g -f apple-url.txt 
ERROR: -g/--get requires a commandline URL
edwards-mbp-pro:Desktop aaron$ 

Then switched to using -p, which should behave like -g but show full content, the response shows the content but not the response headers:

edwards-mbp-pro:Desktop aaron$ siege -p http://captive.apple.com
** SIEGE 4.0.4
** Preparing 1 concurrent users for battle.
The server is now under siege...
GET / HTTP/1.0
Host: captive.apple.com
Accept: */*
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (apple-x86_64-darwin17.0.0) Siege/4.0.4
Connection: close

<HTML><HEAD><TITLE>Success</TITLE></HEAD><BODY>Success</BODY></HTML>

Transactions:                  1 hits
Availability:             100.00 %
Elapsed time:               0.27 secs
Data transferred:           0.00 MB
Response time:              0.27 secs
Transaction rate:           3.70 trans/sec
Throughput:             0.00 MB/sec
Concurrency:                1.00
Successful transactions:           1
Failed transactions:               0
Longest transaction:            0.27
Shortest transaction:           0.27

edwards-mbp-pro:Desktop aaron$

However, -p DOES work great with a URL file:

edwards-mbp-pro:Desktop aaron$ siege -p -f apple-url.txt 
** SIEGE 4.0.4
** Preparing 1 concurrent users for battle.
The server is now under siege...
GET / HTTP/1.0
Host: captive.apple.com
Accept: */*
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (apple-x86_64-darwin17.0.0) Siege/4.0.4
Connection: close

<HTML><HEAD><TITLE>Success</TITLE></HEAD><BODY>Success</BODY></HTML>

Transactions:                  1 hits
Availability:             100.00 %
Elapsed time:               0.04 secs
Data transferred:           0.00 MB
Response time:              0.04 secs
Transaction rate:          25.00 trans/sec
Throughput:             0.00 MB/sec
Concurrency:                1.00
Successful transactions:           1
Failed transactions:               0
Longest transaction:            0.04
Shortest transaction:           0.04

edwards-mbp-pro:Desktop aaron$

Ideally, would be really nice for siege to do one or both of the following: