tcp-over-http icon indicating copy to clipboard operation
tcp-over-http copied to clipboard

Request header support

Open ShaunMaher opened this issue 1 year ago • 5 comments

Hi.

I have implemented the support for Arbitrary HTTP Request headers as suggested in #4. It allows the user to specify the "--req-header" argument multiple times to add as many headers as needed.

I hadn't written a line of Rust before yesterday so please be kind in your review. :-)

Kind Regards

Shaun.

ShaunMaher avatar May 23 '23 00:05 ShaunMaher

async fn init_http_session(target: &Url, req_headers: &[String]) -> Trace<Uuid> {
    let mut req = CLIENT.get(join_url(target, ["open"]));

    println!("req_headers: {:?}", req_headers);

    for req_header in req_headers {
        let (name, value) = req_header.split_once(": ").unwrap();
        req = req.header(name, value);
    }
...

rest should be correct (i dont know what that /tmp git submodule thing is, does, is for)

Hezuikn avatar May 23 '23 01:05 Hezuikn

Thanks for implementing. Looks good in general.

Why are we inserting "key" and "value" into the headers map though?

I am currently on mobile, will look at it and test it on pc later.

julianbuettner avatar May 23 '23 05:05 julianbuettner

"Why are we inserting "key" and "value" into the headers map though?" artifact from the example i gave in https://github.com/julianbuettner/tcp-over-http/issues/4

Hezuikn avatar May 23 '23 16:05 Hezuikn

(i dont know what that /tmp git submodule thing is, does, is for)

Sorry. That's junk. Can I delete that from the PR in some way or do I need to create a new PR?

ShaunMaher avatar May 25 '23 02:05 ShaunMaher

You can simply delete the line, commit and push it to your branch.

julianbuettner avatar May 25 '23 07:05 julianbuettner