| ... | ... | @@ -530,8 +530,9 @@ pub const Session = struct { |
| 530 | 530 | info_refs_uri.query = "service=git-upload-pack"; |
| 531 | 531 | info_refs_uri.fragment = null; |
| 532 | 532 | |
| 533 | const max_redirects = 3; |
| 533 | 534 | var request = try session.transport.open(.GET, info_refs_uri, .{ |
| 534 | | .redirect_behavior = @enumFromInt(3), |
| 535 | .redirect_behavior = @enumFromInt(max_redirects), |
| 535 | 536 | .server_header_buffer = http_headers_buffer, |
| 536 | 537 | .extra_headers = &.{ |
| 537 | 538 | .{ .name = "Git-Protocol", .value = "version=2" }, |
| ... | ... | @@ -543,12 +544,8 @@ pub const Session = struct { |
| 543 | 544 | |
| 544 | 545 | try request.wait(); |
| 545 | 546 | if (request.response.status != .ok) return error.ProtocolError; |
| 546 | | // Pretty sure this is dead code - in order for a redirect to occur, the status |
| 547 | | // code would need to be in the 300s and then it would not be "OK" which is checked |
| 548 | | // on the line above. |
| 549 | | var runtime_false = false; |
| 550 | | _ = &runtime_false; |
| 551 | | if (runtime_false) { |
| 547 | const any_redirects_occurred = request.redirect_behavior.remaining() < max_redirects; |
| 548 | if (any_redirects_occurred) { |
| 552 | 549 | if (!mem.endsWith(u8, request.uri.path, "/info/refs")) return error.UnparseableRedirect; |
| 553 | 550 | var new_uri = request.uri; |
| 554 | 551 | new_uri.path = new_uri.path[0 .. new_uri.path.len - "/info/refs".len]; |