Skip to content
This repository has been archived by the owner on Apr 7, 2021. It is now read-only.

Commit

Permalink
some incoming data has & escaped as & in the query string
Browse files Browse the repository at this point in the history
  • Loading branch information
atmos committed Jul 1, 2011
1 parent 0edb605 commit 39f6078
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion server.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ server = Http.createServer (req, resp) ->

delete(req.headers.cookie)

[query_digest, encoded_url] = url.pathname.replace(/^\//, '').split("/", 2)
pathname = url.pathname.replace(/&/, '&')
[query_digest, encoded_url] = pathname.replace(/^\//, '').split("/", 2)
if encoded_url = hexdec(encoded_url)
url_type = 'path'
dest_url = encoded_url
Expand Down
5 changes: 3 additions & 2 deletions server.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions test/proxy_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ def test_proxy_valid_google_chart_url
assert_equal(200, response.code)
end

def test_hmac_update_obscure_error
urls = [
"http://share.kyleneath.com/captures/Testing_-_TestingAppDelegate.m-20110309-142723.png",
"http://cdn.shopify.com/s/files/1/0051/4802/products/featured_2.jpg?1287582804"
]
urls.each do |url|
response = request(url)
assert_equal(200, response.code)
end
end

def test_404s_on_urls_without_an_http_host
assert_raise RestClient::ResourceNotFound do
request('/picture/Mincemeat/Pimp.jpg')
Expand Down

0 comments on commit 39f6078

Please sign in to comment.