Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[?] How can i specify HTTP version #268

Closed
morrphology opened this issue Oct 20, 2023 · 3 comments
Closed

[?] How can i specify HTTP version #268

morrphology opened this issue Oct 20, 2023 · 3 comments
Assignees
Labels
Selected for Development This feature will be implemented

Comments

@morrphology
Copy link

Description

[?] How can i specify HTTP version

Issue Type

Support

Operating System

No response

Node Version

Node 16.x

Golang Version

None

Relevant Log Output

No response

@morrphology morrphology added the triage This ticket will be looked at shortly label Oct 20, 2023
@Danny-Dasilva
Copy link
Owner

It gets automatically set depending on the Ja3 you pass in, I can add the option to make this configurable but it will change the expected ja3

@Danny-Dasilva Danny-Dasilva added Selected for Development This feature will be implemented and removed triage This ticket will be looked at shortly labels Oct 24, 2023
@morrphology
Copy link
Author

It gets automatically set depending on the Ja3 you pass in, I can add the option to make this configurable but it will change the expected ja3

so there is no way to set it to HTTP/1.1 rn? i generated a random ja3 in each request

@Danny-Dasilva
Copy link
Owner

This feature has been added to version 1.0.23

Examples have been added in the docs but for clarity here's some code examples

golang

client := cycletls.Init()
resp, err := client.Do("https://tls.peet.ws/api/all", cycletls.Options{
Body: "",
Ja3: "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-21,29-23-24,0",
UserAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36",
ForceHTTP1: true,
}, "GET")
if err != nil {
log.Print("Request Failed: " + err.Error())
}
if resp.Status != 200 {
t.Fatal("Expected {} Got {} for Status", 200, resp.Status)
}
fullResp := new(FullResp)
err = json.Unmarshal([]byte(resp.Body), &fullResp)
if err != nil {
t.Fatal("Unmarshal Error")
}
if fullResp.HTTP_Version != "HTTP/1.1" {
t.Fatal("Expected:", "HTTP/1.1", "Got:", fullResp.HTTP_Version, "for fullResp")
}

javascript

const response = await cycleTLS(
"https://tls.peet.ws/api/all",
{
body: "",
ja3: ja3,
userAgent: userAgent,
forceHTTP1: true,
},
"get"
);
expect(response.status).toBe(200);
let fullResp = response.body as { http_version: string };
expect(fullResp.http_version).toBe("HTTP/1.1");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Selected for Development This feature will be implemented
Projects
None yet
Development

No branches or pull requests

2 participants