1

我正在针对输出第 n 个斐波那契数的简单服务器测试围攻。使用 curl 时服务器运行良好:

[mto@localhost ~]$ curl http://localhost:8000?q=8
21

对围攻做同样的事情,会产生以下结果:

[mto@localhost ~]$ siege 'http://localhost:8000?q=8' -r 4 -c 1
** SIEGE 3.0.9
** Preparing 1 concurrent users for battle.
The server is now under siege...
HTTP/1.1 400   0.00 secs:      73 bytes ==> GET  /
HTTP/1.1 400   0.00 secs:      73 bytes ==> GET  /
HTTP/1.1 400   0.00 secs:      73 bytes ==> GET  /
HTTP/1.1 400   0.00 secs:      73 bytes ==> GET  /
done.

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

FILE: /home/mto/siege.log
You can disable this annoying message by editing
the .siegerc file in your home directory; change
the directive 'show-logfile' to false.

如您所见,服务器给出了 400。我的网络服务器是用 tornado 编写的,输出以下内容:

[W 150311 16:58:20 web:1404] 400 GET / (127.0.0.1): Missing argument q
[W 150311 16:58:20 web:1811] 400 GET / (127.0.0.1) 0.85ms             
[W 150311 16:58:20 web:1404] 400 GET / (127.0.0.1): Missing argument q
[W 150311 16:58:20 web:1811] 400 GET / (127.0.0.1) 0.71ms             
[W 150311 16:58:20 web:1404] 400 GET / (127.0.0.1): Missing argument q
[W 150311 16:58:20 web:1811] 400 GET / (127.0.0.1) 0.72ms             
[W 150311 16:58:20 web:1404] 400 GET / (127.0.0.1): Missing argument q
[W 150311 16:58:20 web:1811] 400 GET / (127.0.0.1) 0.79ms             

如何将查询参数传递给siege?Siege 手册页显示以下内容:

   ...
   You can pass parameters using GET much like you would in a web browser:

   www.haha.com/form.jsp?first=homer&last=simpson

   If you invoke the URL as a command line argument, you should probably place it in
   quotes.
   ...

我试图将网址放在单引号、双引号和不引号中。我还在一个文件中编写了 url 并使用 siege 将其传递给 siege -f,但没有运气。我在用:

我的环境:

SIEGE 3.0.9
GNOME Terminal 3.10.2
Fedora release 20 (Heisenbug)

有任何想法吗?

4

2 回答 2

1

我正在使用 SIEGE 4.0.4 并发现双引号适用于以下问题的答案:

https://stackoverflow.com/a/9311812/5824101

于 2017-12-13T09:05:07.430 回答
0

siege 不喜欢 url 采用以下形式:

http://localhost:8000?q=8

要使用查询参数,我必须有一个带有路径的 url:

http://localhost:8000/fib?q=8

然后它工作正常。我找不到工作

于 2015-03-12T09:52:06.743 回答