[Tex/LaTex] How to force LaTeX to keep section/subsection headings with one line below it on the bottom of the current page

page-breakingsectioning

By default, LaTeX allows a page break after the first two lines of paragraphs following section/subsection headings, but I would like to keep the section heading with even one line below it at the bottom of the current page. How to do it?
Please note that I'd prefer not to use any additional packages such as etoolbox or needspace.
Here is my MWE:

\documentclass{book}
\usepackage[showframe]{geometry}% just for this example
\usepackage{lipsum}
\newcommand{\dummy}{This is a test }
\begin{document}
\lipsum[1-6]
\section{bla}
This is a test  This is a test  This is a test This is a test 
This is a test This is a test This is a test 
This is a test 
\end{document}

Best Answer

Without any additional package, add the following lines in your preamble

\makeatletter
\renewcommand\@afterheading{%
  \@nobreaktrue
  \everypar{%
    \if@nobreak
      \@nobreakfalse
      \clubpenalty 1
      \if@afterindent \else
        {\setbox\z@\lastbox}%
      \fi
    \else
      \clubpenalty 1
      \everypar{}%
    \fi}}
\makeatother

MWE:

\documentclass{book}
\usepackage[showframe]{geometry}% just for this example
\usepackage{lipsum}
\newcommand{\dummy}{This is a test }

\makeatletter
\renewcommand\@afterheading{%
  \@nobreaktrue
  \everypar{%
    \if@nobreak
      \@nobreakfalse
      \clubpenalty 1
      \if@afterindent \else
        {\setbox\z@\lastbox}%
      \fi
    \else
      \clubpenalty 1
      \everypar{}%
    \fi}}
\makeatother

\begin{document}
\lipsum[1-6]
\section{bla}
This is a test  This is a test  This is a test This is a test
This is a test This is a test This is a test
This is a test
\end{document} 

Output:

enter image description here