Skip to content

Commit

Permalink
protocol_version method: fix for newer cowboy versions when cowboy is…
Browse files Browse the repository at this point in the history
… used with mochiweb_request

Newer Cowboy versions return HTTP version as 'HTTP/1.1' and 'HTTP1.0' atoms, instead of {1,1}, {1,0} as it was earlier. This commit converts atoms to old-fashioned tuples, works with both new and old cowboy versions.
  • Loading branch information
tempaccounterl authored and choptastic committed Aug 18, 2013
1 parent 553b228 commit 67a8b9f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/mochiweb_bridge_modules/mochiweb_request_bridge.erl
Expand Up @@ -162,4 +162,8 @@ recv_from_socket(Length, Timeout, Req) ->
end.

protocol_version(Req) ->
Req:get(version).
case Req:get(version) of
'HTTP/1.1' -> {1, 1};
'HTTP/1.0' -> {1, 0};
{H, L} -> {H, L}
end.

0 comments on commit 67a8b9f

Please sign in to comment.