If I run
nc -l 9903
And then run LWP and paste something like this into "nc" window
HTTP/1.1 200 OK Content-Length: 133 LNJKjadfkj ^C
I will get in 'lwp' window:
GET -S -e http://localhost:9903/ GET http://localhost:9903/ --> 200 OK Content-Length: 133 Client-Date: Thu, 30 May 2013 06:41:09 GMT Client-Peer: 127.0.0.1:9903 Client-Response-Num: 1 LNJKjadfkj
So it's detected as success request. But tools like curl/wget report this as error/warning or even retry.
And according to RFC http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4 Content-Length is priority over connecion close.
When a message-body is included with a message, the transfer-length of that body is determined by one of the following (in order of precedence):
...
3. If a Content-Length header field (section 14.13) is present, its decimal value in OCTETs represents both the entity-length and the transfer-length
...
5.By the server closing the connection.
Am I missing something?
UPD
So, not sure if this intended behaviour or no, so I reported a bug https://rt.cpan.org/Public/Bug/Display.html?id=85759

In reply to Should LWP warn about wrong Content-Length? by vsespb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.