You are not logged in.

#126 2010-09-18 12:15:58

[vEX]
Member
From: Sweden
Registered: 2006-11-23
Posts: 450

Re: quickserve - easy ad-hoc file sharing

The SSL support seems to work fine, I get promted in Firefox for the certificate anyway. But as kgas mentioned, basic HTTP authentication is broken.

    if self.username or self.password:
      print "  authentication"
      if self.username:
        print "    username: " + options.username
      if self.password:
        print "    password: " + options.password

I guess those should also be "self." and not "options." :-)

-EDIT-
Hmm, SSL + basic HTTP authentication doesn't seem to work when the code above is fixed. Seems like there's some other bug in there somewhere as well. I accept the certificate and then it just keeps "loading" the page. As soon as I killed quickserve Firefox presented me with the username/password box. Using basic HTTP authentication without SSL works fine though as well as using SSL without authentication. And I'm pretty sure you should be able to use both, correct me if I'm wrong.

-EDIT2-
It seems like trying to GET files doesn't work for me neither. The directory listings all work fine, but whenever I click something it just ends in "loading". The log displays the GET request for the file and status 200, but shouldn't it also list the filesize?

$ cd /tmp && mkdir quickserve_temp && touch quickserve_temp/test.txt && echo "test" > quickserve_temp/test.txt
$ quickserve /tmp/quickserve_temp
Starting quickserve...
  address: all interfaces
  port: 8080
  pid: 884
  serving:
    /tmp/quickserve_temp
Press <Ctrl-C> to exit.

odin.localdomain - - [18/Sep/2010 14:49:08] "GET / HTTP/1.1" 200 -
odin.localdomain - - [18/Sep/2010 14:49:10] "GET /quickserve_temp/ HTTP/1.1" 200 -
odin.localdomain - - [18/Sep/2010 14:49:11] "GET /quickserve_temp/test.txt HTTP/1.1" 200 -
odin.localdomain - - [18/Sep/2010 14:52:19] "GET /quickserve_temp/test.txt HTTP/1.0" 200 -

This is what wget shows:

$ wget http://localhost:8080/quickserve_temp/test.txt
--2010-09-18 14:52:19--  http://localhost:8080/quickserve_temp/test.txt
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5 [text/plain]
Saving to: "test.txt"

 0% [                                       ] 0           --.-K/s              

So it seems like the content headers are sent but something seems to break after that.

Last edited by [vEX] (2010-09-18 12:55:23)


PC: Antec P182B | Asus P8Z77-V PRO | Intel i5 3570k | 16GB DDR3 | GeForce 450GTS | 4TB HDD | Pioneer BDR-207D | Asus Xonar DX | Altec Lansing CS21 | Eizo EV2736W-BK | Arch Linux x86_64
HTPC: Antec NSK2480 | ASUS M3A78-EM (AMD 780G) | AMD Athlon X3 425 | 8GB DDR2 | GeForce G210 | 2TB HDD | Arch Linux x86_64
Server: Raspberry Pi (model B) | 512MB RAM | 750GB HDD | Arch Linux ARM

Offline

#127 2010-09-18 13:10:42

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: quickserve - easy ad-hoc file sharing

Thanks for the feedback. All three errors should be fixed now with python-xynehttpserver 2010.09.18.4-1.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#128 2010-09-18 14:59:14

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: quickserve - easy ad-hoc file sharing

thanks, checked for the http and works fine. for https, report back after creating a certificate.

ok. for generating key I followed this guide.

using this command
quickserve --filelist=/home/<user>/Documents/ToExport.txt --port=2005  --ssl --certificate=/home/<user>/.ssl/host.cet  --key=/home/<user>/.ssl/host.key
starts the server correctly but on the client side opening with https://  is not successful (unable to connect....etc....)

Last edited by kgas (2010-09-18 16:18:40)

Offline

#129 2010-09-18 15:00:43

[vEX]
Member
From: Sweden
Registered: 2006-11-23
Posts: 450

Re: quickserve - easy ad-hoc file sharing

Thanks for the quick response, all working fine now! Now I can easily share files with my family, thanks a lot!

Last edited by [vEX] (2010-09-18 15:00:54)


PC: Antec P182B | Asus P8Z77-V PRO | Intel i5 3570k | 16GB DDR3 | GeForce 450GTS | 4TB HDD | Pioneer BDR-207D | Asus Xonar DX | Altec Lansing CS21 | Eizo EV2736W-BK | Arch Linux x86_64
HTPC: Antec NSK2480 | ASUS M3A78-EM (AMD 780G) | AMD Athlon X3 425 | 8GB DDR2 | GeForce G210 | 2TB HDD | Arch Linux x86_64
Server: Raspberry Pi (model B) | 512MB RAM | 750GB HDD | Arch Linux ARM

Offline

#130 2010-09-18 16:22:07

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: quickserve - easy ad-hoc file sharing

vEX, have you tested the https with key?. For me sever starts fine but from the client side I could not open the files. I have edited my previous post for more details.

Offline

#131 2010-09-18 17:07:06

[vEX]
Member
From: Sweden
Registered: 2006-11-23
Posts: 450

Re: quickserve - easy ad-hoc file sharing

kgas, yes and it works fine for me, followed this guide for creating the certificate and key.


PC: Antec P182B | Asus P8Z77-V PRO | Intel i5 3570k | 16GB DDR3 | GeForce 450GTS | 4TB HDD | Pioneer BDR-207D | Asus Xonar DX | Altec Lansing CS21 | Eizo EV2736W-BK | Arch Linux x86_64
HTPC: Antec NSK2480 | ASUS M3A78-EM (AMD 780G) | AMD Athlon X3 425 | 8GB DDR2 | GeForce G210 | 2TB HDD | Arch Linux x86_64
Server: Raspberry Pi (model B) | 512MB RAM | 750GB HDD | Arch Linux ARM

Offline

#132 2010-09-18 17:22:00

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: quickserve - easy ad-hoc file sharing

@kgas
After following that guide, both of the following work for me:

quickserve . --certificate host.cert --key host.key --ssl
quickserve . --certificate host.pem --ssl

Double-check that you're using "https://..." and that you have the latest version of python-xynehttpserver installed.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#133 2010-09-18 18:51:14

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: quickserve - easy ad-hoc file sharing

thanks, works fine and it is the mistake(typo) from my side. note that for the host file extension is wrong. I used .cet instead .cert.

Edit: Since no further post adding this.

@xyne: when using a --filelist option the current path is used for each file in the list if quickserve is executed. is it possible to expand the passed parametes?

to be more clear

--filelist=/home/xyz/Documents/ToExport.txt <---- here instead of typing full path simply ~/Documents/ToExport.txt is fine
The file ToExport.txt contains
Expences.odt
Review.ods

with this if I execute quickserve from /home/xyz/abc diretory then files will be listed as
    /home/xyz/abc/Expences.odt
    /home/xyz/abc/Review.ods
which is not wanted as the files are really located at /home/xyz/Documents
in the same way
inside this ToExport.txt file
if I use ~ then correct expansion and using the correct file will be an added advantage

hope I made myself clear.
ok...
I found a way to use filelist option to mange my situation.

The format to be used in the file is
 ../<usr>/<directory>/<file to share>
../<usr>/<directory>/<directory to share>  <---- To descend from home
../../<directory>/<file to share>                    <---- To descend from root
../../<directory>/<directory to share> 

These ideas are part of using quickserve in a bash script.

Thanks

Last edited by kgas (2010-09-22 14:57:18)

Offline

#134 2010-09-22 14:48:01

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: quickserve - easy ad-hoc file sharing

@kgas
Why don't you just use full paths in the list file? E.g.

/home/xyz/Documents/Expenses.odt
/home/xyz/Documents/Review.odt

If you do not want to list all of the files, you can include a directory in the file list, e.g. "/home/xyz/Documents/exports" and place those files there.

If I have understood you correctly, then you want quickserve to parse paths relative to the location of the file list itself. I could implement that, but even if I do I think it is better to use full paths when serving files to be sure that you are serving exactly what you intend to.

I'll post an update here if I change the handling of relative paths.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#135 2010-09-22 14:58:27

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: quickserve - easy ad-hoc file sharing

@xyne, thanks and check my previous edited post for a solution I used.

Offline

#136 2010-09-22 15:24:52

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: quickserve - easy ad-hoc file sharing

@kgas
If you're using it in a bash script then you can create the file with absolute paths directly, e.g.

#!/bin/bash

# <whatever comes before this section>

# clear the file list
echo "" >> /path/to/filelist

# rebuild it
readlink -f ../<usr>/<directory>/<file to share>       >> /path/to/filelist
readlink -f ../<usr>/<directory>/<directory to share>  >> /path/to/filelist
readlink -f ../../<directory>/<file to share>          >> /path/to/filelist
readlink -f ../../<directory>/<directory to share>     >> /path/to/filelist

"readlink -f <path>" canonicalizes the path.




Neverthess, I have updated quickserve to consider paths as relative to the directory of the filelist, as I think this is ultimately safer than treating them as relative to the current working directory.

/tmp/sandbox/filelist:

foo.txt
@/tmp/sandbox$ quickserve -f filelist
Starting quickserve...
  address: all interfaces
  port: 8080
  pid: 10898
  serving:
    /tmp/sandbox/foo.txt
Press <Ctrl-C> to exit.
^C<Ctrl-C> pressed, exiting...

@/tmp/sandbox$ cd ..

@/tmp$ quickserve -f sandbox/filelist 
Starting quickserve...
  address: all interfaces
  port: 8080
  pid: 10899
  serving:
    /tmp/sandbox/foo.txt
Press <Ctrl-C> to exit.

Last edited by Xyne (2010-09-22 15:25:27)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#137 2010-09-22 15:58:58

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: quickserve - easy ad-hoc file sharing

my idea is to keep the export file lists in one folder say ToShare , in which I will keep for eg PhotosToShare, FilesToShare, ConfigsToshare etc and each contains its own list in the format I mentioned. now with
quickserve --filelist=/home/<usr>/ToShare/$FilesTosend --port=<p.no>   --certificate=/home/<usr>/.ssl/host.cert  --key=/home/<usr>/.ssl/host.key --ssl
does the work correctly.

Offline

#138 2010-09-22 16:36:13

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: quickserve - easy ad-hoc file sharing

I've added a simple command-line upload script to the project page: quickupload.

*edit*
Added another command-line-friendly feature: plaintext browsing.

Last edited by Xyne (2010-09-22 19:13:20)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#139 2010-09-25 20:23:35

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: quickserve - easy ad-hoc file sharing

Just tested quickupload but the file is not listed in the client side.
quickupload http://<ip address>:port <file> says done but not shown in the client side.
On the quickserve tab I got <host.lan>- [25/Sep/2010 23:03:17] "POST / HTTP/1.1" 403 -
with https option curl requires -k option and with that sometimes prints only the html code and exits.

Offline

#140 2010-09-25 22:31:25

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: quickserve - easy ad-hoc file sharing

@kgas
I've updated the script: http://xyne.archlinux.ca/projects/quick … uickupload

It now handles arguments differently so that you can pass it curl arguments, e.g. "-k".


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#141 2010-09-26 19:49:08

Kosava
Member
From: Serbia
Registered: 2008-08-19
Posts: 127

Re: quickserve - easy ad-hoc file sharing

Exelent server i love it, does is possible to add option in web preview to sort files by date,type,size... (when click on sort by size to sort by most to less size) that would be usefull
thanks.

Offline

#142 2010-09-26 19:52:38

barzam
Member
From: Sweden
Registered: 2009-01-27
Posts: 277

Re: quickserve - easy ad-hoc file sharing

First of all, thanks a lot for creating quickserve. It is perfect for me to share some files with overseas relatives.

I have a problem though. When I browse in catalogues with spaces or other signs than a-z (spaces, apostrophes, parenthesis etc) I get a 303 response and get returned to the root folder of my shares, when the action works I get a 200 response. From the log:

unknown - - [26/Sep/2010 21:49:14] "GET /film/tv-serier/ HTTP/1.1" 200 -
unknown - - [26/Sep/2010 21:49:16] "GET /film/tv-serier/24%20-%20Complete/ HTTP/1.1" 303 -
unknown - - [26/Sep/2010 21:49:16] "GET / HTTP/1.1" 200 -
unknown - - [26/Sep/2010 21:49:18] "GET /film/ HTTP/1.1" 200 -
unknown - - [26/Sep/2010 21:49:19] "GET /film/tv-serier/ HTTP/1.1" 200 -
unknown - - [26/Sep/2010 21:49:22] "GET /film/tv-serier/BlackAdder/ HTTP/1.1" 200 -

Am I being clear enough? Any idea what's not working?

EDIT: tried in Chromium and Conkeror, same result.

Last edited by barzam (2010-09-26 20:01:38)

Offline

#143 2010-09-26 20:35:14

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: quickserve - easy ad-hoc file sharing

@Kosava
I will consider adding a query option to sort files, e.g. "<address>/foo/bar/?sort=size". I don't know when I will have the time though.


@barzam
It should work now. It was a bug introduced with one of the recent updates.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#144 2010-09-26 21:00:40

barzam
Member
From: Sweden
Registered: 2009-01-27
Posts: 277

Re: quickserve - easy ad-hoc file sharing

Hello again!
yes the latest version fixed the problem, thanks for fixing it.

Offline

#145 2010-09-26 21:57:59

Kosava
Member
From: Serbia
Registered: 2008-08-19
Posts: 127

Re: quickserve - easy ad-hoc file sharing

Xyne wrote:

@Kosava
I will consider adding a query option to sort files, e.g. "<address>/foo/bar/?sort=size". I don't know when I will have the time though.

That sound nice.

I noticed one thing in quickserve they show hiden files and folder, does is possible to add filter to not show hidden files and folders ?

Offline

#146 2010-09-26 23:29:04

SoleSoul
Member
From: Israel
Registered: 2009-06-29
Posts: 319

Re: quickserve - easy ad-hoc file sharing

Found it just now. I really like it. Thank you very much Xyne.

Offline

#147 2010-09-27 18:10:23

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: quickserve - easy ad-hoc file sharing

I've added four options for now:

--include
--Include
--exclude
--Exclude

They can be used to pass regular expressions for filtering. This is only preliminary though as I'm not sure that the implementation is the best. I started by applying them to all paths but quickly realized that such an approach had some limitations, e.g. "--include '\.pdf$'" would prevent access to pdf files in directories because the directory itself would not pass the filter.

For now they only apply to files but I will probably refine the way they're applied (e.g. includes only affect files, excludes affect everything).

You can test this with the latest version of quickserve in my repo. I will probably bump it a few times tonight if I have the time.


*edit*
I've changed the behavior somewhat. Include filters are applied to files, exclude filters are applied to files and directories. Let me know how it works.

Last edited by Xyne (2010-09-27 18:42:00)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#148 2010-09-28 13:10:53

Kosava
Member
From: Serbia
Registered: 2008-08-19
Posts: 127

Re: quickserve - easy ad-hoc file sharing

I was trayed --exclude and --include options and it worked for me, but how command goes if i want to exclude more then one thing "--exclude '\.pdf$'".srt .sub and etc.

Offline

#149 2010-09-28 15:10:41

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: quickserve - easy ad-hoc file sharing

Kosava wrote:

I was trayed --exclude and --include options and it worked for me, but how command goes if i want to exclude more then one thing "--exclude '\.pdf$'".srt .sub and etc.

Option 1:

--exclude '\.(?:pdf|srt|sub)$'

Option 2:

--exclude '\.pdf$' --exclude '\.srtf$' --exclude '\.sub$'

Option 3:
Use the new "--filterlist" option with this file:

- \.pdf$
- \.srt$
- \.sub$

(I just added option 3 so you will have to update to use it.)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#150 2010-09-28 16:56:14

Kosava
Member
From: Serbia
Registered: 2008-08-19
Posts: 127

Re: quickserve - easy ad-hoc file sharing

Thank you i was trayed now and works, first option look best for me.

Offline

Board footer

Powered by FluxBB