I have the following URL which I want use to access the content in a remote Apache Tomcat server from a C-based client:

char url[] = "POST /myDir HTTP/1.1\x0D\x0AContent-Type: text/xml\x0D\x0AContent-Length:60\x0D\x0A\x0D\x0A<root><mygreeting>Hello, World!</mygreeting></root>\r\n";

However, I get the response "HTTP/1.1 505 HTTP Version Not Supported". I have googled and found that this may be due to character encoding of the url. So I am asking how can the contents of my array url be encoded in C so that it can be correctly interpreted by Tomcat.

6 Years
Discussion Span
Last Post by manaila

I notice you don't specify an encoding, which means you're using the default. Unless you changed it in Tomcat's configuration it should be compatible with C's character type, but you can force the content type to be extra safe: "Content-Type: text/xml; charset=ISO-8859-1" .

There are a number of factors at work here, so give that a go and reply if it doesn't work.

Edited by Narue: n/a


Thank you Narue. I have tried your suggestion but unfortunately I get the same server response.


Correct me if I am wrong, but for me HTTP Version Not Supported means exactly what it says: HTTP version (1.1 in your case) is not supported. Try HTTP/1.0 instead.


Thats what came to my mind the first time I got that response, nezachem, but since using HTTP/1.0 or HTTP/1.1 returns same response I made further research and found that this MAY BE due to Tomcat url enconding.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.