<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
    <dl style="line-height: 1.5; margin-left: 2em">
      <dt style="clear: both; float: left; font-weight: bold; width: 8em">Author</dt>
      <dd style="margin-left: 8.5em">Kouhei Sutou &lt;kou****@clear*****&gt;</dd>
      <dt style="clear: both; float: left; font-weight: bold; width: 8em">Date</dt>
      <dd style="margin-left: 8.5em">2014-04-30 12:56:49 +0900 (Wed, 30 Apr 2014)</dd>
      <dt style="clear: both; float: left; font-weight: bold; width: 8em">New Revision</dt>
      <dd style="margin-left: 8.5em"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226">24ca9b035ef69f289ca6faa5220633529e636226</a></dd>
      <dt style="clear: both; float: left; font-weight: bold; width: 8em">Message</dt>
      <dd style="margin-left: 8.5em"><pre style="border: 1px solid #aaa; font-family: Consolas, Menlo, &quot;Liberation Mono&quot;, Courier, monospace; line-height: 1.2; padding: 0.5em; width: auto">Treat all HTTP requests under /d/ path is API request

Before:

/d/nonexistent-command returns a file content at
${DOCUMENT_ROOT}/d/nonexistent-command.

After:

/d/nonexistent-command returns '[[-22, 0.0, 0.0], &quot;invalid command
name: nonexistent-command&quot;]'.

Both groonga --protocol http and groonga-httpd are changed.</pre></dd>
      <dt style="clear: both; float: left; font-weight: bold; width: 8em">Modified files</dt>
      <dd style="margin-left: 8.5em">
        <ul>
          <li><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#diff-0">lib/ctx.c</a></li>
        </ul>
      </dd>
    </dl>

    <div class="diff-section" style="clear: both">
      <table style="border-collapse: collapse; border: 1px solid #aaa">
        <thead>
          <tr class="diff-header" style="border: 1px solid #aaa">
            <td colspan="3">
<pre style="border: 0; font-family: Consolas, Menlo, &quot;Liberation Mono&quot;, Courier, monospace; line-height: 1.2; margin: 0; padding: 0.5em; white-space: normal; width: auto"><span class="diff-header" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">  Modified: lib/ctx.c (+9 -3)</span>
<span class="diff-header-mark" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">===================================================================</span>
</pre>
            </td>
          </tr>
        </thead>
        <tbody>
          <tr>
            <th class="diff-line-number" style="border: 1px solid #aaa">
<pre style="border: 0; font-family: Consolas, Menlo, &quot;Liberation Mono&quot;, Courier, monospace; line-height: 1.2; margin: 0; padding: 0.5em; white-space: normal; width: auto"><span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1650">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1651">1651</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1652">1652</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1653">1653</a></span>
<span class="diff-line-number-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1654">1654</a></span>
<span class="diff-line-number-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1655">1655</a></span>
<span class="diff-line-number-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1656">1656</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1657">1657</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1658">1658</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1659">1659</a></span>
<span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1680">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1681">1681</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1682">1682</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1683">1683</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1684">1684</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1685">1685</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0L1686">1686</a></span>
</pre>
            </th>
            <th class="diff-line-number" style="border: 1px solid #aaa">
<pre style="border: 0; font-family: Consolas, Menlo, &quot;Liberation Mono&quot;, Courier, monospace; line-height: 1.2; margin: 0; padding: 0.5em; white-space: normal; width: auto"><span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1650">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1651">1651</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1652">1652</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1653">1653</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1654">1654</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1655">1655</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1656">1656</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1657">1657</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1658">1658</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1659">1659</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1660">1660</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1661">1661</a></span>
<span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1682">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1683">1683</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1684">1684</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1685">1685</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1686">1686</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1687">1687</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1688">1688</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1689">1689</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1690">1690</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1691">1691</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/24ca9b035ef69f289ca6faa5220633529e636226#L0R1692">1692</a></span>
</pre>
            </th>
            <td class="diff-content" style="border: 1px solid #aaa">
<pre style="border: 0; font-family: Consolas, Menlo, &quot;Liberation Mono&quot;, Courier, monospace; line-height: 1.2; margin: 0; padding: 0.5em; white-space: normal; width: auto"><span class="diff-hunk-header" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">@@ -1651,9 +1651,11 @@ <span class="diff-context" style="background-color: #ffffaa; color: #000000">grn_ctx_qe_exec_uri(grn_ctx *ctx, const char *path, uint32_t path_len)</span></span>
<span class="diff-not-changed" style="display: block; white-space: pre">   if (!GRN_TEXT_LEN(&amp;buf)) { GRN_TEXT_SETS(ctx, &amp;buf, INDEX_HTML); }</span>
<span class="diff-not-changed" style="display: block; white-space: pre">   v = GRN_TEXT_VALUE(&amp;buf);</span>
<span class="diff-not-changed" style="display: block; white-space: pre">   grn_str_get_mime_type(ctx, v, GRN_BULK_CURR(&amp;buf), &amp;key_end, &amp;filename_end);</span>
<span class="diff-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre">-  if ((GRN_TEXT_LEN(&amp;buf) &gt;= 2 &amp;&amp; v[0] == 'd' &amp;&amp; v[1] == '/') &amp;&amp;</span>
<span class="diff-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre">-      (expr = grn_ctx_get(ctx, v + 2, key_end - (v + 2))) &amp;&amp;</span>
<span class="diff-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre">-      command_proc_p(expr)) {</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+  if ((GRN_TEXT_LEN(&amp;buf) &gt;= 2 &amp;&amp; v[0] == 'd' &amp;&amp; v[1] == '/')) {</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+    const char *command_name = v + 2;</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+    int command_name_size = key_end - command_name;</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+    expr = grn_ctx_get(ctx, command_name, command_name_size);</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+    if (expr &amp;&amp; command_proc_p(expr)) {</span>
<span class="diff-not-changed" style="display: block; white-space: pre">     while (p &lt; e) {</span>
<span class="diff-not-changed" style="display: block; white-space: pre">       int l;</span>
<span class="diff-not-changed" style="display: block; white-space: pre">       GRN_BULK_REWIND(&amp;buf);</span>
<span class="diff-hunk-header" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">@@ -1681,6 +1683,10 @@ <span class="diff-context" style="background-color: #ffffaa; color: #000000">grn_ctx_qe_exec_uri(grn_ctx *ctx, const char *path, uint32_t path_len)</span></span>
<span class="diff-not-changed" style="display: block; white-space: pre">     }</span>
<span class="diff-not-changed" style="display: block; white-space: pre">     ctx-&gt;impl-&gt;curr_expr = expr;</span>
<span class="diff-not-changed" style="display: block; white-space: pre">     grn_expr_exec(ctx, expr, 0);</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+    } else {</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+      ERR(GRN_INVALID_ARGUMENT, &quot;invalid command name: %.*s&quot;,</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+          command_name_size, command_name);</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+    }</span>
<span class="diff-not-changed" style="display: block; white-space: pre">   } else if ((expr = grn_ctx_get(ctx, GRN_EXPR_MISSING_NAME,</span>
<span class="diff-not-changed" style="display: block; white-space: pre">                                  strlen(GRN_EXPR_MISSING_NAME)))) {</span>
<span class="diff-not-changed" style="display: block; white-space: pre">     if ((val = grn_expr_get_var_by_offset(ctx, expr, 0))) {</span>
</pre>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </body>
</html>