发送给定HTTP请求的方法/程序(带标头) [英] Method/program for sending a given HTTP request (with headers)

查看:140
本文介绍了发送给定HTTP请求的方法/程序(带标头)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调试我的网站。如果出现错误,则会记录导致错误的HTTP请求的完整文本格式。我希望能够重播这些HTTP请求以帮助调试错误。

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?

推荐答案

你可以使用 telnet 与您的Web服务器通信并输入确切的请求。

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

您还可以使用 libcurl (& curl)创建一个HTTP客户端程序。

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

许多脚本语言(Python,Ruby, Perl,Ocaml,...)也有HTTP客户端库(有时在Curl上面)。

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

这篇关于发送给定HTTP请求的方法/程序(带标头)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆