Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 09 2018 10:04
    Ogeon closed #134
  • Jun 09 2018 10:03
    Ogeon commented #134
  • Jun 08 2018 19:35
    Camille019 synchronize #134
  • Jun 08 2018 19:16
    Camille019 opened #134
  • Sep 08 2017 16:08
    Ogeon labeled #133
  • Sep 08 2017 16:08
    Ogeon labeled #133
  • Sep 07 2017 22:30
    Ogeon commented #133
  • Sep 07 2017 22:14
    fintelia commented #133
  • Sep 07 2017 21:35
    fintelia commented #133
  • Sep 07 2017 18:26
    Ogeon commented #133
  • Sep 06 2017 14:36
    fintelia opened #133
  • Aug 29 2017 21:11
    greenpdx commented #132
  • Aug 29 2017 21:11
    greenpdx closed #132
  • Aug 29 2017 19:19
    Ogeon commented #132
  • Aug 29 2017 18:47
    greenpdx opened #132
  • Aug 26 2017 21:20
    Ogeon commented #131
  • Aug 26 2017 21:04
    greenpdx closed #131
  • Aug 26 2017 21:04
    greenpdx commented #131
  • Aug 26 2017 19:45
    Ogeon commented #131
  • Aug 26 2017 18:28
    greenpdx commented #131
Erik Hedvall
@Ogeon
It depends on how advanced stuff you want to do. #71 requires you to dig a bit in the structures, so it's a good start.
Vikas Kumar
@kvikas
So for #71 is the target to remove internal log module and start using Log from crate?
Erik Hedvall
@Ogeon
Yes, exactly
Vikas Kumar
@kvikas
Ok. Let me go through the code. I'll ping you or comment on the issue with my approach before implementing anything. I'm new to rust. And I'm taking this up as part of learning rust.
Erik Hedvall
@Ogeon
Ok, sounds good. You can also start with #70 if you want to start with something lighter, but I don't think it'll be too complicated. The compiler will tell you when things don't work :smile: It's also totally ok to submit a pull request even if it's not a complete implementation. It's easier to review the changes that way.
Vikas Kumar
@kvikas
@Ogeon can you take a look at PR #74, test failed: https://travis-ci.org/Ogeon/rustful/jobs/85868402 . Looks like an temporary glitch.
Erik Hedvall
@Ogeon
Yeah, I restarted it
Vikas Kumar
@kvikas
Cool thanks. Needed some help with #70 also. It doesn't look like Box<T> can be implemented generically if there is an implementation for Fn() in scope. Box<Handler> as you suggested also did not work.
Erik Hedvall
@Ogeon
Ugh... Ok, that's annoying. Did Box<Handler> trigger the same error?
It should work
...unless I'm missing somehting
Vikas Kumar
@kvikas
No, it triggers 'error: the trait for<'r, 'r, 'r, 'r, 'r> core::ops::Fn<(rustful::context::Context<'r, 'r, 'r>, rustful::response::Response<'r, 'r>)> is not implem
ented for the type Box<PackagedHandler> [E0277]'
Erik Hedvall
@Ogeon
Ah, yeah, you have to cast it to Box<Handler>
Box::new(my_handler) as Box<Handler>
Vikas Kumar
@kvikas
Hmm ok. Don't know how casting works in rust yet
k, will try that
Erik Hedvall
@Ogeon
That will erase the concrete type PackagedHandler and turn it into a trait object
in case you haven't
Vikas Kumar
@kvikas
yeah that worked :-)
I'll commit changes
Erik Hedvall
@Ogeon
:+1:
The point of implementing Handler for Box<Handler> is to allow several different boxed handler types to be stored in the same router.
Kevin King
@kcking
Heya -- I'm loving thislibrary! Does Rustful have any sort of automatic logging including response codes?
Erik Hedvall
@Ogeon

That's great! Thank you!

No, nothing built in. You could, however, use a ResponseFilter to do it. Take a look at the filters example for something similar.

Kevin King
@kcking
Ah great, thanks for the pointer!
Erik Hedvall
@Ogeon
You're welcome. The filters have been quite neglected, so the API may be a bit rough. Feel free to let me know if you have any more questions or feedback :smile:
Kevin King
@kcking
I am trying to log the response body only when there is a 4xx or 5xx, but it seems StatusCode is not passed to Handler::write -- is there a specific reason? (Maybe it's not semantically a good thing?) I could store whether the request was an error in the FilterContext but that seems roundabout.
Kevin King
@kcking
Just got it working, using the AnyMap is pretty convenient :)
Erik Hedvall
@Ogeon

Do you mean ResponseFilter::write? That's mostly because the headers and the status code has to be handed over to the HTTP backend, so keeping them around would also require them to be cloned. Cloning the status code is trivial in most cases, but cloning the headers can be much more expensive.

Anyway, seems like you found out why that AnyMap is there :smile: Sure, it's a roundabout, but I'm not sure if the alternative is better.

andrewspinks
@andrewspinks
Hey guys, I am getting the following build error when building for the iOS simulator (x86_64-apple-ios):
out/mime.rs": No such file or directory (os error 2)
rustful-0.8.0/src/file.rs:7 include!(concat!(env!("OUT_DIR"), "/mime.rs"));
Sorry, but I'm a complete rust newb.
Works fine when not changing the target to ios.
Erik Hedvall
@Ogeon
Hmm... looks like the build script doesn't run properly, which may also be a cargo related problem, but I don't know off the top of my head. I'm in a hurry at the moment, but I may get back to you later and check what's happening.
andrewspinks
@andrewspinks
Cheers, apparently cross compiling doesn't work either
Erik Hedvall
@Ogeon
That is, after work, so it will take hours. Feel free to open an issue if you want to move it out of the chat.
andrewspinks
@andrewspinks
Will do. Thanks!
Erik Hedvall
@Ogeon
Alright. I'll appreciate it if you can provide as much details as possible. See ya!
Roman FroĊ‚ow
@rofrol
Hi everyone
Is it possible to make a request with rustful?
Or do I have to use hyper?
What I want is get some json from the web
Erik Hedvall
@Ogeon
Rustful is only a server library, so you will have to use hyper or curl, or something else
Davis Silverman
@sinistersnare
Hey! Was going thru the documentation, and it seems like the issue in hyper listed in your docs is solved (https://ogeon.github.io/docs/rustful/master/rustful/server/struct.Listening.html)
Erik Hedvall
@Ogeon
Oh, I had completely forgotten about it. Thanks for reminding me :smile: Would you mind opening an issue about it?
Davis Silverman
@sinistersnare
It is fixed on master, seems Hyper needs to cut a new release
:D
Erik Hedvall
@Ogeon
Thanks, I'll continue the discussion there :)