in reply to Re: CGI::Carp sometimes fails
in thread CGI::Carp sometimes fails

Grrrr...
** kicks self **

Having spent so long using shared hosting with very little access to logs, I forget they exist!

what's in your webserver's error log?
ModSecurity: Output filter: Response body too large (over limit of 1048576, total not specified)

OK - that makes sense...the JPEG image that it's trying to serve is going to be relatively big.

Replies are listed 'Best First'.
Re^3: CGI::Carp sometimes fails
by bliako (Abbot) on May 19, 2024 at 07:47 UTC

    if i understand right, you are printing the contents of a binary file into a log stream? why? It is not surprising that the printing crashes.

      why?

      Because I was trying to debug some code and hadn't realised that the variable's content was a binary file!

Re^3: CGI::Carp sometimes fails
by cavac (Prior) on May 22, 2024 at 03:22 UTC

    over limit of 1048576, total not specified

    That a strangely vague message in the context of HTTP. I'm assuming that pseudo security module is talking about a missing "Content-Length" header? (Also, 1 MB is quite tiny in modern web usage. Most minimized JavaScript libraries are larger these days...)

    In your case, i'd look into the error handling module and check if it fails to generate the appropriate headers. Also, i'd look into coercing it to set the content type to something like 'application/octet-stream' if it detects binary data (e.g. if any byte > 127).

    And, since its Perl we are talking here, bytes with a value greater than 255 also exist, which might or might not mess up other things as well. You might want to check if your $file variable gets real BINARY data or if there's an UTF8 decoder between you and the file on disk.

    PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
      And, since its Perl we are talking here, bytes with a value greater than 255 also exist,

      No, they don't.

      if there's an UTF8 decoder between you and the file on disk

      ... you may get characters with ordinal (ord) values > 255. But bytes remain 8 bit values limited to 0 to 255.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)