Web server don't work under Windows 7

Reported by Eugene Mikhantiev on 2011-09-30
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Zim
Medium
Unassigned

Bug Description

When I start Web server by pressing ">" button in dialog, Zim create TCP socket and everything looks like web server work. But when I try to connect to the server with Firefox, connection failed. This is probably not related to Windows Firewall.

Zim 0.53

Eugene Mikhantiev (mehanik) wrote :
description: updated

Could you check the log file for zim and see if there is any error message ?
If you run zim with "-D" the log file should also have the incoming
requests, so it shows if you reach the server at all.

Having the exact error message from firefox would also help.

Eugene Mikhantiev (mehanik) wrote :

Sorry, where can I find log file?

Firefox says that Connection timeout expired

On Thu, Oct 6, 2011 at 10:21 AM, Eugene Mikhantiev <email address hidden>wrote:

> Sorry, where can I find log file?
>

It will be in the temp folder, typically C:\TEMP or similar

Firefox says that Connection timeout expired
>
>
Sounds like you might not be be connected to the server (log file can tell
you for sure). Maybe double check firewall / security settings ?

-- Jaap

Eugene Mikhantiev (mehanik) wrote :

Thank you, I found log file.

Changed in zim:
status: New → Confirmed
importance: Undecided → Medium
Sebastian Audet (smaudet) wrote :

I may have a patch for this.

In general it seems the server is broken on Windows, lots of fun problems with sockets misbehaving. Stuff like node and apache all work flawlessly here (and python's SimpleHTTPServer), zim's server is just plain broken.

Right now I have it working, but (on chrome at least) I have to refresh multiple times due to a socket read timeout. Once I figure out how to fix the timeout I'll submit the patch.

Sebastian Audet (smaudet) wrote :

Please find attached my patch.

Please note that this is not a perfect solution, however it does fix the problem, namely the server crashing after accessing the index page.

A better solution would be to implement a proper webserver and run zim as an app instance.

Built for zim 0.59, tested from command line and gui.

Note: due to the unstable nature of the current server implementation, there may be an occasional failure to connect to the server. Refreshing seems to fix this issue.

Thanks for the patch! Will check if I can apply it before the upcoming
release.

Agreed that we should move the server to just use the python standard
module like
SimpleHTTPServer and remove this hack version. Only consideration is that
server should be able to run in same process as the gtk main loop, using a
thread should take care of this I guess.

Regards,

Jaap

On Wed, Apr 10, 2013 at 11:04 PM, Sebastian Audet <email address hidden>wrote:

> Please find attached my patch.
>
> Please note that this is not a perfect solution, however it does fix the
> problem, namely the server crashing after accessing the index page.
>
> A better solution would be to implement a proper webserver and run zim
> as an app instance.
>
> Built for zim 0.59, tested from command line and gui.
>
> Note: due to the unstable nature of the current server implementation,
> there may be an occasional failure to connect to the server. Refreshing
> seems to fix this issue.
>
> ** Attachment added: "Server Bug Fix."
>
> https://bugs.launchpad.net/zim/+bug/862986/+attachment/3638545/+files/server_fix.bzr
>
> --
> You received this bug notification because you are subscribed to Zim.
> https://bugs.launchpad.net/bugs/862986
>
> Title:
> Web server don't work under Windows 7
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/zim/+bug/862986/+subscriptions
>

On Thu, Apr 11, 2013 at 8:41 AM, Jaap Karssenberg <
<email address hidden>> wrote:

> Thanks for the patch! Will check if I can apply it before the upcoming
> release.
>
> Agreed that we should move the server to just use the python standard
> module like
> SimpleHTTPServer and remove this hack version. Only consideration is that
> server should be able to run in same process as the gtk main loop, using a
> thread should take care of this I guess.
>

.. I mean wsgiref.simple_server

This actually works :)

>>>
from wsgiref.simple_server import make_server

from zim.notebook import resolve_notebook
from zim.www import WWWInterface

notebook, path = resolve_notebook(sys.argv[1])
app = WWWInterface(notebook)

httpd = make_server('', 8000, app)
print "Serving HTTP on port 8000..."

# Respond to requests until process is killed
httpd.serve_forever()

# Alternative: serve one request, then exit
httpd.handle_request()
<<<

On Thu, Apr 11, 2013 at 8:43 AM, Jaap Karssenberg <
<email address hidden>> wrote:

> On Thu, Apr 11, 2013 at 8:41 AM, Jaap Karssenberg <
> <email address hidden>> wrote:
>
>> Thanks for the patch! Will check if I can apply it before the upcoming
>> release.
>>
>> Agreed that we should move the server to just use the python standard
>> module like
>> SimpleHTTPServer and remove this hack version. Only consideration is that
>> server should be able to run in same process as the gtk main loop, using a
>> thread should take care of this I guess.
>>
>
> .. I mean wsgiref.simple_server
>

I will commit a patch later this week to move the whole thing to
simple server and support windows.

Btw. if you want to run zim in cgi mode, see
wsgiref.handlers.CGIHandler - you can make a very simple cgi wrapper
around zim.www.WWWInterface.

On Thu, Apr 11, 2013 at 9:55 AM, Jaap Karssenberg
<email address hidden> wrote:
> This actually works :)
>
>>>>
> from wsgiref.simple_server import make_server
>
> from zim.notebook import resolve_notebook
> from zim.www import WWWInterface
>
> notebook, path = resolve_notebook(sys.argv[1])
> app = WWWInterface(notebook)
>
>
> httpd = make_server('', 8000, app)
> print "Serving HTTP on port 8000..."
>
> # Respond to requests until process is killed
> httpd.serve_forever()
>
> # Alternative: serve one request, then exit
> httpd.handle_request()
> <<<
>
>
>
> On Thu, Apr 11, 2013 at 8:43 AM, Jaap Karssenberg
> <email address hidden> wrote:
>>
>> On Thu, Apr 11, 2013 at 8:41 AM, Jaap Karssenberg
>> <email address hidden> wrote:
>>>
>>> Thanks for the patch! Will check if I can apply it before the upcoming
>>> release.
>>>
>>> Agreed that we should move the server to just use the python standard
>>> module like
>>> SimpleHTTPServer and remove this hack version. Only consideration is that
>>> server should be able to run in same process as the gtk main loop, using a
>>> thread should take care of this I guess.
>>
>>
>> .. I mean wsgiref.simple_server
>
>

Sebastian Audet (smaudet) wrote :

Sorry, didn't see the previous messages!

If it helps any I wouldn't mind writing up another patch. But if you've already written the code for the patch and just need to update, I'll just wait. :)

Committed in rev659, basically deleted the whole Server class and using wsgiref simple server instead.

Changed in zim:
status: Confirmed → Fix Committed

Fix released in zim 0.60.

Changed in zim:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers