开发者

HTTP GET request to get binary content of an XML file

I'm trying to get the binary content of an XML file through HTTP but the server just want to give me kind of interpreted format (wich removes \r for every \r\n).

My HTTP GET request is simple : "GET http://%s%s%s HTTP/1.0\r\nConnection: Keep-Alive\r\n\r\n"

It works for extention except .xml. And if I change the .xml in .notxm开发者_高级运维l, it works.

So, I'm looking for a way to the binary content without any change in the file.

Thank you in advance.


The problem is on the server. When you ask it for an XML file it looks in a table that maps extensions to Mime-Types. In the default case, the mime-type for XML is either text/xml or application/xml, both of which are considered text formats and subject to line-ending translation. To get a binary stream for XML you have to find a way to force the server to treat it as binary instead of text. This means changing the server configuration or using a different extension that is treated as binary.


This is almost definitely a Mime-Type issue. If you're using IIS I would suggest checking out:

http://technet.microsoft.com/en-us/library/bb742440.aspx


It was caused by my FTP Client (FileZilla). If I transfer .nxml and rename in .xml by FTP, the file is OK. Thanks for trying to help me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜