couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Weber <scotty2...@sbcglobal.net>
Subject Re: API to Update httpd_db_handlers in Config
Date Fri, 31 Jan 2014 19:26:57 GMT
That was one iteration I missed.  It worked.  Thanks.

The extra backslash was my edit error in the email.  Striping out internal function names.


"\{couch_httpd_external, handle_external_req, <<'my_function'>>\}"
"\"{couch_httpd_external, handle_external_req, <<'my_function'>>\}\""
"{couch_httpd_external, handle_external_req, \<\<'my_function'\>\>}"
"\{couch_httpd_external, handle_external_req, <<\"my_function\">>\}"
'"couch_httpd_external, handle_external_req, %3C%3C%22my_function%22%3E%3E"'

Just to name a few.




________________________________
 From: muji <freeformsystems@gmail.com>
To: user@couchdb.apache.org; Scott Weber <scotty2541@sbcglobal.net> 
Sent: Friday, January 31, 2014 1:09 PM
Subject: Re: API to Update httpd_db_handlers in Config
 

I think the additional backslash before the > is causing the problem, try:

"{couch_httpd_external, handle_external_req, <<\"my_function\">>}"

This works for me:

echo '"{couch_httpd_external, handle_external_req, <<\"my_function\">>}"' |
jsonlint

Whilst:

echo '"{couch_httpd_external, handle_external_req, <<\"my_function\"\>>}"'
| jsonlint

Fails.


On 1 February 2014 02:30, Scott Weber <scotty2541@sbcglobal.net> wrote:

> How does one perform am API based update to the "httpd_db_handlers"
> section of the config.
>
>
> Given something like this:
>
>
> [httpd_db_handlers]
> _my_function = {couch_httpd_external, handle_external_req,
> <<"my_function">>}
>
> I try to update it with:
>
>   couchSend( "PUT /_config/httpd_db_handlers/_my_function",
>
>      "{couch_httpd_external, handle_external_req, <<\"my_functioni\"\>>}"
> );
>
> If failing with a "invalid JSON"...  Which I can see that it is.
> It logs  "lexical error: invalid char in json text.\n"}},  But doesn't
> tell me which character it doesn't like.
>
>
> However, I was able to update something else like this:
>
>      couchSend( "PUT /_config/log/include_sasl",
>
>       "\"false\"" );
>
> And it works fine.
>
> Without wasting a bunch of bandwidth telling ALL the different ways I have
> tried to escape the quotes, added extra quotes, encoded angle brackets,
> braces, tried using text/plain, text/html, etc... (or tell my boss how much
> it cost him while I am trying all different these ways, and doing web
> searches)  I figure I'll just give up and ask.  :-)
>
>
> How does one encode the following string for an API based config update?
>
>     {couch_httpd_external, handle_external_req, <<"my_function">>}
>
> Thanks.
> -Scott
>



-- 
mischa (aka muji).
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message