Skip to content
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

Signed payment request view_url returns octet-stream Content-Type #7672

Open
sime opened this issue Feb 17, 2022 · 6 comments
Open

Signed payment request view_url returns octet-stream Content-Type #7672

sime opened this issue Feb 17, 2022 · 6 comments

Comments

@sime
Copy link

sime commented Feb 17, 2022

Navigating to the view_url of payment request returns the following headers

HTTP/1.1 200 OK
Content-Type: application/octet-stream
Etag: "16d49b8fa01a621c-13ad"
Last-Modified: Thu, 17 Feb 2022 15:13:26 GMT
Content-Length: 5037
Accept-Ranges: bytes
Date: Thu, 17 Feb 2022 17:12:01 GMT
Server: Python/3.8 aiohttp/3.8.1

The user agent attempts to download the "page".

It should ideally return something like Content-Type: text/html

@SomberNight
Copy link
Member

( duplicate of spesmilo/electrum-merchant#7 - although I guess that repo is sort of deprecated... )

@sime
Copy link
Author

sime commented Feb 18, 2022

Hi @SomberNight

If it's a single line change, please point me to the file and I will test it out and offer a PR.

@SomberNight
Copy link
Member

I cannot reproduce the issue... this is what I am trying:

$ ./run_electrum -o setconfig --testnet payserver_address 127.0.0.1:9922
$ ./run_electrum daemon --testnet -d

$ ./run_electrum --testnet load_wallet -w ~/.electrum/testnet/wallets/test_segwit_2
$ ./run_electrum --testnet add_request 0.5 -m "test" -w ~/.electrum/testnet/wallets/test_segwit_2
{
    "URI": "bitcoin:tb1qx42l3d7arvf0zf2jvx0f24wz2dkgph2rwfjwkv?amount=0.5&message=test&time=1645205200&exp=3600",
    "address": "tb1qx42l3d7arvf0zf2jvx0f24wz2dkgph2rwfjwkv",
    "amount_BTC": "0.5",
    "amount_sat": 50000000,
    "expiration": 3600,
    "is_lightning": false,
    "message": "test",
    "status": 0,
    "status_str": "Expires in about 1 hour",
    "timestamp": 1645205200,
    "view_url": "http://127.0.0.1:9922/r/pay?id=tb1qx42l3d7arvf0zf2jvx0f24wz2dkgph2rwfjwkv"
}
$ curl -i http://127.0.0.1:9922/r/pay?id=tb1qx42l3d7arvf0zf2jvx0f24wz2dkgph2rwfjwkv
HTTP/1.1 200 OK
Content-Type: text/html
Etag: "d84223e711e5600-13ad"
Last-Modified: Sat, 11 Nov 2000 11:11:11 GMT
Content-Length: 5037
Accept-Ranges: bytes
Date: Fri, 18 Feb 2022 17:31:52 GMT
Server: Python/3.8 aiohttp/3.8.1

<!DOCTYPE HTML>
<html>
[... snip ...]
</html>

For me it seems Content-Type: text/html gets set.

@SomberNight
Copy link
Member

SomberNight commented Feb 18, 2022

http://127.0.0.1:9922/r/pay?id=tb1qx42l3d7arvf0zf2jvx0f24wz2dkgph2rwfjwkv

pay is a symlink to index.html - could you try and see if it behaves any different for you when accessing that directly instead, so e.g. http://127.0.0.1:9922/r/index.html?id=tb1qx42l3d7arvf0zf2jvx0f24wz2dkgph2rwfjwkv ?

btw these files are exposed to the aiohttp webserver here:

app.add_routes([web.static(root, os.path.join(os.path.dirname(__file__), 'www'))])

@sime
Copy link
Author

sime commented Feb 18, 2022

Yes, I was using a real domain on a publicly available VPS.

Will try with 127.0.0.1.

@odiferousmint
Copy link

odiferousmint commented May 10, 2022

http://127.0.0.1:9922/r/pay?id=tb1qx42l3d7arvf0zf2jvx0f24wz2dkgph2rwfjwkv

pay is a symlink to index.html - could you try and see if it behaves any different for you when accessing that directly instead, so e.g. http://127.0.0.1:9922/r/index.html?id=tb1qx42l3d7arvf0zf2jvx0f24wz2dkgph2rwfjwkv ?

btw these files are exposed to the aiohttp webserver here:

app.add_routes([web.static(root, os.path.join(os.path.dirname(__file__), 'www'))])

It works with index.html, does not work with pay. Electrum version 4.2.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants