Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Andy Russell
    @euclio
    @windyslove probably a problem with your internet
    Denis Lisov
    @tanriol
    How does Nickel use threads? Does it use a fixed-size thread pool?
    I expect my server to have several long-running responses (proxying a data stream for hours). Do I need to somehow ensure that they don't occupy all threads and block new requests? The trivial "spawn a new thread and pass the Response to it" seems not to work.
    Simon Persson
    @SimonPersson
    @tanriol - It does use a fixed size thread pool, yes. There's an pull request that would enable you to add more threads, nickel-org/nickel.rs#309, but depending on how many connections you expect that might not be enough. In that case, you will have to wait for a change in hyper, discussed here: hyperium/hyper#395.
    Serejka
    @serejkaaa512
    Hello everyone. I've got a question - if i want to get param from request params, like this "/generator/:id/set_freq/:freq", where freq is float, i get all till "." For example if i send "3.5" - i get "3". Maybe someone has already done this, but i didn't find. Thanks.
    if using regex, all is ok.
    Denis Lisov
    @tanriol
    Does the middleware! macro intentionally prevent moving the Response into the closure with the restrict function? I'm trying to have a loop sending data inside the closure and getting errors about this.
    Ryman
    @Ryman
    @serejkaaa512 I think you're encountering the added :format parameter, you should be able to find the '.5' in req.param("format"), see here for example: https://github.com/nickel-org/nickel.rs/blob/master/examples/routing.rs#L26-L27
    @tanriol you should be able to use your loop and then return <MiddlewareResult> e.g. return res.send("") which will short circuit the macro and not call restrict
    Serejka
    @serejkaaa512
    @Ryman thanks. That works, but it's not obvious. :)
    Denis Lisov
    @tanriol
    @Ryman, found the cause. The argument of middleware!looks like a closure, but is actually used as a block; return and leaving out semicolon on the last line work in different ways. This point probably needs to be documented somewhere.
    Denis Lisov
    @tanriol
    Is anyone actually looking into #310 / #309 / #277 ? The latest one at least seems to be stalled for no reason...
    Simon Persson
    @SimonPersson
    @tanriol - We've been a bit inactive. I just went ahead and merged #310, once #309 is rewritten to use that I'll merge that as well.
    Ghost
    @ghost~56ba344de610378809c0a277
    Will the auth middleware be available anytime soon?
    Ryman
    @Ryman
    @snadon Sorry, we had an exploratory branch here: nickel-org/nickel-auth#1 but we've kind of let it.. rust If you'd like to review it to see if it's fit for your purposes that would probably help carry things along!
    Ghost
    @ghost~56ba344de610378809c0a277
    @Ryman Ok I'm gonna take a look thanks!
    Mathieu De Coster
    @m-decoster
    This message was deleted
    rvolgers
    @rvolgers
    Hi, are there some examples of using Nickel without coding all the handlers inline using the middleware! macro?
    I'm trying to have my handlers just be normal functions, but the lack of the Responder wrapping and the fact the NickelError wants to take ownership of the response means I literally cannot think of a way to use normal .map_err techniques to do error handling
    so how do I do error handling when not using the middleware! wrapper? am I missing something?
    rvolgers
    @rvolgers
    Here's an example of how verbose my error handling gets: http://pastebin.com/7jLAeCSL
    Regis Boudinot
    @selfup
    Quick question, just to see the level of interest. I am working on a JSON Key Value store, which would be great for something like nickel, and was wondering how interested you all would be? It's not quite ready yet, but we are getting close!
    Ryman
    @Ryman
    @selfup It sounds like an interesting project. Is there something nickel specific you need feedback about?
    Kevin King
    @kcking
    Has anyone used nickel to allow login with client ssl certs? I couldn't find an example or middleware
    Regis Boudinot
    @selfup

    @Ryman Just wanted to know if it was attractive enough for people who use nickle on small projects or micro-services.

    So far some of our read/writes (for basic unserialized json) are < 1 microsecond.

    The library itself handles serialization through serde, which is unfortunately geared towards nightly. But it offers developers to make very easy function calls and manipulate data as long as they have a basic schema of public facing structs so the library can infer the Type.

    Making it work with stable, will require some work, but we aren't ready to release just quite yet, so we shall cross that bridge when we get there.

    Everything so far is faster than I anticipated, so that is why I want to see the level of interest for a plug and play library that let's users have a flexible (however project bound) JSON Key Value Store.

    Here are some benchmarks: https://cloud.githubusercontent.com/assets/9837366/16293601/7be59d6c-38d8-11e6-9016-71d42932bc0f.png

    We have since changed the function names to make more sense. So take the names with a grain of salt for now haha :smile:

    Regis Boudinot
    @selfup
    Also, that benchmark is a bit old. It doesn't have the ~800ns unserialized JSON read/write for tables
    Ryman
    @Ryman
    @kcking I haven't heard anyone working on it, perhaps there's something available for hyper which could be adapted?
    I keep getting this error: thread '<unnamed>' panicked at 'Unclosed section', /home/dannyfritz/.cargo/registry/src/github.com-1ecc6299db9ec823/mustache-0.6.3/src/parser.rs:406
    Ryman
    @Ryman
    @dannyfritz The render method only supports mustache currently (I'm surprised the doccomment actually doesn't mention that). There's an open issue for adding handlebars if you'd like to follow: nickel-org/nickel.rs#305
    Danny Fritz
    @dannyfritz
    oooo. thanks!
    Sklopi
    @sklopi
    hi guys, i'm writing a postgresql session storage for my nickel.rs application. i'm asking myself why hyper is not reexported in nickel? i think it would be nice if i didn't have to import the exact version of hyper nickel is using
    Iban Eguia
    @Razican
    Hi! I have one question regarding templating. Can I create multiple templates and join them? I mean, one for header, one for footer... And then change the body template for each request. Oh, and can I use some sort of for loop to show multiple objects of the same type in the template engine?
    Thanks in advance!
    Denis Lisov
    @tanriol
    Mustache's documentation suggests {{> included_file}} for includer and {{#some_list}}<b>{{item}}</b>{{/some_list}} for iteration.
    Denis Lisov
    @tanriol
    By the way, there are some changes in master after the 0.8.1 release, including breaking ones. What are the plans for the next release?
    Zeppelin
    @zpallin
    @Razican I guess it would depend on the template language. For mustache, it's just implemented in the template itself. https://thomassundberg.wordpress.com/2015/06/19/include-header-and-footer-in-a-mustache-template/
    @cburgdorf Hey! I noticed you're sort of doing some work with nickel recently, so would you be able to elaborate on the status of development for this repo? I'm new to this repo and in general Rust, but I would like to get involved somehow and it seems like the repo is mostly inactive atm.
    Rust
    @LooMaclin
    hi all
    when i try to send with axios POST request to nickel-backend-service i'm get error with message "XMLHttpRequest cannot load http://localhost:8081/sample. Response for preflight has invalid HTTP status code 404" in browser console. In nickel-backend i'm enable cors.
    @Ryman @cburgdorf can you help me?
    Sebastian Blei
    @iamsebastian
    Go into your browser, copy the Request as cURL and paste it here.
    When your preflight get responded with 404, than there's no CORS enabled, maybe.
    Rust
    @LooMaclin
    @iamsebastian ok
    curl 'http://localhost:8081/sample' -X OPTIONS -H 'Access-Control-Request-Method: POST' -H 'Origin: http://localhost:8080' -H 'Accept-Encoding: gzip, deflate, sdch, br' -H 'Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.90 Safari/537.36' -H 'Accept: */*' -H 'Referer: http://localhost:8080/login' -H 'Connection: keep-alive' -H 'Access-Control-Request-Headers: content-type' --compressed
    Sebastian Blei
    @iamsebastian
    Can you show the code of your CORS implementation?
    Rust
    @LooMaclin
    @iamsebastian yep
    i'm change example in nickel repo. add allowing methods
    fn enable_cors<'mw>(_req: &mut Request, mut res: Response<'mw>) -> MiddlewareResult<'mw> {
        // Set appropriate headers
        res.set(AccessControlAllowOrigin::Any);
    
        res.set(AccessControlAllowMethods(vec![
            Method::Get,
            Method::Post,
            Method::Options,
            Method::Delete,
            ])
        );
        res.set(AccessControlAllowHeaders(vec![
        // Hyper uses the `unicase::Unicase` type to ensure comparisons are done
        // case-insensitively. Here, we use `into()` to convert to one from a `&str`
        // so that we don't have to import the type ourselves.
        "Origin".into(),
        "X-Requested-With".into(),
        "Content-Type".into(),
        "Accept".into(),
        ]));
    
        // Pass control to the next middleware
        res.next_middleware()
    }
    Sebastian Blei
    @iamsebastian
    Yeah, looks original.
    Can you post the code of your Router?