You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The httpu package in this repo appears to be an older version of the standard library http package. The u in the name of the package, I think, was meant to call out that it supports HTTP over Unix Domain Sockets. Modern versions of the http package in the Go standard library support doing this, though the API has changed (httpu, I think, might have been copied prior to the Go 1.0 release). In particular, it seems necessary to net.Dial the Unix Domain socket path in the transport and the URIs are a bit different now (The http:// scheme is used instead of httpu://).
The httputil package similarly appears to be a vendored version of the Go standard library package by the same name. It might have been copied, as with the http package, prior to the 1.0 release because the API for defining a reverse proxy has changed when comparing it to the modern version. Most relevant for this project, the Proxy property of the ReverseProxy has been replaced with a Director property, which 1) doesn't have the ability to write a response directly and 2) doesn't allow an error to be returned. For both changes, the path forward seems to be to compose multiple HTTP handlers instead of putting all of the logic into the ReverseProxy itself.
Anyway, I got a proof-of-concept working that works for HTTP-over-Unix Domain Sockets but broke HTTP=>HTTP proxying and also static files serving along the way. It's at https://github.com/cjlarose/puma-dev/tree/update-to-stdlib-httputil and very messy, but I wanted to open up this issue to see if a change to switch these packages over to the modern versions would be welcome or if there's some reason to keep around the old versions. I'd likely open multiple, incremental PRs to refactor stuff to make the transition easier.
The text was updated successfully, but these errors were encountered:
The
httpu
package in this repo appears to be an older version of the standard libraryhttp
package. Theu
in the name of the package, I think, was meant to call out that it supports HTTP over Unix Domain Sockets. Modern versions of thehttp
package in the Go standard library support doing this, though the API has changed (httpu
, I think, might have been copied prior to the Go 1.0 release). In particular, it seems necessary tonet.Dial
the Unix Domain socket path in thetransport
and the URIs are a bit different now (Thehttp://
scheme is used instead ofhttpu://
).The
httputil
package similarly appears to be a vendored version of the Go standard library package by the same name. It might have been copied, as with thehttp
package, prior to the 1.0 release because the API for defining a reverse proxy has changed when comparing it to the modern version. Most relevant for this project, theProxy
property of theReverseProxy
has been replaced with aDirector
property, which 1) doesn't have the ability to write a response directly and 2) doesn't allow anerror
to be returned. For both changes, the path forward seems to be to compose multiple HTTP handlers instead of putting all of the logic into theReverseProxy
itself.Anyway, I got a proof-of-concept working that works for HTTP-over-Unix Domain Sockets but broke HTTP=>HTTP proxying and also static files serving along the way. It's at https://github.com/cjlarose/puma-dev/tree/update-to-stdlib-httputil and very messy, but I wanted to open up this issue to see if a change to switch these packages over to the modern versions would be welcome or if there's some reason to keep around the old versions. I'd likely open multiple, incremental PRs to refactor stuff to make the transition easier.
The text was updated successfully, but these errors were encountered: