PUT Method

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
wdatkinson
-


Joined: 29 Jun 2005
Posts: 5

PostPosted: Wed Jun 29, 2005 4:37 pm    Post subject: PUT Method Reply with quote

I'm attempting to utilize Abyss to provision a SIP Phone. I need to allow the phone to both PUT/GET files. I have everything working, except the phone cannot PUT any files back on the server. I can't seem to find any config options to allow this behavior.

I get 200 OK when the phone performs a GET, but I get a 404 Not Found when the phone attempts a PUT.

I've STF'd and can only find references to using a CGI script to allow uploads. In this case, this is not an option. I need to phone to connect to the URL and be able to send/receive files.

Have I reached the limits of Abyss, or am I missing a config option?
_________________
---
Bill Atkinson
Back to top View user's profile Send private message
k1ll3rdr4g0n
-


Joined: 04 Jul 2004
Posts: 609

PostPosted: Wed Jun 29, 2005 6:19 pm    Post subject: Re: PUT Method Reply with quote

wdatkinson wrote:
I'm attempting to utilize Abyss to provision a SIP Phone. I need to allow the phone to both PUT/GET files. I have everything working, except the phone cannot PUT any files back on the server. I can't seem to find any config options to allow this behavior.

I get 200 OK when the phone performs a GET, but I get a 404 Not Found when the phone attempts a PUT.

I've STF'd and can only find references to using a CGI script to allow uploads. In this case, this is not an option. I need to phone to connect to the URL and be able to send/receive files.

Have I reached the limits of Abyss, or am I missing a config option?


Now, I may not be a phone expert. But, I wasn't aware you can transfer files from the phone to the web server.

Hmm...Have you tried this with other phones/web servers? It could be your script, it could be your phone. I 99.9% sure that abyss supports GET.
_________________
Back to top View user's profile Send private message AIM Address
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Wed Jun 29, 2005 6:27 pm    Post subject: Reply with quote

I don't think any phone unless it is a smart phone or PDA phone can do this. I myself have never seen one able to do this so unless you have done it before, you may be out of luck :(
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
wdatkinson
-


Joined: 29 Jun 2005
Posts: 5

PostPosted: Wed Jun 29, 2005 6:28 pm    Post subject: Reply with quote

The phone I'm using supports TFTP, FTP, SFTP, HTTP, HTTPS for provisioning.

And my issue is not the GET method, its the PUT. I can GET just fine, but the phone needs to be able to PUT files back to the server as well. Debug logs, temp config files, etc.

You mention that you weren't aware that it was possible to transfer files from the phone to the web server. Which was my original question. The phone is attempting a PUT method, and the web server does not allow it.

I validate third party SIP devices for use with my company's IP PBX solution. I need to test the HTTP/HTTPS ability, which is what lead me here......
_________________
---
Bill Atkinson
Back to top View user's profile Send private message
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Wed Jun 29, 2005 6:32 pm    Post subject: Reply with quote

Im stumped on this one but perhaps another forum member or Aprelium can help. Good luck anyhow.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
wdatkinson
-


Joined: 29 Jun 2005
Posts: 5

PostPosted: Wed Jun 29, 2005 6:36 pm    Post subject: Reply with quote

I appreciate it. I was hoping that I could use Abyss, but its not looking that way. Thanks for the input.
_________________
---
Bill Atkinson
Back to top View user's profile Send private message
Anonymoose
-


Joined: 09 Sep 2003
Posts: 2192

PostPosted: Wed Jun 29, 2005 6:52 pm    Post subject: Reply with quote

I'm not knocking other members support here, but if you have no answer, or are going to spout FUD about something you apparently know little about, why answer? You have potentially scared off a new Abyss user before Aprelium have even had chance to give a definitive answer on this topic.

@wdatkinson, if you return, could you explain what is stopping you using a standard upload/submit form to CGI on the webserver? If this needs no client side processing other than a file selection & click, how is it causing problems? Does the phone not support POST along with PUT and GET ? I think you'll find even other servers like Apache require CGI to support a PUT.

Quote:

There is some confusion about whether Apache supports the PUT method. In fact, Apache handles PUT exactly like it handles the POST method. That is, it supports it, but in order for it to do anything useful you need to supply a suitable CGI program. This is on contrast to the GET method, which Apache supports internally by sending back files or SSI documents.
Back to top View user's profile Send private message
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Wed Jun 29, 2005 7:14 pm    Post subject: Reply with quote

Anonymoose wrote:
I'm not knocking other members support here, but if you have no answer, or are going to spout FUD about something you apparently know little about, why answer? You have potentially scared off a new Abyss user before Aprelium have even had chance to give a definitive answer on this topic.

@wdatkinson, if you return, could you explain what is stopping you using a standard upload/submit form to CGI on the webserver? If this needs no client side processing other than a file selection & click, how is it causing problems? Does the phone not support POST along with PUT and GET ? I think you'll find even other servers like Apache require CGI to support a PUT.

Quote:

There is some confusion about whether Apache supports the PUT method. In fact, Apache handles PUT exactly like it handles the POST method. That is, it supports it, but in order for it to do anything useful you need to supply a suitable CGI program. This is on contrast to the GET method, which Apache supports internally by sending back files or SSI documents.


I didn't scare him off, I only said that someone else may be able to help because I cannot. You may have been on this forum longer than me and have more posts than me, but it does not mean that you have more priority and authority than any other member. If this person does not want our help, thats his choice. I suggest you stop moaning about the fact that people are not helping by posing 'none useful posts' when you do the same yourself.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
wdatkinson
-


Joined: 29 Jun 2005
Posts: 5

PostPosted: Wed Jun 29, 2005 7:29 pm    Post subject: Reply with quote

Easy guys.....

A little more information on this, as some people may not be familiar with SIP. SIP (session initiation protocol) is a VoIP protocol. I'm wrapping up validation of seven Polycom phone models for use with our IP PBX. I'm down to testing the additional methods for provisioning that were enable in their latest firmware version.

When the phones bootup, they will hit a URL to pull down bootroms, firmware files, and config files. This part works fine, as we're talking basic web serving abilities.

The phones also put upload temp config information, debug logs, etc, via HTTP. This is where I'm running into the problem. When the phones attempts to PUT anything up to Abyss, I get 404's in the log.

I've STF'd and found a few references to WebDAV, but can't find anything recent (latest post was ~1 year old).

As this entire process happens as the phone boots up, there are no options for configuring a form or launching a CGI script. The phone uses a url like this:

http://username:password@serverip/directory

Along with making this work, I also have to write documentation for our customers on how it was tested, etc. Once I can get http to work, then I get to tackle https!

Does that make my mission more clear?
_________________
---
Bill Atkinson
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Wed Jun 29, 2005 9:18 pm    Post subject: Reply with quote

Please contact Aprelium for further information on the this issue
and don't forget to include the forum link , they will help you with
what your trying to do but to tell you the truth I don't know.

Untill you get an answer , try this with an FTP server. LateR!

Contact Aprelium: support@aprelium.com

Sincerely , TRUSTpunk
Back to top View user's profile Send private message Visit poster's website
wdatkinson
-


Joined: 29 Jun 2005
Posts: 5

PostPosted: Wed Jun 29, 2005 11:36 pm    Post subject: Reply with quote

Ok, I'm not testing FTP provisioning, I already know this works. I'm trying to test HTTP provisioning, hence I'm here. I'm not deploying a solution here, I'm validating a third party SIP device and I have specific test cases I have to run against the endpoint.

I'll fire off a message to Aprelium.
_________________
---
Bill Atkinson
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Thu Jun 30, 2005 12:26 am    Post subject: Reply with quote

You will need a CGI to do what your asking for as Anonymoose said. Aprelium
is going to try and get you one written probably by later tommorrow. lateR! :-)

Sincerely , TRUSTpunk
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Sat Jul 02, 2005 1:29 pm    Post subject: Reply with quote

wdatkinson,

We're working on a sample script that supports PUT requests. We'll send it to you and publish it here when it'll be ready.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed Jul 06, 2005 3:30 pm    Post subject: Reply with quote

As promised, please find below a very rudimentary script written in Perl
which supports GET and PUT requests.

Code:
# PUT/GET support
# Written by Aprelium Technologies - 2005 - http://www.aprelium.com
# Released in the public domain

# This is the only constant that must be updated before using the script
$files_path = 'C:/Upload';

# ---
$file_full_path = "$files_path/$ENV{PATH_INFO}";

if ($ENV{'REQUEST_METHOD'} eq 'GET')
{
   if (!(-e $file_full_path) || !open(FILE, $file_full_path))
   {
      print "Status: 404\n\nNot found";
      exit(1);
   }
      
   print "Content-type: application/octet\n\n";
   
   binmode FILE;
   binmode STDOUT;
   
   read(FILE, $in, -s $file_full_path);
   print STDOUT $in || die "Writing Error";
   
   close(FILE) || die "Closing Error";
}
elsif ($ENV{'REQUEST_METHOD'} eq 'PUT')
{
   if (!open(FILE, "+>$file_full_path"))
   {
      print "Status: 403\n\nAccess is denied";
      exit(1);
   }
   
   binmode FILE;
   binmode STDIN;
   
   read(STDIN, $in, $ENV{'CONTENT_LENGTH'});
   
   print FILE $in || die "Writing Error";
   
   close(FILE) || die "Closing Error";
   
   print "Status: 201\n\nUpload successful";
}
else
{
   print "Status: 405\n\nUnsupported HTTP method!";
}


Add Perl support to the server as explained in
http://www.aprelium.com/abyssws/perl.html and copy the script for example in
htdocs/.

Create a directory where the uploads should be stored and update the
$files_path variable value in the script accordingly. Please note that in
Perl \ should be written as \\. You can also use / instead of \ in path
names.

To try the script, we have used the command line tool curl. Its Windows
version can be downloaded from
http://curl.haxx.se/download/curl-7.14.0-win32-ssl-sspi.zip .

To PUT a file on the server, use the following command line:

Code:
curl -T FILE_TO_UPLOAD http://YOUR_SITE/getput.pl/NEW_FILE_NAME


To see the file, browse: http://YOUR_SITE/getput.pl/NEW_FILE_NAME

The script is very rudimentary but it has all the basic building blocks of a
PUT/GET system.

For more ideas, we recommend having a look on the more complex script
http://okmij.org/ftp/Perl/MCHFS-server.pl-txt .
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Wed Jul 06, 2005 4:51 pm    Post subject: Reply with quote

Ive used libcurl a few times in PHP to make scanners for online games I play etc, very usefull =)
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Thu Jul 07, 2005 11:48 am    Post subject: Reply with quote

aprelium wrote:

To PUT a file on the server, use the following command line:

Code:
curl -T FILE_TO_UPLOAD http://YOUR_SITE/getput.pl/NEW_FILE_NAME

Of course, the suggested use of curl is for to test the feature. You can use any client that sends PUT requests with the URL (including the old Netscape Composer, some HTML editors, etc...).
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
lazna
-


Joined: 16 Aug 2015
Posts: 52

PostPosted: Wed Nov 30, 2022 12:33 pm    Post subject: REMOTE_USER and REMOTE_ADDR to filename Reply with quote

woud it be possible to modify this perl script to construct name of saved files in following way?

orig_filename#%REMOTE_USER%#%REMOTE_ADDR%.ext

REMOTE_USER could be filled by string e.g. 'NONE' if empty, for better parsing.
Back to top View user's profile Send private message
admin
Site Admin


Joined: 03 Mar 2002
Posts: 1295

PostPosted: Thu Dec 29, 2022 10:13 pm    Post subject: Re: REMOTE_USER and REMOTE_ADDR to filename Reply with quote

lazna wrote:
woud it be possible to modify this perl script to construct name of saved files in following way?

orig_filename#%REMOTE_USER%#%REMOTE_ADDR%.ext

REMOTE_USER could be filled by string e.g. 'NONE' if empty, for better parsing.


For that, you'll have to update in the script the line:

Code:

$file_full_path = "$files_path/$ENV{PATH_INFO}";


with something that would match with your naming scheme:

Code:

$user=$ENV{REMOTE_USER} || "NONE";
$file_full_path = "$files_path/$ENV{PATH_INFO}_${user}_$ENV{REMOTE_ADDR}.ext";

_________________
Follow @abyssws on Twitter
Subscribe to our newsletter
_________________
Forum Administrator
Aprelium - https://aprelium.com
Back to top View user's profile Send private message
lazna
-


Joined: 16 Aug 2015
Posts: 52

PostPosted: Thu Jan 12, 2023 2:16 pm    Post subject: Reply with quote

thanks, will try it
Back to top View user's profile Send private message
lazna
-


Joined: 16 Aug 2015
Posts: 52

PostPosted: Sat Mar 04, 2023 12:46 pm    Post subject: Reply with quote

it work like a charm!

thank you
Back to top View user's profile Send private message
admin
Site Admin


Joined: 03 Mar 2002
Posts: 1295

PostPosted: Sat Mar 18, 2023 5:39 pm    Post subject: Reply with quote

lazna wrote:
it work like a charm!

thank you


Thank you for your feedback.
_________________
Follow @abyssws on Twitter
Subscribe to our newsletter
_________________
Forum Administrator
Aprelium - https://aprelium.com
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group