openfaas / of-watchdog

Reverse proxy for STDIO and HTTP microservices
MIT License
262 stars 115 forks source link

Add Http_Transfer_Encoding env-var to all modes but http #89

Closed alexellis closed 4 years ago

alexellis commented 4 years ago

Add Http_Transfer_Encoding env-var to all modes but http. It was added to the classic watchdog and should be added here for the streaming and forking modes.

Possible solution

Copy the design from https://github.com/openfaas/faas/pull/1423

codegold79 commented 4 years ago

I'll take this one.

codegold79 commented 4 years ago

Reading lines 156-169 in main.go, it seems there are five modes, streaming, serializing, afterburn, requestHandler, http, and static.

The instructions don't seem to align, so I need to do some more research into the modes and why they would or would not need the http_Transfer_Encoding env-var.

The first sentence says, "Add Http_Transfer_Encoding env-var to all modes but http," which to me sounds like I should modify streaming, serializing, afterburn, requestHandler, and static.

The last part of the second sentence says, "...should be added here for the streaming and forking modes." Which to me means to modify the streaming mode, and whichever is the synonym for the forking mode.

I'll read more about Transfer Encoding and the various WatchDog modes tomorrow after work.

alexellis commented 4 years ago

I think I might have given you the impression that this is more complicated than it is, sorry for that.

It's simply a copy/paste job and no more than that. Copy the code from the classic watchdog into the handlers for the forking / streaming modes. I think we renamed forking to "serializing".

https://github.com/openfaas-incubator/of-watchdog/blob/master/executor/streaming_runner.go#L38 https://github.com/openfaas-incubator/of-watchdog/blob/master/executor/serializing_fork_runner.go#L46

In both places, simply copy/paste the code that populates req.Environment. That's it.

https://github.com/openfaas-incubator/of-watchdog/blob/master/main.go#L244 https://github.com/openfaas-incubator/of-watchdog/blob/master/main.go#L275

alexellis commented 4 years ago

I'll take this as it's probably easier that way. Take a look at the commit above.