You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2021/09/03 03:16:43 UTC

[Bug 65546] New: SSI comments don't allow quoted strings

https://bz.apache.org/bugzilla/show_bug.cgi?id=65546

            Bug ID: 65546
           Summary: SSI comments don't allow quoted strings
           Product: Apache httpd-2
           Version: 2.4.38
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_include
          Assignee: bugs@httpd.apache.org
          Reporter: bruce@momjian.us
  Target Milestone: ---

When using SSI comments, these work:

    <!--#comment abc -->
    <!--#comment a"abc" -->

but these do not:

    <!--#comment "abc" -->
    <!--#comment 'abc' -->

The error is:

    missing argument name for value to tag comment

The error comes from modules/filters/mod_include.c::find_argument() when it
tries to find arguments in the comments.  I think the fix is for comments to
not call this function.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 65546] SSI comments don't allow quoted strings

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65546

--- Comment #3 from Bruce Momjian <br...@momjian.us> ---
Ah, seems this also throws the error, so it is not just quotes that are a
problem:

    <!--#comment = -->

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 65546] SSI comments don't allow quoted strings

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65546

--- Comment #2 from Bruce Momjian <br...@momjian.us> ---
Well, I had no idea text= was an option for #comment.  Seems you can just add
any key name instead of "text"?  How do you handle text with single/double
quotes in them?  I guess you can use double quotes for text with single quotes,
and single quotes for text with double quotes, but how would you handle text
with both?

I assumed #comment operated just like HTML comments and went to the end of the
--> block.  I do think the feature is useful in allowing comments to be used
without sending them to the client.  What I ended up doing was to add an
underscore before a single or double quote that had a space before it, but that
is kind of odd.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 65546] SSI comments don't allow quoted strings

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65546

--- Comment #1 from Christophe JAILLET <ch...@wanadoo.fr> ---
Hi,

I think that just updating the doc to state that only:
  <!--#comment abc -->
and
  <!--#comment text="abc" -->
are valid syntax, should be enough.

Adding a special case for 'comment' to accept ' or " would just be an ugly
hack.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 65546] SSI comments don't allow quoted strings

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65546

Christophe JAILLET <ch...@wanadoo.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #6 from Christophe JAILLET <ch...@wanadoo.fr> ---
Doc updated to show the alternate syntax.

r1892902 in trunk
r1892903 in 2.4.x

This will be visible online the next time the doc is rebuilt.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 65546] SSI comments don't allow quoted strings

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65546

--- Comment #7 from Bruce Momjian <br...@momjian.us> ---
Well, the additional documentation does help, but I am not sure the logic of
why and how to use it is clear.  For example, if the comment contains a single
quote with preceding whitespace, you use double quotes for the value.  If the
comment a  double quote, you use single quotes, and for values with both, you
use backticks.  That seems very confusing for what I mentally think of as
free-form comment text.

What I did was to add the t="" and t='' syntax for cases that need it, and also
added a cron job to check the Apache server logs for any AH 01370-style error
strings.  If no one else has complained about this before, I guess the
documentation fix is sufficient at this point.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 65546] SSI comments don't allow quoted strings

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65546

--- Comment #5 from Christophe JAILLET <ch...@wanadoo.fr> ---
(In reply to Bruce Momjian from comment #3)
> Ah, seems this also throws the error, so it is not just quotes that are a
> problem:
> 
>     <!--#comment = -->

Here you are passing a key=value parameter to the "comment" element, but both
the key and the value are just empty.

I guess you are hitting a AH 01370 error in the log (see [1])


[1]:
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_include.c?view=markup#l3248

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 65546] SSI comments don't allow quoted strings

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65546

--- Comment #4 from Christophe JAILLET <ch...@wanadoo.fr> ---
(In reply to Bruce Momjian from comment #2)
> Seems you can just add any key name instead of "text"?
Correct.
I just proposed "text" that looks like a somewhat logical key name :)


> How do you handle text with single/double quotes in them?
> I guess you can use double quotes for text
> with single quotes, and single quotes for text with double quotes, but how
> would you handle text with both?
Just escape the quote within the text (i.e. \" or \' or \`)

> I assumed #comment operated just like HTML comments and went to the end of
> the --> block.  I do think the feature is useful in allowing comments to be
> used without sending them to the client.
Yes, it behaves mostly the same. Everything up to the closing --> is just
ignored


In fact, there is a special test (see [1]) that tries to spot obvious
configuration issues. All mod_include elements expect parameters passed as key
or key=value. If value has some spaces, there must be some surrounding " or '
or `.
A key starting with a quote is not possible and is likely a missing key in
fact.
It is what you have hit with the 'comment'.

> What I ended up doing was to add
> an underscore before a single or double quote that had a space before it,
> but that is kind of odd.
I works for the same reason  <!-- comment blah blah --> works. The parser
sees your _"some text" as just a (normal) key because it does not start with a
quote.


[1]:
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_include.c?view=markup#l3203

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org