Method/program for sending a given HTTP request (with headers)

时光总嘲笑我的痴心妄想 提交于 2020-01-25 08:30:26

问题


I am debugging my website. When it has an error, the full text form of the HTTP request that caused the error is logged. I want to be able to replay these HTTP requests to help debugging the error.

For instance, I have this in my log now:

POST /ipn/handler.ashx?inst=272&msgType=result HTTP/1.0
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Host: mysite.com
Content-Length: 28
User-Agent: AGENT/1.0 (UserAgent)

region=website&compName=ACTL

I want a way to make this exact request again on my local test machine (with changed Host attribute). What is the best way to do this?


回答1:


You could use telnet to talk to your web server and type the exact requests.

You could also use libcurl (& curl) to make a program which is an HTTP client.

And many scripting languages (Python, Ruby, Perl, Ocaml, ...) also have HTTP client libraries (sometimes above Curl).



来源:https://stackoverflow.com/questions/8384848/method-program-for-sending-a-given-http-request-with-headers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!