我正在测试一个输出第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.我的网络服务器用龙卷风编写,输出如下:
[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手册页说明如下:
...
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.
...
我试图将网址设置为单引号,双引号和无引号。我还在一个文件中写了网址并使用-f
将其传递给围攻,但没有运气。我正在使用:
我的环境:
SIEGE 3.0.9
GNOME Terminal 3.10.2
Fedora release 20 (Heisenbug)
有什么想法吗?
答案 0 :(得分:1)
我正在使用SIEGE 4.0.4,发现双引号的工作原理来自下面的问题:
答案 1 :(得分:0)
围攻不喜欢网址如下:
http://localhost:8000?q=8
要使用查询参数,我必须有一个带路径的网址:
http://localhost:8000/fib?q=8
然后它工作正常。
我无法找到解决方法