Commit f25d8cd3 authored by Artturin's avatar Artturin
Browse files

nginx: Apply patch to fix endianess detection

Fixes corrupted date and a corrupte HTTP header field `/nn1R7cu0=3l`

```
date: 52anAoe1x3Wt3H4l1u0sc3.632 GMT
curl: (92) Invalid HTTP header field was received: frame type: 1, stream: 1, name: [/nn1R7cu0=3l], value: [bytes]
```

The patch is 4+ years old yet no one has had this problem?

Fixes https://www.github.com/NixOS/nixpkgs/issues/437626
parent fbcf476f
Loading
Loading
Loading
Loading
+38 −26
Original line number Diff line number Diff line
@@ -175,7 +175,8 @@ stdenv.mkDerivation {
  ++ configureFlags
  ++ map (mod: "--add-module=${mod.src}") modules;

  env.NIX_CFLAGS_COMPILE = toString (
  env = {
    NIX_CFLAGS_COMPILE = toString (
      [
        "-I${libxml2.dev}/include/libxml2"
        "-Wno-error=implicit-fallthrough"
@@ -201,6 +202,10 @@ stdenv.mkDerivation {
        "-Wno-error=cpp"
      ]
    );
  }
  // lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) {
    CONFIG_BIG_ENDIAN = if stdenv.hostPlatform.isBigEndian then "y" else "n";
  };

  configurePlatforms = [ ];

@@ -218,6 +223,9 @@ stdenv.mkDerivation {
        ./nix-etag-1.15.4.patch
        ./nix-skip-check-logs-path.patch
      ]
      # Upstream may be against cross-compilation patches.
      # https://trac.nginx.org/nginx/ticket/2240 https://trac.nginx.org/nginx/ticket/1928#comment:6
      # That dev quit the project in 2024 so the stance could be different now.
      ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
        (fetchpatch {
          url = "https://raw.githubusercontent.com/openwrt/packages/c057dfb09c7027287c7862afab965a4cd95293a3/net/nginx/patches/102-sizeof_test_fix.patch";
@@ -231,6 +239,10 @@ stdenv.mkDerivation {
          url = "https://raw.githubusercontent.com/openwrt/packages/c057dfb09c7027287c7862afab965a4cd95293a3/net/nginx/patches/103-sys_nerr.patch";
          sha256 = "0s497x6mkz947aw29wdy073k8dyjq8j99lax1a1mzpikzr4rxlmd";
        })
        (fetchpatch {
          url = "https://raw.githubusercontent.com/openwrt/packages/c057dfb09c7027287c7862afab965a4cd95293a3/net/nginx/patches/104-endianness_fix.patch";
          sha256 = "sha256-M7V3ZJfKImur2OoqXcoL+CbgFj/huWnfZ4xMCmvkqfc=";
        })
      ]
      ++ mapModules "patches"
    )