You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried the sample code on the example, but the warning(WARN Connection header illegal in HTTP/2: connection) has occurred to me.
When executing the sample code without the cargo lambda, the warning didn't show.
Could someone tell me what the warning means?
use lambda_http::{run, service_fn, Body, Error, Request, RequestExt, Response};
use spider::tokio;
use spider::website::Website;
/// This is the main body for the function.
/// Write your code inside it.
/// There are some code example in the following URLs:
/// - https://github.com/awslabs/aws-lambda-rust-runtime/tree/main/examples
async fn function_handler(_event: Request) -> Result<Response<Body>, Error> {
// Extract some useful information from the request
let url = "https://choosealicense.com";
let mut website: Website = Website::new(&url);
website.crawl().await;
for link in website.get_links() {
println!("- {:?}", link.as_ref());
}
// Return something that implements IntoResponse.
// It will be serialized to the right response event automatically by the runtime
let resp = Response::builder()
.status(200)
.header("content-type", "text/html")
.body("Hello AWS Lambda HTTP request".into())
.map_err(Box::new)?;
Ok(resp)
}
#[tokio::main]
async fn main() -> Result<(), Error> {
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
run(service_fn(function_handler)).await
}
The text was updated successfully, but these errors were encountered:
@saito-kosuke A config to determine if the connection should be kept alive is needed to prevent the warning. It should be safe to ignore since the client ignores the headers internally. Later on I was thinking it would make sense to add a duel client that can handle http1 and http2 depending on the website and the host network. A config for website.configuration.http2_prior_knowledge was added if you know the website has http2 support to prevent using http1 connections. 9063c00
I tried the sample code on the example, but the warning(WARN Connection header illegal in HTTP/2: connection) has occurred to me.
When executing the sample code without the cargo lambda, the warning didn't show.
Could someone tell me what the warning means?
The text was updated successfully, but these errors were encountered: