阅读:3114回复:1
请教关于xmlhttp.setRequestHeader的字符串格式以及相关问题
关于setRequestHeader
XMLHttpRequest.setRequestHeader(bstrHeader, bstrValue); 用于单独指定请求的某个http头 比如: xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 但是,如果bstrValue中含有引号、<>、空格等,语句就出错。 比如: xmlhttp.setRequestHeader("haPARAMS","<?xml version="1.0" encoding="GB2312"?> <haParam expiredate="2006-9-28">"); 请问如果我要在http header中添加此类header,怎样用语句实现? 怎样让语句将<?xml version="1.0" encoding="GB2312"?> <haParam expiredate="2006-9-28">识别为我将要添加的header? 也就是说,最终要达到这样的效果: Accept: */* haPARAMS: <?xml version="1.0" encoding="GB2312"?> <haParam expiredate="2006-9-29"> User-Agent: haha_WEB/1.0.0001 Host: *********** Connection: Keep-Alive Cache-Control: no-cache 怎样实现呢? 我在研究一种下载方法,那个服务器对get请求要验证http header的信息。 而且下载不同的文件要配上不同的http header,非常难以设置。 (如果只用同一个http header,就可以用现成的软件设置了……可惜不是) 大家有没有什么好一些的办法? 谢谢! |
|
1楼#
发布于:2006-09-29 12:02
没有人回复吗?
|
|