[PR #15191] fix(registry): avoid panic in statusCodeRecorder on non-Flusher/Close… #15066

Open
opened 2026-04-13 01:09:39 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15191
Author: @machinelearningprodigy
Created: 4/1/2026
Status: 🔄 Open

Base: mainHead: fix/statusrecorder-safe-interface-delegation


📝 Commits (1)

  • 76531a5 fix(registry): avoid panic in statusCodeRecorder on non-Flusher/CloseNotifier

📊 Changes

2 files changed (+61 additions, -6 deletions)

View changed files

📝 server/internal/registry/server.go (+10 -6)
📝 server/internal/registry/server_test.go (+51 -0)

📄 Description

…Notifier

The statusCodeRecorder type implements http.Flusher and http.CloseNotifier interfaces by delegating to the underlying ResponseWriter. However, calling these methods would panic if the underlying writer didn't support them.

This fix adds safe type checks:

  • CloseNotify() returns a non-signaling channel if not supported
  • Flush() becomes a no-op if not supported

Includes regression test to prevent future crashes.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15191 **Author:** [@machinelearningprodigy](https://github.com/machinelearningprodigy) **Created:** 4/1/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/statusrecorder-safe-interface-delegation` --- ### 📝 Commits (1) - [`76531a5`](https://github.com/ollama/ollama/commit/76531a59de8782eb62fe7b9d3181943f3857a4e6) fix(registry): avoid panic in statusCodeRecorder on non-Flusher/CloseNotifier ### 📊 Changes **2 files changed** (+61 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `server/internal/registry/server.go` (+10 -6) 📝 `server/internal/registry/server_test.go` (+51 -0) </details> ### 📄 Description …Notifier The statusCodeRecorder type implements http.Flusher and http.CloseNotifier interfaces by delegating to the underlying ResponseWriter. However, calling these methods would panic if the underlying writer didn't support them. This fix adds safe type checks: - CloseNotify() returns a non-signaling channel if not supported - Flush() becomes a no-op if not supported Includes regression test to prevent future crashes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 01:09:39 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#15066