Skip to content

Commit

Permalink
fix to http version 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kafisatz committed Jan 16, 2025
1 parent 4cc6197 commit ff11c06
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/infinite_loop.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Pkg;
Pkg.activate("."); Pkg.instantiate()
using Dates; using DataFrames; using StatsBase; using qBittorrentStats;import InfluxDBClient; import JSON3
using Dates; using DataFrames; using StatsBase; using qBittorrentStats;import InfluxDBClient; import JSON3; import CurlHTTP

function main_fn()
configfiles = [raw"\\ds\data\configs\qbittorrentstats\config.json","/volume1/data/configs/qbittorrentstats/config.json","/cfgfolder/qbittorrentstats/config.json"]
Expand Down
2 changes: 1 addition & 1 deletion src/webuiapi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function deletetorrent(h::String,baseurl::String;cookieDict=nothing,username="ad
#requestBody = "{\"hashes\":\"$h\",\"deleteFiles\":$deletefiles}"
#println(requestBody)
res, http_status, errormessage = CurlHTTP.curl_execute(curl, requestBody, headers)
@assert http_status == 200
@assert 200 == http_status "status was not 200 (deletetorrent)"
return res
end

6 changes: 6 additions & 0 deletions src/webuiauth.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ function auth_login(baseurl;username="admin",password=nothing,verbose=false)
username="admin"
pw = ENV["QBITTORRENT_PASSWORD"]
password = pw
auth_login(cfgs[1].url)
=#
pw = ""
if isnothing(password)
Expand All @@ -17,8 +18,13 @@ function auth_login(baseurl;username="admin",password=nothing,verbose=false)
@assert !endswith(baseurl,"/") "baseurl must not end with a slash /"
url = string(baseurl,"/api/v2/auth/login")


#curl = CurlHTTP.CurlEasy(url=url,method=CurlHTTP.POST,verbose=true)
curl = CurlHTTP.CurlEasy(url=url,method=CurlHTTP.POST,verbose=verbose)
CurlHTTP.curl_easy_setopt(curl, CurlHTTP.CURLOPT_HTTP_VERSION, CurlHTTP.CURL_HTTP_VERSION_1_1)
#CurlHTTP.curl_easy_setopt(curl, CurlHTTP.CURLOPT_HTTP_VERSION, CurlHTTP.CURL_HTTP_VERSION_1_0)
#CurlHTTP.curl_easy_setopt(curl, CurlHTTP.CURLOPT_HTTP_VERSION, CurlHTTP.CURL_HTTP_VERSION_2_0)

requestBody = "username=$(username)&password=$(pw)"
headers = ["Referer: $(baseurl)"]
res, http_status, errormessage = CurlHTTP.curl_execute(curl, requestBody, headers)
Expand Down

0 comments on commit ff11c06

Please sign in to comment.