You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there's libcgi_error() which is used in numerous places around the whole library. If the global variable cgi_display_errors contains true it prints HTML markup to stdout containing the error message. If the passed error code is E_FATAL or E_MEMORY (defined in src/error.h) it even calls cgi_end() and exit().
Besides the obvious sudden exit which may be bad (do we need this?) I consider it bad to print anything to stdout where my content should go to. The used HTML tags could be invalid if not printed at the right time or even break correct markup. (They do e.g. when using sessions if there's a session cookie but no session file.)
A flexible solution could work like in libabc or we could just print to stderr, which some webservers can append to their logfiles (others return HTTP status 500 or mix stdout/stderr and return it to the browser).
The text was updated successfully, but these errors were encountered:
I really like the idea to rework the logging mechanism in the way libabc does. I want to implement this. But I would like to know if you would like to have a library context which is passed to every function or to have this globally.
Introducing a library handle or context would be nice in the long run, but most probably an API change and therefor topic for API v2 which would be major rework. Although not that elegant, I would opt for a solution keeping the current API for now.
I can not answer the question on error handling from the top of my head. Must look into this deeper.
Currently there's
libcgi_error()
which is used in numerous places around the whole library. If the global variablecgi_display_errors
contains true it prints HTML markup to stdout containing the error message. If the passed error code isE_FATAL
orE_MEMORY
(defined insrc/error.h
) it even callscgi_end()
andexit()
.Besides the obvious sudden exit which may be bad (do we need this?) I consider it bad to print anything to stdout where my content should go to. The used HTML tags could be invalid if not printed at the right time or even break correct markup. (They do e.g. when using sessions if there's a session cookie but no session file.)
A flexible solution could work like in libabc or we could just print to stderr, which some webservers can append to their logfiles (others return HTTP status 500 or mix stdout/stderr and return it to the browser).
The text was updated successfully, but these errors were encountered: