Skip to content

Commit 07ad441

Browse files
committed
Fix: Accept-Enconding header
1 parent 08ba77d commit 07ad441

2 files changed

Lines changed: 41 additions & 23 deletions

File tree

.github/workflows/build.yml

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,28 @@ jobs:
99
build:
1010
strategy:
1111
matrix:
12-
os: [ubuntu-latest, windows-latest]
12+
include:
13+
- os: ubuntu-latest
14+
goos: linux
15+
goarch: amd64
16+
- os: ubuntu-latest
17+
goos: linux
18+
goarch: arm64
19+
- os: macos-latest
20+
goos: darwin
21+
goarch: amd64
22+
- os: macos-latest
23+
goos: darwin
24+
goarch: arm64
25+
- os: windows-latest
26+
goos: windows
27+
goarch: amd64
28+
- os: windows-latest
29+
goos: windows
30+
goarch: arm64
31+
- os: windows-latest
32+
goos: windows
33+
goarch: 386
1334
runs-on: ${{ matrix.os }}
1435
permissions:
1536
contents: write
@@ -21,21 +42,18 @@ jobs:
2142
with:
2243
go-version: '1.22'
2344

24-
- name: Build Linux
25-
if: matrix.os == 'ubuntu-latest'
26-
run: GOOS=linux go build -ldflags "-s -w" -o mhr-cfw-go-linux ./cmd/mhr-cfw
45+
- name: Build
46+
run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags "-s -w" -o mhr-cfw-go-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/mhr-cfw
2747

28-
- name: Build Windows
29-
if: matrix.os == 'windows-latest'
30-
run: go build -ldflags "-s -w" -o mhr-cfw-go-windows.exe ./cmd/mhr-cfw
48+
- name: Rename Windows executable
49+
if: matrix.goos == 'windows'
50+
run: Move-Item mhr-cfw-go-windows-${{ matrix.goarch }} mhr-cfw-go-windows-${{ matrix.goarch }}.exe
3151

3252
- name: Upload artifact
3353
uses: actions/upload-artifact@v4
3454
with:
35-
name: mhr-cfw-go-${{ matrix.os }}
36-
path: |
37-
mhr-cfw-go-windows.exe
38-
mhr-cfw-go-linux
55+
name: mhr-cfw-go-${{ matrix.goos }}-${{ matrix.goarch }}
56+
path: mhr-cfw-go-${{ matrix.goos }}-${{ matrix.goarch }}*
3957

4058
release:
4159
needs: build
@@ -46,24 +64,18 @@ jobs:
4664
steps:
4765
- uses: actions/checkout@v4
4866

49-
- name: Download Linux artifact
67+
- name: Download all artifacts
5068
uses: actions/download-artifact@v4
5169
with:
52-
name: mhr-cfw-go-ubuntu-latest
5370
path: .
5471

55-
- name: Download Windows artifact
56-
uses: actions/download-artifact@v4
57-
with:
58-
name: mhr-cfw-go-windows-latest
59-
path: .
72+
- name: List artifacts
73+
run: Get-ChildItem -Recurse -File | Select-Object -ExpandProperty FullName
6074

6175
- name: Release
6276
uses: softprops/action-gh-release@v2
6377
with:
64-
files: |
65-
mhr-cfw-go-windows.exe
66-
mhr-cfw-go-linux
78+
files: mhr-cfw-go-*
6779
body: "Built from commit ${{ github.sha }}"
6880
env:
69-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

internal/fronter/fronter.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,13 @@ func (f *DomainFronter) buildPayload(method, urlStr string, headers map[string]s
507507
"r": false,
508508
}
509509
if headers != nil {
510-
p["h"] = headers
510+
filtered := make(map[string]string)
511+
for k, v := range headers {
512+
if strings.ToLower(k) != "accept-encoding" {
513+
filtered[k] = v
514+
}
515+
}
516+
p["h"] = filtered
511517
}
512518
if len(body) > 0 {
513519
p["b"] = base64.StdEncoding.EncodeToString(body)

0 commit comments

Comments
 (0)