Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 17 19:13

    robjtede on master

    tweak migration document (compare)

  • Feb 17 08:12
    stanley355 commented #2650
  • Feb 17 01:07
    stanley355 commented #2650
  • Feb 16 14:10
    robjtede commented #2650
  • Feb 16 14:09
    robjtede labeled #2650
  • Feb 16 14:09
    robjtede closed #2650
  • Feb 16 14:09
    robjtede commented #2650
  • Feb 16 12:53
    stanley355 opened #2650
  • Feb 16 03:44

    github-actions[bot] on gh-pages

    Deploying to gh-pages from @ 5… (compare)

  • Feb 16 03:32

    github-actions[bot] on gh-pages

    Deploying to gh-pages from @ f… (compare)

  • Feb 16 03:13

    robjtede on test-v0.1.0-beta.13

    (compare)

  • Feb 16 03:13

    robjtede on http-test-v3.0.0-beta.13

    (compare)

  • Feb 16 03:13

    robjtede on master

    prepare actix-http-test release… prepare actix-test release 0.1.… (compare)

  • Feb 16 03:13

    github-actions[bot] on gh-pages

    Deploying to gh-pages from @ a… (compare)

  • Feb 16 03:11

    robjtede on actors-v4.0.0-beta.12

    (compare)

  • Feb 16 03:11

    robjtede on master

    prepare actix-web-actors releas… (compare)

  • Feb 16 03:10

    robjtede on awc-v3.0.0-beta.21

    (compare)

  • Feb 16 03:10

    robjtede on master

    prepare awc release 3.0.0-beta.… (compare)

  • Feb 16 03:07

    robjtede on http-v3.0.0-rc.3

    (compare)

  • Feb 16 03:07

    robjtede on master

    prepare actix-http release 3.0.… (compare)

asonix (he/they)
@asonix:matrix.asonix.dog
[m]
also built-in middlewares is very cool. in reqwest land you need an additional wrapper package reqwest-middleware for that
Ashanti Mutinta
@AshantiMutinta
Awesome thank you!
Biswas Sampad
@biswassampad
Hi Does the actix_rt is required to asyn functions while using actix-web 3 ?
2 replies
vaelio
@vaelio:matarch.fr
[m]
Hello every one
Im trying to make a proxy using actix and while the core functionality works fine i struggle to get the raw data from a HttpRequest (the point being to print it into the user so that he can reproduce/modify the request.
Chris Allison
@ToferC
Hi folks. I'm trying to set up my actix-web app with Docker. I've got the images and containers working, but can't find a way to connect to localhost. I've scoured all of the usual sites, published ports, tried host network, etc., but while the issue seems to be that while the requests are going in, actix isn't serving the response. Has anyone experienced anything like this? Repo is here: https://github.com/ToferC/health_rules_engine
10 replies
asonix (he/they)
@asonix:matrix.asonix.dog
[m]
from a quick glance: everything looks correct. that's certainly a weird bug
binding to 0.0.0.0 inside the container is the right thing to do
i notice you're mappinng 18080 to 8080 in the docker-compose, but that should be okay
what OS / environment are you running this in? is it just linux, or is it macos with docker desktop or windows with wsl
Chris Allison
@ToferC
I’ve tried other port routings and same result. My default is 8088:8088. My base is using docker desktop for Mac and ive tested the same thing on Wsl2 / Ubuntu on my Windows machine.
When watching the traffic, i can see small (2k) traffic going in, but nothing comes back out and ive got a no response screen on browser and nada in console.
Félix
@felix.maneville:qonfucius.team
[m]
Should every endpoint function be async ? Or is it not useful?
1 reply
Xu Desheng
@xudesheng
I'm looking for an example for this use case: 1) website assets have been ready: index.html (1k), index.js(315k), wasm.js(9k), xxx.wasm(300k). 2) I want all assets can be provided as gzip. 3) I want all assets can be automatically gzipped during compiling time and it's part of the final binary file. 4) with this kind of setting, actix-web doesn't need to zip the assets during runtime but still can provide gzipped format to the client. Do we have this kind of example? Thanks.
nicolaujr
@nicolaujr
Hi, I'm looking for a example to setup the X_FRAME_OPTIONS on my server
Could't find anything in the docs
anyone can give me some direction?
Do I need to create a custom middleware to inject the header in every response?
nicolaujr
@nicolaujr
Just found the DefaultHeaders middleware, if anyone is interested
Roshan Rajan
@roshanjrajan
Hi! I was wondering if it is possible to extract the path name to be used for logging purposes. I have many of these created but wanted to keep track of what requests are hit the most. Is there a way to get this information? I am looking to get the string "/api/endpoint1" in the example below.
#[get("/api/endpoint1")] 
async fn api_request() -> Result<String> {
    Ok(String::from("Hello World"))
}
Mehmet ERİBOL
@mehmeteribol_gitlab
Hi. I am using v4 beta 10. It was working couple of days ago but now i get error like this;
#[post("/login")]
async fn post_login(user: Data<LoginUser>) -> Result<HttpResponse, Error> {
    Ok(HttpResponse::Ok().json(1))
}
.service(web::resource("/login").route(web::post().to(post_login)))
   |                                                                -- ^^^^^^^^^^ the trait `Handler<_, _>` is not implemented for `post_login`
   |                                                                |
   |                                                                required by a bound introduced by this call
CKalt
@CKalt
Anyone know how to capture type mismatch errors that result when using the Path information extractor so that I can produce a custom JSON format result instead of the default. For example I would like wrap the default error that gets emited like "Query deserialize error: invalid digit found in string" in a JSON object. But from the doc I'm not seeing how I might do this. I see a section on how to generate my own custom errors, but not how to capture and customize the default errors. Thank you for your help!!
2 replies
Ashanti Mutinta
@AshantiMutinta
Does anyone have an issue with tcp connections not being reused enough? Looks like there is a long standing issue in hyper and I'm trying to circumvent that
Ashanti Mutinta
@AshantiMutinta
Turned off keep alive and it seems to be working now
Ashanti Mutinta
@AshantiMutinta
Nvm looks like some concurrency limiting helps the most
asonix (he/they)
@asonix:matrix.asonix.dog
[m]
what are you using that depends on hyper? Actix Web and AWC don't
Ashanti Mutinta
@AshantiMutinta
My actix service is sending of multiple http requests using requests (one per api call) and im getting address not in use errors after I ramp up my performance testing.
Ashanti Mutinta
@AshantiMutinta
Using reqwest *
Kunjan Dalal
@kunjee17
What is middle ware scene in latest actix 4.0. I still need to use actix-services or something changed? Example of middle ware in actix examples repository is still ponited to actix 3. I just need to add some telemetry and authentication - authorization stuff.
2 replies
Aaron McLeod
@agmcleod
Hey there, im attempting to update a small application of mine to use the RC. However im getting build errors.
4 replies
Aaron McLeod
@agmcleod

Sorry have another question, just wondering if i can improve the code ergonomics a little. Prior to upgrading i'd have code like this:

let (game, rounds) = block(move || {
    let game = Game::find_by_id(&connection, game_id)?;
    let rounds = Round::belonging_to(&game).load::<Round>(&connection)?;
    Ok((game, rounds))
})
.await?;

Now with the changes to block(), it wraps the result for me. Since i want errors to return from the db operations there, i want to keep my own result. But this makes for a bit more code:

let data: Result<(Game, Vec<Round>), Error> = block(move || {
    let game = Game::find_by_id(&connection, game_id)?;
    let rounds = Round::belonging_to(&game).load::<Round>(&connection)?;
    Ok((game, rounds))
})
.await?;

let (game, rounds) = data?;
1 reply
Ruben De Smet
@rubdos:rubdos.be
[m]
    HttpServer::new(move || {
        let auth = HttpAuthentication::bearer(bearer_auth_validator);
        App::new()
            .app_data(state.clone())
            .wrap(middleware::Logger::default())
            .wrap(auth)
            .service(put_job)
            .service(next)
    })
I got an application like this. I would like to put the auth only with the two services, and add another service without the bearer authentication. How would I go about that?
Ruben De Smet
@rubdos:rubdos.be
[m]

Fiddled a bit with it, looks like

    HttpServer::new(move || {
        let auth = HttpAuthentication::bearer(bearer_auth_validator);
        App::new()
            .app_data(state.clone())
            .wrap(middleware::Logger::default())
            .service(metrics)
            .service(web::scope("").wrap(auth).service(next).service(put_job))
    })

works

Ratnadeep Bhattacharya
@ratnadeepb
I have been using actix-web for a while and currently attempting to build an example where each actor/app has a local copy of some data and communicates/syncs it with a global manager through async channels. I wonder if there is a good way of providing each actor with local storage/data structures?
Larry Dewey
@TheSilentDrifter_gitlab
Is there a location documenting the expected number of release candidates before a major release? Just wondering when the 4.0.0 will come out of rc.
ossgroupp
@ossgroupp
Hello everyone, not new to programming or web development, but brand new to rust and actix-web...just saying hey. I've been developing mostly in the java/typescript graphql/react/etc area for a little while now but looking into exploring what rust has to offer in terms of nextgen web development particularly with microservices
Kunjan Dalal
@kunjee17
Just came to know that Actix is finally V4. Thanks @robjtede and team for all the effort and helping early adopters like me to sort out issues :)
tglman
@tglman:matrix.org
[m]
🎉
Izdihar
@tengkuizdihar:matrix.org
[m]
Morning, does anyone have an example of actix + protobuf service? Most of the time I've only seen protobuf with enums and struct but no service. I would assume it would create a service trait or something.
Erlend Langseth
@Ploppz
                            .wrap(Condition::new(
                                keycloak_auth.is_some(),
                                keycloak_auth.clone().unwrap(),
                            ))
This doesn't work because if it's None it will panic... What can I do here?
Wouldn't it be an idea to impl Transform for Option<T>?
1 reply
Erlend Langseth
@Ploppz
made my own Either middleware
Samrose Ahmed
@Samrose-Ahmed
Hi, does anyone know how to write a simple middleware that runs after the response is returned to client. I want to do some custom async task (e.g. emit metric) that doesn't impact response based on some state set during request processing.
2 replies
robjtede
@robjtede:matrix.org
[m]
https://docs.rs/actix-web/latest/src/actix_web/middleware/logger.rs.html#332
is the Drop impl for the response body stream wrapper
basically when this gets Drop'd you know the stream has either completed or errored
important bit is just res.map_body(...) (line 321) which you can use to wrap the stream in your own struct with other bits you'll need when the stream is done
MGlolenstine
@mglolenstine:matrix.org
[m]

I was wondering what the best way of encrypting proxied data through websockets would be.
I'm essentially making a proxy, but I don't want to be able to see the data.
I was thinking about implementing a TLS-like handshake, but then the server still gets both certificates and the encryption is breakable.

I'm going to be sending passwords and usernames through the network and the only server-side processing I'm going to be doing is mapping WSS streams to a random id.

tglman
@tglman:matrix.org
[m]
Is there a way to access a session from a guard in 4.0 ? for example:
.guard(guard::fn_guard(|req| is_logged(req.get_session())))
1 reply
Gerald Nash
@aunyks
Hi! Does anyone have an example of accessing shared app state (added via data()) from middleware?
I imagine I have to access the request’s extensions but I’m not sure