Enthusiasm never stops

Leave a comment

Getting “500 Line too long (limit is 4096)” error in Perl

The error may also be “500 Line too long (limit is 8192)” but the problem is still the same – LWP or SOAP::Lite return this error when you try to POST or GET something very long.

The one to blame is actually Net::HTTP::Methods, included somewhere by something.

It took me a few hours to get this resolved:

use LWP::Protocol::http; # to suppress the warning "possible typo" in the next statement
push(@LWP::Protocol::http::EXTRA_SOCK_OPTS, MaxLineLength => 0); # to remove the limit

Put the above code in your Perl HTTP client and you’re good to go!