[31686] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2949 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 17 21:09:26 2010

Date: Mon, 17 May 2010 18:09:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 17 May 2010     Volume: 11 Number: 2949

Today's topics:
    Re: determining whether a server supports secure authen <hjp-usenet2@hjp.at>
    Re: determining whether a server supports secure authen <hjp-usenet2@hjp.at>
    Re: FAQ 5.4 How do I delete the last N lines from a fil <willem@turtle.stack.nl>
    Re: FAQ 5.4 How do I delete the last N lines from a fil <willem@turtle.stack.nl>
    Re: FAQ 5.4 How do I delete the last N lines from a fil <rvtol+usenet@xs4all.nl>
    Re: FAQ 5.4 How do I delete the last N lines from a fil <uri@StemSystems.com>
    Re: FAQ 5.4 How do I delete the last N lines from a fil <peter@makholm.net>
    Re: FAQ 5.4 How do I delete the last N lines from a fil <hjp-usenet2@hjp.at>
    Re: FAQ 5.4 How do I delete the last N lines from a fil <hjp-usenet2@hjp.at>
    Re: FAQ 5.4 How do I delete the last N lines from a fil sln@netherlands.com
    Re: FAQ 5.4 How do I delete the last N lines from a fil sln@netherlands.com
    Re: MinGW and Perl 5.12 - Windows 64 bits ActiveState <hjp-usenet2@hjp.at>
        WAB ftp Server <tim@johnsons-web.com>
    Re: WAB ftp Server <glex_no-spam@qwest-spam-no.invalid>
    Re: WAB ftp Server <RedGrittyBrick@SpamWeary.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 17 May 2010 21:38:22 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: determining whether a server supports secure authentication
Message-Id: <slrnhv36pe.15p.hjp-usenet2@hrunkner.hjp.at>

On 2010-05-16 23:08, Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> On 2010-05-16, Uno <merrilljensen@q.com> wrote:
>> I was "sure" that I was using SSL, and in my head it sounded right that 
>> a secure socket layer would employ secure authentication.  They are 
>> completely separate notions.
>
> Secure connection makes absolutely no sense without secure
> authentication

I admit that I don't know exactly what "secure authentication" in SMTP
context means (haven't found a spec yet and I'm too lazy to read
Thunderbird source code (besides, it's written in C++ and off-topic in
this group :-) )) but I do know that it is some microsoft-proprietary
authentication mechanism and probably has something to do with a domain
controller. Surely you don't think thet SSL doesn't make sense unless
you can authenticate against a Windows domain controller, do you?

If you use STARTTLS (or SSMTP), the authentication will be part of the
encrypted session and safe from eavesdropping (including MITM attacks in
a typical SUBMISSION scenario), so even PLAIN authentication is
moderately safe. CRAM-MD5 trades one weakness for another (instead of
sending a plain text passwort over an encrypted channel it is now stored
unencrypted on the server). Client-Certificates would be best but aren't
common, AFAIK.


> The standard analogy of secure connection is sending a parcel guarded
> by a policeman on route.  The standard analogy of having no secure
> authentication is leaving a package on a bench in a public park so
> that the other party may come and pick it up.  Now imagine doing
> both...

I don't think you analogy has much to do with the situation.

	hp


------------------------------

Date: Mon, 17 May 2010 21:49:20 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: determining whether a server supports secure authentication
Message-Id: <slrnhv37e0.15p.hjp-usenet2@hrunkner.hjp.at>

On 2010-05-16 21:43, Uno <merrilljensen@q.com> wrote:
> On 5/16/2010 6:20 AM, Peter J. Holzer wrote:
>> On 2010-05-16 05:09, Uno<merrilljensen@q.com>  wrote:

[problems authenticating at an SMTP/SUBMISSION server]


>>> Can I use the perl programming language to determine whether what type
>>> of authentication this server understands?
>>
>> Yes. However, you don't have to write that program yourself, as somebody
>> has already done it: Look for "swaks" (the SWiss Army Knife for Smtp).
>> Some linux distributions (e.g. Debian) include it, or you can download
>> it from http://www.jetmore.org/john/code/swaks/
>
> Well, hot damn:
>
>> $ swaks --to merrilljensen@q.com --server pop3.live.com
>=== Trying pop3.live.com:25...
> *** Error connecting 0.0.0.0 to pop3.live.com:25:
> *** 	IO::Socket::INET: connect: timeout
> $ swaks --to merrilljensen@q.com --server smtp.live.com
>=== Trying smtp.live.com:25...
>=== Connected to smtp.live.com.
><-  220 BLU0-SMTP21.blu0.hotmail.com Microsoft ESMTP MAIL Service, 
> Version: 6.0.3790.4675 ready at  Sun, 16 May 2010 14:29:18 -0700
>   -> EHLO dan-desktop
><-  250-BLU0-SMTP21.blu0.hotmail.com Hello [97.123.175.133]
><-  250-TURN
><-  250-SIZE 35840000
><-  250-ETRN
><-  250-PIPELINING
><-  250-DSN
><-  250-ENHANCEDSTATUSCODES
><-  250-8bitmime
><-  250-BINARYMIME
><-  250-CHUNKING
><-  250-VRFY
><-  250-TLS
><-  250-STARTTLS
><-  250 OK
>   -> MAIL FROM:<dan@dan-desktop>
>
> So ... what's all this?

If you had read the next line in the dialogue you would know:

<** 530 5.7.0 Must issue a STARTTLS command first

So you need to use STARTTLS:

% swaks --to merrilljensen@q.com --server smtp.live.com --tls
=== Trying smtp.live.com:25...
[...]
<~  250-VRFY
<~  250-AUTH LOGIN PLAIN
<~  250 OK
 ~> MAIL FROM:<hjp@zeno.hjp.at>
<~* 550 5.7.3 Requested action aborted; user not authenticated
 ~> QUIT

Now the server offers "AUTH LOGIN PLAIN", i.e., you can authenticate
yourself with either the LOGIN or the PLAIN mechanism. So this answers
your question:

>>> Can I use the perl programming language to determine whether what type
>>> of authentication this server understands?

Swaks can authenticate itself using these mechanisms, but you have to
tell it your username and password, of course.

	hp


------------------------------

Date: Mon, 17 May 2010 18:59:57 +0000 (UTC)
From: Willem <willem@turtle.stack.nl>
Subject: Re: FAQ 5.4 How do I delete the last N lines from a file?
Message-Id: <slrnhv34hd.4eb.willem@turtle.stack.nl>

Uri Guttman wrote:
)>>>>> "W" == Willem  <willem@turtle.stack.nl> writes:
)
)  W>   my $spos = rindex($block, "\n"); 
)
) ahh, here is your bottleneck. use tr/// to count the newlines of each
) block. if you haven't read enough then read another. you don't need to
) use rindex for each newline. also when you find the block which has the
) desired ending, you can use a forward regex or something else to find
) the nth newline in one call. perl is slow doing ops in a loop but fast
) doing loops internally. so always use perl ops which do more work for you.

So you're thinking it could be even faster ?
Okay, I tried it with tr, and indeed it goes almost twice as fast.
About five times as fast as ReadBackwards.

I added:

      my $nnl = ($block =~ tr/\n/\n/);
      if ($lines >= $nnl) {
	$lines -= $nnl;
	next;
      }

At this time, I'm beginning to see significant fluctuations (50%),
caused by disk caching effects, most likely.

'user' time is about a factor 10:1 against ReadBackwards, while
'real' time is only about 8:1, so disk I/O is definitely a factor here.

)  W>   while ($spos >= 0) {
)  W>     if (--$lines < 0) {
)  W>       truncate($fh, $pos + $spos)
)  W>         or die "Failed to truncate '$file':$!";
)  W>       exit(0);
)  W>     }
)  W>     $spos = rindex($block, "\n", $spos - 1);
)
) that is a slow perl loop calling rindex over and over. 

I know, I was going for correctness first.

What regex or other perl-internal would you use to find the Nth newline
from the rear ?

PS: I don't really think that will make much difference, as with the tr///
    optimization, it will only be osed on the final $blocksize bytes.

PPS: I might try a C version, to see what that does, but not today.


SaSW, Willem
-- 
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT


------------------------------

Date: Mon, 17 May 2010 19:10:15 +0000 (UTC)
From: Willem <willem@turtle.stack.nl>
Subject: Re: FAQ 5.4 How do I delete the last N lines from a file?
Message-Id: <slrnhv354n.4eb.willem@turtle.stack.nl>

Uri Guttman wrote:
) did you try my suggested algorithm? it isn't too much work reading large
) blocks from the end, counting newlines and then doing a truncate at the
) desired point. i see it at about 30 lines of code or so.

Which algorithm would that be ?  I posted my code crossthread, you already
commented on it (especially the rindex bit) and I dropped in the suggested
tr/// optimization.  A hundred thousand lines removed from ten million in
between 0.02 and 0.05 seconds, a million from ten million in between 0.19
and 0.35 seconds.  Fluctuations probably due to disk caching effects.

File::ReadBackwards takes between 1.8 and 2 seconds, so I guess the
overhead in splitting the blocks into lines and such is significant.

Or did you put a function in that module that I'm missing ?
I used the code posted in the FAQ that opened this thread.


SaSW, Willem
-- 
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT


------------------------------

Date: Mon, 17 May 2010 21:10:08 +0200
From: "Dr.Ruud" <rvtol+usenet@xs4all.nl>
Subject: Re: FAQ 5.4 How do I delete the last N lines from a file?
Message-Id: <4bf19490$0$22918$e4fe514c@news.xs4all.nl>

Willem wrote:

> a ten-million line file
> that is over 600mb large.

Anything is over 600 mb large.
With the exception of the 600 mb themselves of course.

-- 
Ruud


------------------------------

Date: Mon, 17 May 2010 15:12:27 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: FAQ 5.4 How do I delete the last N lines from a file?
Message-Id: <87y6fiwdes.fsf@quad.sysarch.com>

>>>>> "W" == Willem  <willem@turtle.stack.nl> writes:

  W> Uri Guttman wrote:
  W> )>>>>> "W" == Willem  <willem@turtle.stack.nl> writes:
  W> )
  W> )  W>   my $spos = rindex($block, "\n"); 
  W> )
  W> ) ahh, here is your bottleneck. use tr/// to count the newlines of each
  W> ) block. if you haven't read enough then read another. you don't need to
  W> ) use rindex for each newline. also when you find the block which has the
  W> ) desired ending, you can use a forward regex or something else to find
  W> ) the nth newline in one call. perl is slow doing ops in a loop but fast
  W> ) doing loops internally. so always use perl ops which do more work for you.

  W> So you're thinking it could be even faster ?

i know it will be faster. it does less work by far since it doesn't
split lines and loop over each line. that is a ton of perl code being
skipped. i ever claimed readbackwards was the fastest way to truncate a
file. it is faster than simpler methods but code that just does this
would have to be faster as it does so much less work.

  W> Okay, I tried it with tr, and indeed it goes almost twice as fast.
  W> About five times as fast as ReadBackwards.

sounds reasonable.

  W> I added:

  W>       my $nnl = ($block =~ tr/\n/\n/);

you don't need the replacement part if you are just counting chars. when
tr is passed an empty replacement part it uses the left part so it
effectively doesn't change anything (unless you use modifier). counting
newlines is just tr/\n//.

  W>       if ($lines >= $nnl) {
  W> 	$lines -= $nnl;
  W> 	next;
  W>       }

  W> At this time, I'm beginning to see significant fluctuations (50%),
  W> caused by disk caching effects, most likely.

probably. they are hard to work around with large files being tested.

  W> 'user' time is about a factor 10:1 against ReadBackwards, while
  W> 'real' time is only about 8:1, so disk I/O is definitely a factor here.

  W> )  W>   while ($spos >= 0) {
  W> )  W>     if (--$lines < 0) {
  W> )  W>       truncate($fh, $pos + $spos)
  W> )  W>         or die "Failed to truncate '$file':$!";
  W> )  W>       exit(0);
  W> )  W>     }
  W> )  W>     $spos = rindex($block, "\n", $spos - 1);
  W> )
  W> ) that is a slow perl loop calling rindex over and over. 

  W> I know, I was going for correctness first.

  W> What regex or other perl-internal would you use to find the Nth newline
  W> from the rear ?

within a block, i would count from the front using m/\n{$cnt}/ and then
pos to find out where it was in the block. you can calculate the
truncate point from that. be aware of off by one issues as they abound
in this type of coding. 

  W> PS: I don't really think that will make much difference, as with the tr///
  W>     optimization, it will only be osed on the final $blocksize bytes.

it will still be faster if you have large block sizes. and larger blocks
will generally be faster as well up to the point when ram is running out.

  W> PPS: I might try a C version, to see what that does, but not today.

given that the work is now down to reading large blocks, scanning
quickly for newlines, i suspect a c version won't be that much faster as
it still needs to do the same work. the key is to stay inside perl's
guts which are very fast and stay away from perl ops which are slow (the
interpreter op loop is the major overhead in perl vs c).

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


------------------------------

Date: Mon, 17 May 2010 21:16:51 +0200
From: Peter Makholm <peter@makholm.net>
Subject: Re: FAQ 5.4 How do I delete the last N lines from a file?
Message-Id: <87mxvy2va4.fsf@vps1.hacking.dk>

Ralph Malph <ralph@happydays.com> writes:

> $ time perl faq.pl > top_n-10000
>
> real    0m0.219s
> user    0m0.093s
> sys     0m0.061s
>
> $ time cat puke | wc -l | xargs echo -10000 + | bc \
>   | xargs echo head puke -n | sh > top_n-10000
>
> real    0m0.312s
> user    0m0.090s
> sys     0m0.121s

On a GNU system, which I believe includes cygwin, you should be able
to just say

$ time head -n -10000 puke > top_n-10000

No idea about how it would compare to the other solutions.

//Makholm


------------------------------

Date: Mon, 17 May 2010 21:19:16 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: FAQ 5.4 How do I delete the last N lines from a file?
Message-Id: <slrnhv35ll.15p.hjp-usenet2@hrunkner.hjp.at>

On 2010-05-17 00:26, sln@netherlands.com <sln@netherlands.com> wrote:
> On Sun, 16 May 2010 04:00:02 GMT, PerlFAQ Server <brian@theperlreview.com> wrote:
>>5.4: How do I delete the last N lines from a file?
>>
>>    (contributed by brian d foy)
>>
>>    The easiest conceptual solution is to count the lines in the file then
>>    start at the beginning and print the number of lines (minus the last N)
>>    to a new file.

This takes two passes: First to get the number of lines, second to copy.


>>    Most often, the real question is how you can delete the last N lines
>>    without making more than one pass over the file, or how to do it with a
>>    lot of copying. The easy concept is the hard reality when you might have
>>    millions of lines in your file.
>
> I believe, "or how to do it with a lot of copying." was meant to be
> "or how to do it without a lot of copying."

Probably.


> And, I'm no so sure you're not conflating "making more than one pass over the file"
> with reading/writing the file more than one time.

See above. As you showed, you can do it in one pass at the expense of
using more memory.


>>    One trick is to use "File::ReadBackwards", which starts at the end of
>
> Is this really a trick?
>
> I can't remember if there is a truncate at file position primitive.

There is at least on unix-like system. See truncate(2) and ftruncate(2).

> If I take a guess one way, I would say this approach would work as fast
> as any:
>
> create a line stack, the size of N
> read each line, store line in stack, increment a counter
> when the counter equals N, drop the oldest line into a new file, newest line to stack.
> repeat until end of old file
> close new file
> delete old file
> rename new file to old

That still means you have to read the whole file and write all but the
last N lines, and you have to keep N lines in memory.

With File::ReadBackwards and truncate you only have to read N lines and
write none (truncate has to update metadata, of course, but if you cut
of only a small part of the file that's cheap), and you don't have to
keep lines in memory. (On the other hand reading backwards is usually a
lot slower than reading forward)

	hp



------------------------------

Date: Mon, 17 May 2010 22:03:48 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: FAQ 5.4 How do I delete the last N lines from a file?
Message-Id: <slrnhv3894.15p.hjp-usenet2@hrunkner.hjp.at>

On 2010-05-17 17:54, Ralph Malph <ralph@happydays.com> wrote:
> On 5/17/2010 12:43 PM, Ralph Malph wrote:
> [snip]
>> $ time cat puke | wc -l | xargs echo -10000 + | bc \
>> | xargs echo head puke -n | sh > top_n-10000
[...]
> lines = `wc -l puke`
> let num_lines=$(($lines-10000))
> head puke -n $num_lines

That's still needlessly complicated.

    head -n -10000 puke 

	hp


------------------------------

Date: Mon, 17 May 2010 13:47:53 -0700
From: sln@netherlands.com
Subject: Re: FAQ 5.4 How do I delete the last N lines from a file?
Message-Id: <s1a3v5hkmbtils1ud1s57ojbjj9cpf57jc@4ax.com>

On Mon, 17 May 2010 21:19:16 +0200, "Peter J. Holzer" <hjp-usenet2@hjp.at> wrote:

>On 2010-05-17 00:26, sln@netherlands.com <sln@netherlands.com> wrote:
>>
>> I can't remember if there is a truncate at file position primitive.
>
>There is at least on unix-like system. See truncate(2) and ftruncate(2).

I guess there is the Win32 _chsize() which takes a file descripter
and size parameter. This either expands or truncates the file.
I'm not so sure this doesen't just rewrite the file anyway instead of
altering the table entry. I never used it.

>
>> If I take a guess one way, I would say this approach would work as fast
>> as any:
>>
>> create a line stack, the size of N
>> read each line, store line in stack, increment a counter
>> when the counter equals N, drop the oldest line into a new file, newest line to stack.
>> repeat until end of old file
>> close new file
>> delete old file
>> rename new file to old
>
>That still means you have to read the whole file and write all but the
>last N lines, and you have to keep N lines in memory.
>
>With File::ReadBackwards and truncate you only have to read N lines and
>write none (truncate has to update metadata, of course, but if you cut
>of only a small part of the file that's cheap), and you don't have to
>keep lines in memory. (On the other hand reading backwards is usually a
>lot slower than reading forward)
>

Yes, I guess reading backwards for newline would be the logically
shorter solution, but whats the need to truncate at the end, and on
translated text mode, anyway ?

-sln


------------------------------

Date: Mon, 17 May 2010 14:25:22 -0700
From: sln@netherlands.com
Subject: Re: FAQ 5.4 How do I delete the last N lines from a file?
Message-Id: <6bc3v5hq50ib900gkt5jsijceehsf089g3@4ax.com>

On Mon, 17 May 2010 13:47:53 -0700, sln@netherlands.com wrote:

>I guess there is the Win32 _chsize() which takes a file descripter
>and size parameter. This either expands or truncates the file.
>I'm not so sure this doesen't just rewrite the file anyway instead of
>altering the table entry. I never used it.
>

I have no idea what Perl uses (if at all) for truncation
on Windows.

There is also the SetEndOfFile() if working with HANDLE's.

Some docs:
"The SetEndOfFile function moves the end-of-file (EOF) position
 for the specified file to the current position of the file pointer.
 This function sets the physical end of a file (as indicated by
 allocated clusters). To set the logical end of a file,
 use the SetFileValidData function."

HANDLE's in windows allows all sorts of weird things, like
sync/async io. Its the basis and has its roots in the kernel.
So every read/write/open/close of all files, all devices, absolutely
everything is based on a single paradigm of reading, writing, opening
or closing a file. Where a "file" is a device, and a "device" is a file.

All the stubs behind win32, funnel down to a relatively small core
of kernel mode functions.

-sln


------------------------------

Date: Mon, 17 May 2010 22:10:32 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: MinGW and Perl 5.12 - Windows 64 bits ActiveState
Message-Id: <slrnhv38lo.15p.hjp-usenet2@hrunkner.hjp.at>

On 2010-05-17 01:47, sln@netherlands.com <sln@netherlands.com> wrote:
> Back in the day, I guess the ibm370 was 128 bit.

32 bit. Current versions of this architecture (now called z series,
unless they've changed the name again) are 64 bit.


> Can Perl be written for risc processors?

What do you mean by "Can Perl be written"? Neither Perl code nor the
perl interpreter need to be specially "written" for RISC processors. The
perl interpreter is written in reasonably portable C and compiles fine
on RISC processors (which aren't that similar, btw: A SPARC processor is
quite different from an Alpha).

> But Perl gets cornerred in the OS implementation details. That will
> eventually be the death of it. But thats not Perl fault, it trys to
> please too many, too much.

-v?

	hp


------------------------------

Date: Mon, 17 May 2010 17:43:14 -0500
From: Tim Johnson <tim@johnsons-web.com>
Subject: WAB ftp Server
Message-Id: <slrnhv3ft3.8kq.tim@bart.johnson.com>

FYI: I am not a perl programmer. I work in python, rebol, c and lisp on linux
platforms. My inquiry is on behalf of my business partner and one of cour
clients. I will forward any of your responses to my partner.

######################################################################

My business partner,  has been using a perl API to fetch data from a
vendor's server for years. Now the vendor has implemented a new
server and my partner can't download.

Over the weekend, I tried a couple of
things in the spirit of getting a fresh set of eyes on the problem.

1)From either the linux or the Windows XP ftp command line, I can
log in to the server. It gives the following welcome message:
""" 220 WAB FTP Server Ready """.

Some commands work, some fail. 'get' fails with the following:
""" 502 Command not implemented. """

Using a python script with the standard python ftplib API, I can get a
directory listing using one API python command, failing with another.  Again
the 502 error.

I'm guessing here that this FTP server implements a non-standard
command set. Probably windows technologies like .net are successful
because that is recognized from the handshake on.

2)I've done some googling for documentation on "WAB FTP Server", but
so far I have had no luck finding any.

Just wondering if any of you have any ideas or experience with this.
If we had the docs, we could build our own API or maybe the perl
community has rolled one up already.

Any comments would be appreciated.
thanks
-- 
Tim 
tim at johnsons-web.com or akwebsoft.com
http://www.akwebsoft.com


------------------------------

Date: Mon, 17 May 2010 18:07:42 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: WAB ftp Server
Message-Id: <4bf1c1f0$0$1334$815e3792@news.qwest.net>

Tim Johnson wrote:
[...]
> My business partner,  has been using a perl API to fetch data from a
> vendor's server for years. Now the vendor has implemented a new
> server and my partner can't download.
> 
[...]
> 1)From either the linux or the Windows XP ftp command line, I can
> log in to the server. It gives the following welcome message:
> """ 220 WAB FTP Server Ready """.
> 
> Some commands work, some fail. 'get' fails with the following:
> """ 502 Command not implemented. """
[...]
> Any comments would be appreciated.

First, I'd suggest not wasting your time and contact the vendor.
Possibly they (re)moved their FTP service to another machine.

To waste time, you could try command line arguments common to
FTP, during the session, to see what's avaiable, e.g. ?.


------------------------------

Date: Tue, 18 May 2010 00:40:59 +0100
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.invalid>
Subject: Re: WAB ftp Server
Message-Id: <kfednYUFWOSPSWzWnZ2dnUVZ8gWdnZ2d@bt.com>

On 17/05/2010 23:43, Tim Johnson wrote:
> FYI: I am not a perl programmer. I work in python, rebol, c and lisp on linux
> platforms. My inquiry is on behalf of my business partner and one of cour
> clients. I will forward any of your responses to my partner.
>
> ######################################################################
>
> My business partner,  has been using a perl API to fetch data from a
> vendor's server for years. Now the vendor has implemented a new
> server and my partner can't download.

I would ask the vendor.

>
> Over the weekend, I tried a couple of
> things in the spirit of getting a fresh set of eyes on the problem.
>
> 1)From either the linux or the Windows XP ftp command line, I can
> log in to the server. It gives the following welcome message:
> """ 220 WAB FTP Server Ready """.
>
> Some commands work, some fail. 'get' fails with the following:
> """ 502 Command not implemented. """

A "get" command in an FTP client will transmit a "RETR" FTP command over 
the FTP control connection. Any FTP server that doesn't implement the 
RETR command isn't a very useful FTP server.

Some network devices implement a subset of FTP. For example some 
print-server devices (e.g. HP JetDirect) allow printing using FTP, it is 
conceivable that such a device wouldn't support a RETR command.

> Using a python script with the standard python ftplib API, I can get a
> directory listing using one API python command, failing with another.  Again
> the 502 error.

I'd use something like Wireshark to see what command sequence is 
actually being sent.

>
> I'm guessing here that this FTP server implements a non-standard
> command set. Probably windows technologies like .net are successful
> because that is recognized from the handshake on.
>

FTP is defined in RFC 959, The 220 and 502 responses are defined there. 
The normal commands are defined there.

So far as I know, there's no proprietary non-standard variant of FTP 
associated with .NET


> 2)I've done some googling for documentation on "WAB FTP Server", but
> so far I have had no luck finding any.
>
> Just wondering if any of you have any ideas or experience with this.
> If we had the docs, we could build our own API or maybe the perl
> community has rolled one up already.

Perl has modules for standards-compliant FTP servers.

Unless you can be more specific about the vendor or the Perl script I 
think it will be hard to help.

Talking to the vendor seems like a good idea.

-- 
RGB


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 2949
***************************************


home help back first fref pref prev next nref lref last post