0

I wrote load testing of my API with NTLM auth (here I additionally check if NTLM authorized user is presend in Database). During resquest:

  var url = 'https://login:*****@localhost:xxxx/api/authorization/logon';
  var payload = { };

  var params = {
    headers: {
      'Content-Type': 'application/json'
    },
  };

   let response = http.post(url, params, {auth: "ntlm"});  
   check(response, {
    'status is 200': (r) => r.status === 200
    });
}

i have an error:

error="Post "https://user:*****@localhost:xxx/api/authorization/logon": stream error: stream ID 3; HTTP_1_1_REQUIRED".

Why? Kestrel serve HTTP/1.1

2 Answers2

1

This is an issue in the way Go standard library's HTTP client operates, that is described here in detail, in which for HTTPS endpoints, connection is forcibly upgraded to HTTP/2.0, which is not supported by the NTLM protocol.

I'm not sure, but maybe you can disable this connection upgrade in Kestrel.

  • So we have to use custom HTTP client? – Aleksander Parchomenko Sep 09 '20 at 13:54
  • You mean inside k6? I think that won't work, since k6 is designed to work with the Go internal HTTP library and since it also doesn't support NodeJS and Browser APIs, you can't use a custom HTTP client from JavaScript code, unless you integrate one yourself (i.e. add the custom HTTP client to k6 source code). – Mostafa Moradian Sep 09 '20 at 14:01
  • Ok, I've unsderstood. Thank you, Mostafa! – Aleksander Parchomenko Sep 09 '20 at 14:17
  • @MostafaMoradian, I don't think you are correct. The Go standard library (and thus, k6) doesn't _force_ HTTP/2 connections, it upgrades HTTPS connections with servers that support HTTP/2 to that protocol, otherwise uses HTTP/1.1. So, the server in this case was at least partially responsible, I think. The issue you linked to is that you are unable to force k6 _not_ to upgrade connections, but it will not _always_ force them. – na-- Sep 09 '20 at 14:28
  • You're welcome, Aleksander! @na-- Maybe I was a little bit harsh on using the word "forcibly"! So, it is voluntarily but _may_ be forced from one side, the webserver side. – Mostafa Moradian Sep 09 '20 at 14:31
  • "may be forced from one side" - it can't be... You can't specify that k6 shouldn't upgrade a connection to HTTP/2, but it will only upgrade a connection _if and only if_ the server supports it. So, in this case, the server seems to be incorrectly configured to offer HTTP/2 when NTLM requires HTTP/1 – na-- Sep 09 '20 at 14:36
0

you can set in your global system environment to enable HTTP1.1

enter image description here

Ismi Ammar
  • 166
  • 1
  • 11