0
votes

I get the http get packet by wireshark and send it by my software ,but the return code is 400 error ,it means format error ,next is my packet .

GET /download/ring/000/100/e487ac2d05805e2d1d32c99c6cde07a7.amr HTTP/1.1\r\n
Host: 5.26923.com\r\n
Connection: keep-alive\r\n
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\n
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36\r\n
Accept-Encoding: gzip, deflate, sdch\r\n
Accept-Language: zh-CN,zh;q=0.8\r\n
\r\n
1
You are not sending extra newlines after each \r\n, right? - pmg
yeah ,I only copy them from wireshark and send it to the server .you mean I should add a \n before \r\n,like \n\r\n,right ?thankyou - Frank Zhang
What's the length of your request? Each '\r' or '\n' should count for 1 character. By my calculations the whole request is 390 characters long. - pmg
thankyou .I solve the problem ,The reason is \r\n should be 0x0d,0x0a,but the socket software determine it in ascii ,change them in hex can be ok - Frank Zhang

1 Answers

2
votes

There is no such thing as an "HTTP packet", HTTP is organized as a stream, and you are looking at an "HTTP request" which is a type of HTTP message.

It looks like you have a bad header.

Accept:textml,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8

Two issues: textml is not valid, and there is no space after :.