- 论坛徽章:
- 1
|
沒有這麼難,只要看一下 RFC 2616 中有關 Method 就可以了,
範例:
- ab -p post -T "application/x-www-form-urlencoded" http://host/path/filename
复制代码
檔案格式
-T 應該是這個需求下必需的 , default 是 "text/plain"
只要樓主有心把 ab.c 中的 code 看過一遍就知道了,我幫你看了省你費事
- sprintf(request, "POST %s HTTP/1.0\r\n"
- "User-Agent: ApacheBench/%s\r\n"
- "%s" "%s" "%s"
- "Host: %s%s\r\n"
- "Accept: */*\r\n"
- "Content-length: %" APR_SIZE_T_FMT "\r\n"
- "Content-type: %s\r\n"
- "%s"
- "\r\n",
- (isproxy) ? fullurl : path,
- AP_AB_BASEREVISION,
- keepalive ? "Connection: Keep-Alive\r\n" : "",
- cookie, auth,
- host_field, colonhost, postlen,
- (content_type[0]) ? content_type : "text/plain", hdrs);
复制代码
我想這樣看就一目了然了(上面不懂代表您不了解 HTTP),這是 google 沒有的東西
要注意的是 Content-type 和 post data 的關係,不同的 type 有不同的 post encoding |
|