Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 03 15:25
    msrd0 synchronize #543
  • Jun 03 15:24
    msrd0 synchronize #539
  • Jun 03 15:23
    msrd0 synchronize #538
  • Jun 03 15:21
    msrd0 synchronize #538
  • Jun 03 15:16
    codecov[bot] commented #537
  • Jun 03 15:16
    msrd0 synchronize #537
  • Jun 03 13:18

    msrd0 on master

    Bump insecure time dependency (… (compare)

  • Jun 03 13:18
    msrd0 closed #546
  • Jun 03 13:03
    msrd0 labeled #546
  • Jun 03 13:03
    msrd0 opened #546
  • Jun 03 12:56

    msrd0 on update-rand-to-0.7

    (compare)

  • Jun 03 12:54

    msrd0 on remove-skeptic-from-borrow-bag

    (compare)

  • Jun 03 12:54

    msrd0 on 0.2.1-port-to-master

    (compare)

  • Jun 03 12:54

    msrd0 on cargo-description-update

    (compare)

  • Jun 03 12:54

    msrd0 on query-string-split-fixes

    (compare)

  • Jun 03 12:53

    msrd0 on move-from-irc-to-gitter

    (compare)

  • Jun 03 12:52

    msrd0 on 0.1-maint-backport

    (compare)

  • Jun 01 13:09

    msrd0 on cargo

    (compare)

  • Jun 01 13:09

    msrd0 on master

    Update nix requirement from 0.2… (compare)

  • Jun 01 07:54

    dependabot[bot] on cargo

    Update nix requirement from 0.2… (compare)

Judson Lester
@nyarly
(well... there's some construct going on in there, and Pilelines -> PipelineInstances and NewMiddlewareChain -> MiddlewareChain but that confuses the issue)
When a pipeline gets called during a request, we instantiate what amounts to a list of lists, and then do a depth first walk with the (state, request) pair, and then walk back with the result.
Judson Lester
@nyarly
I mean really, it's all function composition, not list walking, and the weirdest part (which I'm still trying to get my head around) is how PipelineHandleChains compose with MiddlewareChains since both convert a cadr-style list into function composition, with (state,request) running down the side.
Finally, I don't understand why it has to be, but the MiddlewareChain itself is declared unsafe
So my primary research question now is: could the PLHC refer directly to Middleware - or some new middleware-type that's available to be implemented directly, but there's an adapter for old style Middleware
Judson Lester
@nyarly
Step one being: could that produce a related composition?
Judson Lester
@nyarly
IIRC, many of these types aren't public - Middleware is, and PLHC is. But I wonder if we could simplify there and not break anything.
Judson Lester
@nyarly
Okay, for sure pipelinechains of middlewarechains are equivalent to a single MWchain composed by concatenation.
So I think it should be refactorable.
Unless anyone understands different?
Stefan Schindler
@dns2utf8
Hello folks,
I am writing a verification tool that needs to fetch some data over HTTPS when the user pushes a button in the WebUI. Can I do that in gotham? Can I do that in a normal POST handler?
Dominic
@msrd0:msrd0.de
[m]
So you're basically asking for a web server that replies to POST requests? You can definitely do that with gotham
Alex Hansen
@sezna
Hey, sorry for being absent for a while, I moved and had some stuff. @msrd0_gitlab I see your ping about the next release now, if you want to chat about it.
Judson Lester
@nyarly
Has anyone been using the async-trait crate with Gotham?
Alex Hansen
@sezna
i haven't, are you encountering an issue with it?
Judson Lester
@nyarly
No, but as I've been investigating pipeline/middleware space, it seems like a natural fit for implementing Handler structs.
Might be a call for a new trait like AsyncHandler or something that has a blanket Handler implementation
Dominic
@msrd0:msrd0.de
[m]
I don't remember what that ping was about, can't be that important
Judson Lester
@nyarly
analogous to how async fn transforms async fn -> Result to (something like) fn -> Pin<Box<Future<Result>>>
Dominic
@msrd0:msrd0.de
[m]
iirc async-trait is just a convenience macro, so using it or not should be independent from gotham?
Alex Hansen
@sezna
correct, it just parses the async/await syntax on your function so you can define a trait with async syntax
should work fine
Denis Lisov
@tanriol
Note that in the current state of Rust async trait adds a level of Boxing, AFAIK.
Judson Lester
@nyarly
Isn't that every async though?
Or is async just Pin<Future<T>>?
Dominic
@msrd0:msrd0.de
[m]
no that's just a limitation of traits where you cannot return impl Future
afaik async fn foo() -> Result translates to fn foo() -> impl Future<Output = Result> with no boxing involved, and the concrete type being inferred by the compiler (and which is also some autogenerated private type)
Stefan Schindler
@dns2utf8
@msrd0:msrd0.de and all:
Sorry for the late reply. What I want is the webserver responding to a post request by making another get request
So my scenario is this:
Client --{POST}--> GothamServer --{GET}--> some other server with the information I need to answer the client
Dominic
@msrd0:msrd0.de
[m]
yes that's certainly possible. gotham would be the part that communicates with the client, and then you'd use a client library like reqwest or surf to make your get request inside the handler
Rodrigo Batista
@rodrigodevelms
Hi folks. Gothan ready to build a ERP system?
Alex Hansen
@sezna
Sure. It's a capable web framework. I suspect for an ERP system, you'll be spending more of your time in database and UI code than in your web server code.
Jan Mazur
@mzr
Hi. I have an already established connection (AsyncRead + AsyncWrite). Based on some initial data received I would like to either proceed with a custom logic or plug it into gotham to handle http. Is that possible with gotham? Could you point me into right direction how to do that?
tanriol
@tanriol:matrix.org
[m]
@mzr: Probably not out of the box. I'd suggest looking at bind_server (source) to see (a) if it would be enough, (b) how it's dont internally.
Chris Emerson
@jugglerchris
Hi. Is there a convenient way to run tests with an sqlite in-memory database? I could pass ":memory:" to Repo::new(), but it's not obvious how to run the diesel migrations.
Marwan Rabbâa
@waghanza
Hi,
Their is something I don't understand in Cargo.lock, should not in fix / expose feature from hyper ? I have no rust skill but hyper is in 0.14 so we need to fix version in Cargo.toml
the-benchmarker/web-frameworks#3690
Dominic
@msrd0:msrd0.de
[m]
@waghanza: gotham re-exports the hyper crate, so I strongly advise you use gotham::hyper and don't depend on your own version of hyper
@jugglerchris: I don't think the diesel middleware currently supports this, so for now your best bet is probably to create a temporary file and use that as the database. Feel free to open an issue/PR to improve this
Marwan Rabbâa
@waghanza
@msrd0:msrd0.de May I ask yo to review above PR, please
Chris Emerson
@jugglerchris
@msrd0:msrd0.de Thanks - a temporary file is fine but slightly unsatisfying - but no biggie.
Chris Emerson
@jugglerchris
Next question... what do people use for the session middleware backend? I guess it's probably not much effort wrapping a gotham_middleware_diesel table, but I guess I'd expect someone to have done so already. :-) (In the absence of a pre-existing one the MemoryBackendwill realistically be fine for my one-off application for a child's distributed birthday party)
Dominic
@msrd0:msrd0.de
[m]
it looks like travis currently refuses to run on our repository - does anyone know why that is?
Sean Pianka
@seanpianka
Hello, should I be using hyper included in my cargo.toml, or the re-exported hyper from gotham?
Dominic
@msrd0:msrd0.de
[m]
@seanpianka: I don't think you need to include hyper in your Cargo.toml file if you use gotham
Michael House
@mjhouse
Hey, does gotham have any support for error handlers? (404,500 etc.)
Dominic
@msrd0:msrd0.de
[m]
@mjhouse: that depends... for a 404 returned by the router because there was no matching path, there's no convenient way to catch that error unfortunately. For other errors like 500, assuming they're not caused by a panic, you could use a middleware that checks the returned response from the handler and creates a new response if it was a server error
Michael House
@mjhouse
@msrd0:msrd0.de yeah, I did that. For deliberate failures (a handler fails to find a template or something) it works fine. But when the user goes to a page that doesn't exist, I just get a white screen and a 404 in the console.
Is there a way I can wildcard capture all routes that don't have a handler?