我正在嘗試使用tcl發送http發佈請求。我的代碼如下:tcl中的Http Post標題 - > 400錯誤的請求
proc ::rest::setRequest {req} {
upvar $req str
set str "POST domain.com HTTP/1.1\r\n"
append str "Host: blablabla\r\n"
append str "Content-Length:11\r\n"
append str "Content-Type:text/xml\r\n"
append str "Authorization: Basic ZGVmYXVsdDpkZWZhdWx0\r\n\r\n"
}
proc ::rest::sendRestMsg {ip port request} {
set chan [socket $ip $port]
puts $chan $request
flush $chan
puts "[gets $chan]"
puts "[gets $chan]"
puts "[gets $chan]"
puts "[gets $chan]"
puts "[gets $chan]"
puts "[gets $chan]"
puts "[gets $chan]"
puts "[gets $chan]"
puts "[gets $chan]"
puts "[gets $chan]"
puts "[gets $chan]"
puts "[gets $chan]"
puts "[gets $chan]"
puts "[gets $chan]"
puts "[gets $chan]"
puts "[gets $chan]"
puts "[gets $chan]"
}
我的問題是,服務器解析器都跟我HTTP /前buf_p = 0x5b8c7074 1.1 400錯誤的請求,HTTP報頭詞法分析器誤差在字符「 」(0xd中)偏移量= 32。
它從第一行的「\ n」投訴。我的標題有什麼問題?謝謝