hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nir Dweck <n...@vasco-de.com>
Subject valid HTTP request
Date Tue, 23 Apr 2013 10:58:25 GMT
I have a question which involves both the code and the validity of an HTTP
I am using httpcore-4.2.3.
I receive from a client an HTTP (HTTP/1.1) request with the following
Content-type: text/xml
Host: some host
User-agent: UA
Connection: keep-alive
Accept: text/xml
Content-Length: 109

The entity is a an xml of of length of 109 bytes.
At the end of the xml there are two extra bytes with the value of 0x0d and
0xoa (/r/n), these bytes are the 110'th and 111'th bytes.
In my code I call: *EntityUtils.toString(entity, "UTF-8");*
at the end of the handling of the request my server returns 200-OK to the
the problem is that after I finish handling the request, the connection is
still open and I call *httpService.handleRequest(conn, context);*
This call sees the two extra bytes and returns 400-Bad request to the
Now my question are:

   1. As far as I know when the Content-Length header is present
   it determines the length  of the entity body, so actually the message I get
   is a bad message.
   2. Is there something I can do in my code to make it accept this
   message? Will calling *EntityUtils.consume(entity)* help?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message