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

Internal server error while requesting static route #840

Closed
31z4 opened this issue Mar 23, 2016 · 3 comments
Closed

Internal server error while requesting static route #840

31z4 opened this issue Mar 23, 2016 · 3 comments
Labels

Comments

@31z4
Copy link

31z4 commented Mar 23, 2016

Long story short

Having a simple app with just a single static route I'm getting a weird response on GET /.

Expected behaviour

404 Not Found is returned on GET /.

Actual behaviour

200 OK is returned but body says it's 500 Internal Server Error

Steps to reproduce

Application source code

from aiohttp import web

if __name__ == '__main__':
    app = web.Application()
    app.router.add_static('/', '.')
    web.run_app(app)

Request and response

$ curl -v http://$(docker-machine ip default):8080/
*   Trying 192.168.99.100...
* Connected to 192.168.99.100 (192.168.99.100) port 8080 (#0)
> GET / HTTP/1.1
> Host: 192.168.99.100:8080
> User-Agent: curl/7.43.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< CONTENT-TYPE: application/octet-stream
< LAST-MODIFIED: Wed, 23 Mar 2016 19:10:04 GMT
< CONTENT-LENGTH: 4096
< DATE: Wed, 23 Mar 2016 19:23:45 GMT
< SERVER: Python/3.5 aiohttp/0.21.5
< 
HTTP/1.1 500 Internal Server Error
CONTENT-TYPE: text/html; charset=utf-8
CONTENT-LENGTH: 170
CONNECTION: close
DATE: Wed, 23 Mar 2016 19:23:45 GMT
SERVER: Python/3.5 aiohttp/0.21.5


<html>
  <head>
    <title>500 Internal Server Error</title>
  </head>
  <body>
    <h1>500 Internal Server Error</h1>
    Server got itself in trouble
  </body>
* transfer closed with 3736 bytes remaining to read
* Closing connection 0
curl: (18) transfer closed with 3736 bytes remaining to read
</html>

Traceback

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/aiohttp/server.py", line 266, in start
    yield from self.handle_request(message, payload)
  File "/usr/local/lib/python3.5/site-packages/aiohttp/web.py", line 90, in handle_request
    resp = yield from handler(request)
  File "/usr/local/lib/python3.5/site-packages/aiohttp/web_urldispatcher.py", line 595, in handle
    with filepath.open('rb') as f:
  File "/usr/local/lib/python3.5/pathlib.py", line 1136, in open
    opener=self._opener)
IsADirectoryError: [Errno 21] Is a directory: '/usr/src/app'

Your environment

Linux 1ef7cdcd22ed 4.1.19-boot2docker #1 SMP Mon Mar 7 17:44:33 UTC 2016 x86_64 GNU/Linux
Python 3.5.1
aiohttp==0.21.5
chardet==2.3.0
@popravich popravich added the web label Mar 24, 2016
@popravich
Copy link
Member

Hi, this issue is currently fixed in master (see #803)

@31z4
Copy link
Author

31z4 commented Mar 24, 2016

Nice!

@31z4 31z4 closed this as completed Mar 24, 2016
@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants