From: David Bakhash
Subject: CL-HTTP problems on NT/LW
Date: 
Message-ID: <cxjd7x74l6x.fsf@acs5.bu.edu>
Hi,

I'm trying to set up CL-HTTP on NT using LW.  I've successfully built
everything, but I can't seem to get EXPORT-URL to work.

All I want is to get CL-HTTP to give a directory listing of my x:/ directory.
Can someone tell me what the EXPORT-URL call should look like?

thanks,
dave

From: Rainer Joswig
Subject: Re: CL-HTTP problems on NT/LW
Date: 
Message-ID: <joswig-0108991841550001@194.163.195.67>
In article <···············@acs5.bu.edu>, David Bakhash <·····@bu.edu> wrote:

> Hi,
> 
> I'm trying to set up CL-HTTP on NT using LW.  I've successfully built
> everything, but I can't seem to get EXPORT-URL to work.
> 
> All I want is to get CL-HTTP to give a directory listing of my x:/ directory.
> Can someone tell me what the EXPORT-URL call should look like?
> 
> thanks,
> dave

Have you looked in the examples directory in the lw directory?

Here is an example how to export a bunch of Lisp files:

(export-url #u"/cl-http/sources/lw/examples/"
            :lisp-directory
            :pathname (pathname "http:lw;examples;*.lisp")
            :expiration `(:interval ,(* 15. 60.))
            :keywords '(:cl-http :documentation :lisp-works)
            :documentation
       "Example Lisp files showing configuration of the server and export of URLs.")


See the documentation of EXPORT-URL for more details (it's long).
Above depends on a few things:

- your server already is correctly initialized (see next point)
- The readmacro #u finds a meaningful default for your server name
  via (HTTP:LOCAL-CONTEXT)
  You could specify URLs also via URL:URL, but then you need
  to write down the full URL (scheme+host+port ...)
- you are satisfied with some of the defaults, otherwise
  there are more options to look at and experiment with
From: David Bakhash
Subject: Re: CL-HTTP problems on NT/LW
Date: 
Message-ID: <cxj907v4e5b.fsf@acs5.bu.edu>
······@lavielle.com (Rainer Joswig) writes:

> > I'm trying to set up CL-HTTP on NT using LW.  I've successfully built
> > everything, but I can't seem to get EXPORT-URL to work.
> > 
> > All I want is to get CL-HTTP to give a directory listing of my x:/ directory.
> > Can someone tell me what the EXPORT-URL call should look like?
> > 
> > thanks,
> > dave
> 
> Have you looked in the examples directory in the lw directory?
> 
> Here is an example how to export a bunch of Lisp files:

yes.  sure.  Those examples didn't help at all.  For one thing, I tried all of
them, both exaclty, and with the obvious modifications for NT, but none
worked.  This is really not a question where I need someone to point me to the
right docs, but rather just a simple working example from a working
implementation of CL-HTTP on Windows using LW.

> See the documentation of EXPORT-URL for more details (it's long).
> Above depends on a few things:

Yes.  read the docs.  they gave no good examples.  the examples for LW all
seem to be for UNIX file systems.

dave
From: Rainer Joswig
Subject: Re: CL-HTTP problems on NT/LW
Date: 
Message-ID: <joswig-0108991957400001@194.163.195.67>
In article <···············@acs5.bu.edu>, David Bakhash <·····@bu.edu> wrote:


> yes.  sure.  Those examples didn't help at all.  For one thing, I tried all of
> them, both exaclty, and with the obvious modifications for NT,

But there are no modifications. These examples work directly
on LWW on NT - no changes.

The file http:lw;translations.lisp sets up the logical
pathname host "HTTP" - this is where the CL-HTTP
code resides.

> Yes.  read the docs.  they gave no good examples.  the examples for LW all
> seem to be for UNIX file systems.

Don't know. For me it works out of the box on NT.
The pathnames you saw in the example are logical
pathnames, (pathname "http:lw;examples;*.lisp")
so they don't have to do anything with
Unix. 

If you would like to use platform specific pathnames
you would do it as always in LWW.

(translate-logical-pathname (pathname "http:lw;examples;*.lisp"))
should return a LWW specific pathname.
From: David Bakhash
Subject: Re: CL-HTTP problems on NT/LW
Date: 
Message-ID: <cxj3dy24z8c.fsf@acs5.bu.edu>
I'll try it again.

I just think that there could be so many things wrong here, like what's being
returned by (local-host-domain-name) (totally wrong, AFAIK).  I'll give it all
a shot.  Thanks for all the help.

dave
From: Christopher R. Barry
Subject: Re: CL-HTTP problems on NT/LW
Date: 
Message-ID: <87so631k95.fsf@2xtreme.net>
David Bakhash <·····@bu.edu> writes:

> Hi,
> 
> I'm trying to set up CL-HTTP on NT using LW.  I've successfully built
> everything, but I can't seem to get EXPORT-URL to work.
> 
> All I want is to get CL-HTTP to give a directory listing of my x:/ directory.
> Can someone tell me what the EXPORT-URL call should look like?

HTTP:EXPORT-URL has a _huge_ multi-page doc-string. If you still can't
figure it out after reading that, then subscribe to the www-cl mailing
list and ask there.

Christopher
From: David Bakhash
Subject: Re: CL-HTTP problems on NT/LW
Date: 
Message-ID: <cxj7lnf4b3g.fsf@acs5.bu.edu>
again, I've read the page.  I don't want to subscribe to anything.  I just
want an example from someone who's used it under MS Windows/LW.

Sometimes, an example can really shed light on things, even more than
documentation.

dave
From: Christopher R. Barry
Subject: Re: CL-HTTP problems on NT/LW
Date: 
Message-ID: <87pv171gg5.fsf@2xtreme.net>
David Bakhash <·····@bu.edu> writes:

> again, I've read the page.  I don't want to subscribe to anything.  I just
> want an example from someone who's used it under MS Windows/LW.
> 
> Sometimes, an example can really shed light on things, even more than
> documentation.

There are plenty of examples of HTTP:EXPORT-URL in the examples
directory. If you're not capable of getting things working after
reading them, then give up.

Christopher
From: David Bakhash
Subject: Re: CL-HTTP problems on NT/LW
Date: 
Message-ID: <cxj672z48sj.fsf@acs5.bu.edu>
······@2xtreme.net (Christopher R. Barry) writes:

> > again, I've read the page.  I don't want to subscribe to anything.  I just
> > want an example from someone who's used it under MS Windows/LW.
> > 
> > Sometimes, an example can really shed light on things, even more than
> > documentation.
> 
> There are plenty of examples of HTTP:EXPORT-URL in the examples
> directory. If you're not capable of getting things working after
> reading them, then give up.

Thanks for the advice, enlighted one.  You see, not all of us are as
intelligent as you are.  If you don't want to followup to a post, then don't.
People like you waste bandwidth, hurt people's feelings, and make them feel
stupid, and insufficient.  I asked for help.  If someone out there has
experience, and the time to reply, then so be it.  Your post offers no
additional information, except that you are condescending.

dave
From: Christopher R. Barry
Subject: Re: CL-HTTP problems on NT/LW
Date: 
Message-ID: <87iu6z1cbr.fsf@2xtreme.net>
David Bakhash <·····@bu.edu> writes:

> ······@2xtreme.net (Christopher R. Barry) writes:
> 
> > > again, I've read the page.  I don't want to subscribe to anything.  I just
> > > want an example from someone who's used it under MS Windows/LW.
> > > 
> > > Sometimes, an example can really shed light on things, even more than
> > > documentation.
> > 
> > There are plenty of examples of HTTP:EXPORT-URL in the examples
> > directory. If you're not capable of getting things working after
> > reading them, then give up.
> 
> Thanks for the advice, enlighted one.  You see, not all of us are as
> intelligent as you are.  If you don't want to followup to a post, then don't.
> People like you waste bandwidth, hurt people's feelings, and make them feel
> stupid, and insufficient.  I asked for help.  If someone out there has
> experience, and the time to reply, then so be it.  Your post offers no
> additional information, except that you are condescending.

If it was that important to you, you could subscribe to the www-cl
list. You've got this attitude like "I can't figure it out... I need
examples... I can't figure out the provided examples... I can't get
Rainer's example to work... I'm not subscribing to the www-cl list and
asking there where there are many Lispworks CL-HTTP users and where
I'm more likely to get better information because that's going too far
out of my way and the comp.lang.lisp people can answer my question
instead."

Christopher
From: Rainer Joswig
Subject: Re: CL-HTTP problems on NT/LW
Date: 
Message-ID: <joswig-0108992241090001@194.163.195.67>
> David Bakhash <·····@bu.edu> writes:
> > > > again, I've read the page.  I don't want to subscribe to anything.  I just
> > > > want an example from someone who's used it under MS Windows/LW.
> > > > 
> > > > Sometimes, an example can really shed light on things, even more than
> > > > documentation.

I personally think that you are doing something wrong,
that you missed some important information somewhere or
that your installation has something special.
But this is something that isn't unsual, since though
CL-HTTP under LWW is working quite nice (it works really
almost out of the box for me, I'm even using it as
a web proxy), but still lacks some polishing and getting
a web server like CL-HTTP to work is not necessary that easy.

So it might be very valuable to know what the particular
problem is - so that we can robustify the installation
or the documentation. I found the guys at Harlequin
very knowledgeable and helpful. The www-cl mailing
list or the respective bug mailing list would
then the next step you could contact. The mailing
list archives are also available online.

It might be of help to know a bit more about your
problem:

- server version
- LWW version
- exact problem description
- how you got there
- backtrace, if applicable

Thanks for your time,

Rainer Joswig
From: David Bakhash
Subject: Re: CL-HTTP problems on NT/LW
Date: 
Message-ID: <cxj4sii4zes.fsf@acs5.bu.edu>
Thanks for the help.

I'll describe what has happened so far.

First off, the enviroment:

MS Windows NT running LW 4.0 enterprise.

I think the main problem has to do with the NT file system.

Here's the first, and probably simplest example I found in the `exports.lisp'
file:

(export-url "/cl-http/sources/lw/-read-me-.text"
            :text-file
            :pathname (pathname "http:lw;-read-me-.text")
            :expiration `(:interval ,(* 15. 60.))
            :keywords '(:cl-http :documentation :lisp-works)
            :documentation
	    "README file for this alpha version of CL-HTTP for LispWorks for
UNIX.")

In order to make the pathname in the url-string meaningful under NT I changed
it to:

"x:/cl-http/lw/-read-me-.text"

But, when I did that I got:

    No parser defined for protocol scheme in the URL,
    "x:/cl-http/lw/-read-me-.text"

I tried using the backslash style, just in case, and still no go.  I didn't
know what to do with the :pathname argument, so I left it alone, and then
tried to change it to the full pathname of that file, and other random stuff.
None of them worked, even when I got no errors from the #'export-url
function.  I am almost sure that the webserver is working, though, because my
browser (IE) is opening up connections to it successfully.

I secifically wanted the Windows-style example, because that's where the
trouble is coming from I think.

Anyway, I don't quite understand the :pathname arg.

 (pathname "http:lw;-read-me-.text")

I'm not sure what's going on in there either.  

dave
From: Rainer Joswig
Subject: Re: CL-HTTP problems on NT/LW
Date: 
Message-ID: <joswig-0208990614460001@194.163.195.67>
In article <···············@acs5.bu.edu>, David Bakhash <·····@bu.edu> wrote:

> Here's the first, and probably simplest example I found in the `exports.lisp'
> file:
> 
> (export-url "/cl-http/sources/lw/-read-me-.text"
>             :text-file
>             :pathname (pathname "http:lw;-read-me-.text")
>             :expiration `(:interval ,(* 15. 60.))
>             :keywords '(:cl-http :documentation :lisp-works)
>             :documentation
>             "README file for this alpha version of CL-HTTP for LispWorks for
> UNIX.")
> 
> In order to make the pathname in the url-string meaningful under NT I changed
> it to:
> 
> "x:/cl-http/lw/-read-me-.text"
> 
> But, when I did that I got:
> 
>     No parser defined for protocol scheme in the URL,
>     "x:/cl-http/lw/-read-me-.text"
> 
> I tried using the backslash style, just in case, and still no go.  I didn't
> know what to do with the :pathname argument, so I left it alone, and then
> tried to change it to the full pathname of that file, and other random stuff.
> None of them worked, even when I got no errors from the #'export-url
> function.  I am almost sure that the webserver is working, though, because my
> browser (IE) is opening up connections to it successfully.
> 
> I secifically wanted the Windows-style example, because that's where the
> trouble is coming from I think.
> 
> Anyway, I don't quite understand the :pathname arg.
> 
>  (pathname "http:lw;-read-me-.text")
> 
> I'm not sure what's going on in there either.  

Okay, I think I see your problem.

The code is :

(export-url #u"/cl-http/sources/lw/-read-me-.text"
            :text-file
            :pathname (pathname "http:lw;-read-me-.text")
            :expiration `(:interval ,(* 15. 60.))
            :keywords '(:cl-http :documentation :lisp-works)
            :documentation
       "README file for this alpha version of CL-HTTP for LispWorks for UNIX.")

Compare that with your form above.


The first argument #u"/cl-http/sources/lw/-read-me-.text"
is not the file in Unix-Notation - it's the URL.
The #u reader macro turns the string into an
URL completed with the default protocol scheme (HTTP),
the hostname where the server is running and the default
port (80).

? #u"/cl-http/sources/lw/-read-me-.text"
#<HTTP-OBJECT http://194.163.195.67/cl-http/sources/lw/-read-me-.text #x1508ABAE>

It's the same as:

? (url:url "http://194.163.195.67/cl-http/sources/lw/-read-me-.text")
#<HTTP-OBJECT http://194.163.195.67/cl-http/sources/lw/-read-me-.text #x1508ABAE>

URLs are objects in CL-HTTP. There are several classes
of URLs.


The second argument (here :text-file) says as what
you want it to be exported.

If you are going to export a text file then you need
to give a couple more info to export-url.
So no comes the usual keyword + argument pairings.
You need to specify the pathname of the file you
want to export. The function PATHNAME takes
a string a returns a pathname object. Here
we have a logical pathname. Unfortunately
the name of the logical pathname host is 
"http", but this has nothing to do with
http or urls.

On my Mac:

? (translate-logical-pathname (pathname "http:lw;-read-me-.text"))
#P"Macintosh HD:Lisp:MCL 4.3f1c1:lisp-software:cl-http-67-138-pre:lw:-read-me-.text"

So here you can specify the path for the file.

Another way to write the above would be

(export-url (url:url "http://194.163.195.67/cl-http/sources/lw/-read-me-.text")
            :text-file
            :pathname (pathname "x:/cl-http/lw/-read-me-.text"))

You just need to insert your IP-number. So this
uses a full URL, where it were to be preferred to
use only the partially specified URL.

It also now uses a pathname that depends on the
Lisp you are using. If it is not dictated
by some other reason, it is better to use
device independent logical pathnames.
From: David Bakhash
Subject: Re: CL-HTTP problems on NT/LW
Date: 
Message-ID: <cxjzp0a2t98.fsf@acs5.bu.edu>
Hi,

thanks a lot for the post.

Among the things I tried before I posted, one of them was the following:

(probe-file "/")

==> #P"d:/"

So I decided to put a file, called README.txt in the d:/ directory.

To make sure that Lisp knew it was there, I did:

(prove-file "/README.txt")

==> #P"d:/README.txt"

So I knew that was kosher.  Then, I did this:

(export-url #u("/README.txt" :host "10.0.0.2" :port 7654)
            :text-file
	    :pathname "/README.txt")

HTTP-OBJECT http://10.0.0.2:7654/README.txt 2234C0A4>

(I happen to be running the server on port 7654)

When I try to access "http://10.0.0.2:7654/README.txt" from a browser running
on the same host, it hangs.  It says "Web site found.  Waiting for reply", but
the server never replies.  If I type in the same URL with a different port
number, then the browser immediately returns an error page, saying that it
couldn't connect.

So I'm lost.  I tried the :immediate-export option with a `t' value, but that
also doesn't work.

Is there any way, from CL-HTTP, that I can ask "What files/URLs are currently
exported", or maybe "run a server test"?

dave
From: Rainer Joswig
Subject: Re: CL-HTTP problems on NT/LW
Date: 
Message-ID: <joswig-0208991617010001@pbg3.lavielle.com>
In article <···············@acs5.bu.edu>, David Bakhash <·····@bu.edu> wrote:

> So I knew that was kosher.  Then, I did this:
> 
> (export-url #u("/README.txt" :host "10.0.0.2" :port 7654)

This could be rewritten as (url:url "http://10.0.0.2:7654/README.txt") .

>             :text-file
>             :pathname "/README.txt")

Shouldn't you say something like "d:/README.txt" as the
pathname (-> including the d: )?

> 
> HTTP-OBJECT http://10.0.0.2:7654/README.txt 2234C0A4>
> 
> (I happen to be running the server on port 7654)

You have entered the port somewhere before?

> When I try to access "http://10.0.0.2:7654/README.txt" from a browser running
> on the same host, it hangs.

Sounds good. Atleast you got a connection.

To get a response from the server you could do:


(defmethod huhu-function (url stream)
  (declare (ignore url))
  (http:with-successful-response (stream :html)
    (princ "huhu" stream)))

(http:export-url #u"/huhu"
                 :computed
                 :response-function #'huhu-function)





> Is there any way, from CL-HTTP, that I can ask "What files/URLs are currently
> exported", or maybe "run a server test"?

(defun list-all-urls ()
  "Returns a sorted list of all known URLs."
  (let ((urls nil))
    (flet ((add (name object)
             (declare (ignore name))
             (push object urls)))
      (url:map-url-table #'add))
    (setf urls (sort urls #'string< :key #'url:coerce-url-string))
    urls))

Then you might look for the right URL classes, ...

Btw., if you get problems from the server, you can set
http:*debug-server* to T and LispWorks will give you
a backtrace window on errors...