18:56:06 <rostayob> stepkut, stepcut: it turns out that pcdata is not what I need :P 18:56:13 <rostayob> I just want to embed an html string into hsp 18:56:19 <rostayob> without hsp converting all the html chars 19:06:01 <stepcut> rostayob: must be cdata then.. 19:11:05 <rostayob> stepcut: oh, right :P 19:11:07 <rostayob> thanks 19:11:15 <stepcut> no problem 19:12:22 <rostayob> stepcut: wait a sec defaultbodypolicy is in bytes? 19:13:00 <rostayob> yes 19:13:26 <stepkut> yep 19:13:40 <rostayob> stepkut: is there a way to display a nice message when the request is too big? 19:13:40 <stepkut> would millibytes be better? 19:14:22 <stepkut> ACTION ponders 19:14:25 <rostayob> stepkut: picobytes 19:16:06 <rostayob> stepkut: anyway, i'm going to have dinner, don't ponder too much ehe 19:16:30 <stepkut> you can call bodyInput directly, and it returns an error 19:16:36 <stepkut> decodeBody :: (ServerMonad m, MonadPlus m, MonadIO m) => BodyPolicy -> m () 19:16:37 <stepkut> decodeBody bp = 19:16:37 <stepkut> do rq <- askRq 19:16:39 <stepkut> (_, me) <- bodyInput bp rq 19:16:43 <stepkut> case me of 19:16:46 <stepkut> Nothing -> return () 19:16:49 <stepkut> Just e -> fail e -- FIXME: is this the best way to report the error 19:16:52 <stepkut> 19:24:07 <stepkut> as the comment indicates, it would be nice if there was a better way to report the error 19:24:36 <stepkut> perhaps it could return, Maybe Error. Though it always feels funny to use 'Just' for failure and 'Nothing' for success 20:21:15 <rostayob> stepkut: oh, fair enough. I could just redeclare decodeBody then. 20:21:49 <rostayob> the thing is then, i've got a limit of 20KB on the request, but if the user submits a really long post, it gets that ugly error 20:22:00 <stepkut> right 20:22:28 <stepkut> what do you think should happen instead ? 20:22:51 <rostayob> stepkut: i'd have a function that handles the error if an error happens 20:23:04 <rostayob> i mean something really simple 20:23:09 <rostayob> the URL would be there anyway 20:23:14 <stepkut> decodeBody should take an extra argument that is an error handler? 20:24:31 <rostayob> stepkut: I don't know if that's the best way for everyone, but I think that's what I would do. either that, or as you said decodeBody gets a function that processes a Maybe Error 20:24:56 <rostayob> but these things are impossible to get right for everyone I guess. 20:25:29 <stepkut> (_, me) <- bodyInput bp =<< askRq 20:25:36 <stepkut> that will give you a maybe error 20:25:51 <stepkut> could be better though 20:26:11 <stepkut> me <- snd <$> bodyInput bp =<< askRq 20:26:28 <stepkut> but the normal decodeBody should probably do something better I guess 20:27:09 <stepkut> instead of calling fail, it could raise an extensible exception that you could optionally catch 20:27:46 <rostayob> stepkut: mh. that would be harder to integrate in the page generation, because for me the page generation would be very similar 20:27:58 <rostayob> considering that taht error will apear only in forms 20:28:10 <rostayob> I'd just append an error to the form 20:28:21 <stepkut> yeh 20:28:22 <stepkut> yeah 20:29:21 <stepkut> though, you may call decodeBody some place rather far from where you actually do the form processing 20:29:42 <rostayob> stepkut: that's true. maybe in eitherHappstackForm 20:29:44 <rostayob> just before 20:29:52 <rostayob> yeah that's a better idea maybe. 20:30:25 <stepkut> eitherHappstackForm does not call decodeBody at all 20:30:43 <rostayob> I know, but you could have a decoding eitherHappstackForm :P 20:30:47 <rostayob> that handles the error 20:31:39 <stepkut> in what way would it handle it ? 20:32:00 <rostayob> appending the error to the form view if the decoding fails 20:33:03 <stepkut> that will be dependent on the type of 'e' I believe.. 20:33:28 <rostayob> stepkut: well if the request body is too big, it would display an error, else fail 20:34:09 <stepkut> display an error, but not the rest of the form? 20:34:33 <rostayob> why not? it'd be displayed as any other validation error 20:34:43 <rostayob> at least in my case that would be enough 20:35:22 <rostayob> oh wait. the error is a simple string 20:35:30 <rostayob> that would make things a little bit harder i guess 20:36:04 <stepkut> in the existing decodeBody we could change, Just e -> fail e -- FIXME: is this the best way to report the error, to be, Just e -> requestEntityTooLarge (toResponse e) 20:36:44 <stepkut> (where requestEntityTooLarge is http response code 413) 20:37:31 <stepkut> http://www.checkupdown.com/status/E413.html 20:37:49 <stepkut> (we need an 'escape' in there as well) 20:37:52 <rostayob> stepkut: yeah but i'd just like to make the user understand that he the mesage he typed is too long 20:37:55 <rostayob> exactly 20:38:03 <stepkut> Just e -> escape $ requestEntityTooLarge (toResponse e) 20:38:25 <stepkut> on moment 20:39:35 <stepkut> import Happstack.Server 20:39:35 <stepkut> main = simpleHTTP nullConf $ resp 413 "OMG! It's freakin' huge!!" 20:39:49 <rostayob> that's what... whatever 20:40:32 <rostayob> that would be nicer that what we have now ehe 20:41:05 <stepkut> so, the actually error would be something like, Reached disk quota of " ++ show maxDisk ++ " bytes. 20:41:12 <rostayob> yeah 20:41:28 <stepkut> we could change those messages to be a little more user friendly as well 20:41:40 <rostayob> i wanted to ask you a couple more things but i slept two hrs so i think i'll watch a movie or something now 20:42:34 <rostayob> so I think I'll speak to you again in the weekend, i wouldn't be of much use now :P 20:42:58 <stepkut> :) 20:47:36 <stepkut> rostayob: pushed a patch, see if that is any better 20:47:49 <stepkut> I did not upload a new version to hackage yet 20:48:23 <rostayob> stepkut: cool, i'll get it out of darcs. thanks as always 20:49:15 <stepkut> thanks for reporting problems :) 20:49:28 <stepkut> can't fix issues if I don't know about them ;) 20:54:41 <rostayob> eheh 20:54:50 <rostayob> but it's really nice to have a developer that listens 20:54:58 <rostayob> it's not always like this 21:07:36 <stepcut> well, so far you have only asked for reasonable things ;) 21:17:37 <rostayob> yeah but for some reason some developers/mantainers of oss projects can be really unwelcoming. most of the times is not like that anyway, people are nice ehehe 21:18:48 <stepcut> heh 21:19:41 <rostayob> anyway, i'm off, keep up the good work 22:28:50 <Lemmih> heh 22:29:00 <Lemmih> My thoughts exactly.