chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug passing a % sign to uri-common / spiffy


From: Kristian Lein-Mathisen
Subject: Re: bug passing a % sign to uri-common / spiffy
Date: Tue, 4 Jan 2022 08:39:16 +0100


Hi,

Are you calling intarweb#read-urlencoded-request-data [1] with the JSON data? I think that procedure only handles form-data. You have to parse JSON yourself, using json,medea or cjson.

[1] http://api.call-cc.org/5/doc/intarweb/read-urlencoded-request-data

K.

On Tue, Jan 4, 2022, 05:21 masukomi <masukomi@masukomi.org> wrote:
I'm working on a small webapp with a JSON api. I've stumbled across a bug where I can't POST JSON with a % sign in it or it'll blow up.

for example if i POST this json:

```
{
"foo": "%"
}
```

i get this stack trace
```
[Mon Jan  3 23:08:44 2022] "POST http://localhost:5749/json/sanity-check/ HTTP/1.1" Error: (string->symbol)
bad argument type - not a string
#f

[bunch of irrelevant stuff]
router.scm:249: intarweb#read-urlencoded-request-data
spiffy.scm:509: k625
spiffy.scm:497: g628
spiffy.scm:511: handle-exception
spiffy.scm:512: chicken.port#with-output-to-string
```

(router.scm is mine)

Unfortunately that section of spiffy is a long and complex method and the error handler is surrounding a LOT of functionality, so it's not clear to what's blowing up.

I tried bringing the uri-common.scm (since it seems plausible that this is a decoding issue) and spiffy.scm into my project and compiling them into the app (one at a time) but I always end up with this error:

```
Error: during expansion of (import-syntax ...) - unbound variable: ����
```

I'm happy to debug things but I could really use some help. Maybe if someone could tell me the magic incantation to include a file from an egg without that error so that I could then start breaking it down and eliminating problems?


Any insight would be appreciated.
Thanks.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]