New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added webmachine {halt, StatusCode} support #144

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@dysinger
Contributor

dysinger commented Feb 17, 2012

Please consider pulling in this commit that enables halt status codes (you don't always want to halt 500)

@essen

This comment has been minimized.

Show comment
Hide comment
@essen

essen Feb 17, 2012

Member

The current way of doing things implies that you {ok, Req2} = cowboy_http_req:reply(123, Req) before returning {halt, Req2, State}, do you use {halt, Status} enough to warrant adding it or would the former method of doing it be enough?

Member

essen commented Feb 17, 2012

The current way of doing things implies that you {ok, Req2} = cowboy_http_req:reply(123, Req) before returning {halt, Req2, State}, do you use {halt, Status} enough to warrant adding it or would the former method of doing it be enough?

@dysinger

This comment has been minimized.

Show comment
Hide comment
@dysinger

dysinger Feb 17, 2012

Contributor

I don't use it hundreds of times or anything but it does feel more natural to me to just return a specific halt code like webmachine. It says to me that I'm still working within the REST framework & not highjacking the request mid-way.

I can work with either way but I like the specific halt code approach, personally.

Thanks for your hard work & sharing on Cowboy. It's good stuff.

Sent from my iPhone

On Feb 17, 2012, at 3:43 AM, Loïc Hoguinreply@reply.github.com wrote:

The current way of doing things implies that you {ok, Req2} = cowboy_http_req:reply(123, Req) before returning {halt, Req2, State}, do you use {halt, Status} enough to warrant adding it or would the former method of doing it be enough?


Reply to this email directly or view it on GitHub:
#144 (comment)

Contributor

dysinger commented Feb 17, 2012

I don't use it hundreds of times or anything but it does feel more natural to me to just return a specific halt code like webmachine. It says to me that I'm still working within the REST framework & not highjacking the request mid-way.

I can work with either way but I like the specific halt code approach, personally.

Thanks for your hard work & sharing on Cowboy. It's good stuff.

Sent from my iPhone

On Feb 17, 2012, at 3:43 AM, Loïc Hoguinreply@reply.github.com wrote:

The current way of doing things implies that you {ok, Req2} = cowboy_http_req:reply(123, Req) before returning {halt, Req2, State}, do you use {halt, Status} enough to warrant adding it or would the former method of doing it be enough?


Reply to this email directly or view it on GitHub:
#144 (comment)

@essen

This comment has been minimized.

Show comment
Hide comment
@essen

essen Feb 17, 2012

Member

Not disagreeing there. I'll ask around to see what people think. Thanks.

Member

essen commented Feb 17, 2012

Not disagreeing there. I'll ask around to see what people think. Thanks.

@dysinger

This comment has been minimized.

Show comment
Hide comment
@dysinger

dysinger Feb 17, 2012

Contributor

Awesome. Hey while I have you here. I can see from
test/http_handler_stream_body.erl how to do a streaming download. I got
that working with the REST framework.

Any examples of how I might do a streaming upload (multi-gb) ?

-Tim

On Fri, Feb 17, 2012 at 7:18 AM, Loc Hoguin <
reply@reply.github.com

wrote:

Not disagreeing there. I'll ask around to see what people think. Thanks.


Reply to this email directly or view it on GitHub:
#144 (comment)

Contributor

dysinger commented Feb 17, 2012

Awesome. Hey while I have you here. I can see from
test/http_handler_stream_body.erl how to do a streaming download. I got
that working with the REST framework.

Any examples of how I might do a streaming upload (multi-gb) ?

-Tim

On Fri, Feb 17, 2012 at 7:18 AM, Loc Hoguin <
reply@reply.github.com

wrote:

Not disagreeing there. I'll ask around to see what people think. Thanks.


Reply to this email directly or view it on GitHub:
#144 (comment)

@essen

This comment has been minimized.

Show comment
Hide comment
@essen

essen Feb 17, 2012

Member

With multipart (multipart_data and multipart_skip in cowboy_http_req). No example of that yet.

We'll be porting the misultin examples to Cowboy to show how each feature is done next week.

Member

essen commented Feb 17, 2012

With multipart (multipart_data and multipart_skip in cowboy_http_req). No example of that yet.

We'll be porting the misultin examples to Cowboy to show how each feature is done next week.

@essen

This comment has been minimized.

Show comment
Hide comment
@essen

essen Mar 2, 2012

Member

So far I've had mixed feedback on this. I don't think I'll merge it. I get the idea, but this is a special case and I don't like going too much into specifics with special cases, if the current {halt, ...} can serve your need then I feel it should be enough.

On the other hand you highlighted a potentially problematic issue. The REST code already prepares headers to send when the response is sent. What do we do with those? Should they be sent if we decide to halt and send a 500? Wouldn't that be a problem? I don't use {halt, ...} so I would appreciate your input on this.

Thanks!

Member

essen commented Mar 2, 2012

So far I've had mixed feedback on this. I don't think I'll merge it. I get the idea, but this is a special case and I don't like going too much into specifics with special cases, if the current {halt, ...} can serve your need then I feel it should be enough.

On the other hand you highlighted a potentially problematic issue. The REST code already prepares headers to send when the response is sent. What do we do with those? Should they be sent if we decide to halt and send a 500? Wouldn't that be a problem? I don't use {halt, ...} so I would appreciate your input on this.

Thanks!

@dysinger

This comment has been minimized.

Show comment
Hide comment
@dysinger

dysinger Mar 2, 2012

Contributor

I've gotten used to the 2-step of settting the response code & then halting.

It is strange to see "content-type" etc headers on a response that you sent a custom halt. I've seen that happen.

Contributor

dysinger commented Mar 2, 2012

I've gotten used to the 2-step of settting the response code & then halting.

It is strange to see "content-type" etc headers on a response that you sent a custom halt. I've seen that happen.

@essen

This comment has been minimized.

Show comment
Hide comment
@essen

essen Mar 2, 2012

Member

Yeah it probably shouldn't be doing this. I'll open a new ticket for it and close this one. Thanks for the feedback!

Member

essen commented Mar 2, 2012

Yeah it probably shouldn't be doing this. I'll open a new ticket for it and close this one. Thanks for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment