You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Karl Chen <qu...@hkn.eecs.berkeley.edu> on 2003/12/20 05:35:16 UTC

HTTP GET doesn't do keyword replacement?

How come when you view a repository (in Apache 2) through a
browser, keywords (e.g. $Id$) are not replaced?

(With svn co, export, cat they show up as $Id: ...$, but HTTP
non-DAV GET they show up as $Id$)


-- 
Karl 2003-12-19 21:32

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: HTTP GET doesn't do keyword replacement?

Posted by Julian Reschke <ju...@gmx.de>.
Karl Chen wrote:

>>>>>>"Julian" == Julian Reschke <ju...@gmx.de> writes:
> 
>     Julian> 
>     Julian> Karl Chen wrote:
>     >> How come when you view a repository (in Apache 2) through a
>     >> browser, keywords (e.g. $Id$) are not replaced?  (With svn
>     >> co, export, cat they show up as $Id: ...$, but HTTP non-DAV
>     >> GET they show up as $Id$)
>     Julian> 
>     Julian> What is a non-DAV GET? Actually, what is a DAV GET?
> 
> I don't know the terminology.  Basically, the output of GET
> http://host/repos/file.txt (where GET is a program that implements
> HTTP GET) is different from the output of 'svn cat'.  I see now
> it's done in the client so it doesn't have anything to do with DAV
> or not.  (I guess everything is DAV so the difference would be
> "HTTP GET with activities")

OK, to clarify: WebDAV doesn't say anything in particular about GET. 
That is, a server should do the same independantly of whether the client 
knows about WebDAV or not. In general, it can't know without looking at 
the User-Agent heƔder, which is really a bad idea.

Julian R.


-- 
<green/>bytes GmbH -- http://www.greenbytes.de -- tel:+492512807760

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: HTTP GET doesn't do keyword replacement?

Posted by Karl Chen <qu...@hkn.eecs.berkeley.edu>.
>>>>> "Julian" == Julian Reschke <ju...@gmx.de> writes:
    Julian> 
    Julian> Karl Chen wrote:
    >> How come when you view a repository (in Apache 2) through a
    >> browser, keywords (e.g. $Id$) are not replaced?  (With svn
    >> co, export, cat they show up as $Id: ...$, but HTTP non-DAV
    >> GET they show up as $Id$)
    Julian> 
    Julian> What is a non-DAV GET? Actually, what is a DAV GET?

I don't know the terminology.  Basically, the output of GET
http://host/repos/file.txt (where GET is a program that implements
HTTP GET) is different from the output of 'svn cat'.  I see now
it's done in the client so it doesn't have anything to do with DAV
or not.  (I guess everything is DAV so the difference would be
"HTTP GET with activities")

-- 
Karl 2003-12-20 03:44

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: HTTP GET doesn't do keyword replacement?

Posted by Julian Reschke <ju...@gmx.de>.
Karl Chen wrote:
> How come when you view a repository (in Apache 2) through a
> browser, keywords (e.g. $Id$) are not replaced?
> 
> (With svn co, export, cat they show up as $Id: ...$, but HTTP
> non-DAV GET they show up as $Id$)

What is a non-DAV GET? Actually, what is a DAV GET?

Julian R.


-- 
<green/>bytes GmbH -- http://www.greenbytes.de -- tel:+492512807760

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: HTTP GET doesn't do keyword replacement?

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Saturday, December 20, 2003 1:12 AM -0800 Karl Chen 
<qu...@hkn.eecs.berkeley.edu> wrote:

> As far as I know, browser requests look like
>
> GET /repos/foo/!svn/bc/5673/trunk/file.txt HTTP/1.1
>
> while subversion client requests look like
>
> GET /repos/foo/trunk/file.txt HTTP/1.1

FWIW, you have it reversed.

I believe that the presence of activities in the URL shouldn't impact keyword 
substitution.  Any WebDAV/DeltaV client would be getting it via the activities 
too, but I'm not sure that keywords should be exposed to them too.  -- justin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: HTTP GET doesn't do keyword replacement?

Posted by Karl Chen <qu...@hkn.eecs.berkeley.edu>.
As far as I know, browser requests look like

GET /repos/foo/!svn/bc/5673/trunk/file.txt HTTP/1.1

while subversion client requests look like

GET /repos/foo/trunk/file.txt HTTP/1.1

so I think it would be easy to decide whether to do
keyword-substitution (if that's the only issue).  (I think having
different behavior depending on User-Agent is ugly anyway.)


>>>>> "Ben" == Ben Reser <be...@reser.org> writes:
    Ben> [...] Additionally, we'd need a way to detect svn clients from
    Ben> web browsers.  One way we could do that was simply by the
    Ben> User-Agent they send.  I'm not sure if we're sending some
    Ben> other information to be able to detect browsers from real
    Ben> svn clients or not. [...]

-- 
Karl 2003-12-20 01:02

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: HTTP GET doesn't do keyword replacement?

Posted by Julian Reschke <ju...@gmx.de>.
Ben Reser wrote:

> The client is responsible for handling keywords, not the server.  I know
> I asked this question on IRC a long time ago.  The response I got was
> that it would be terribly time consuming for a server to do so, since it
> would have to read through the file looking for the keywords.
> 
> For DAV I don't think this would be a huge deal to support, it pretty
> much has to read through the file to send it anyway.  The only downside
> would be that in order to send the proper Content-Length we'd have to do
> so before sending the initial header response.
> 
> Additionally, we'd need a way to detect svn clients from web browsers.
> One way we could do that was simply by the User-Agent they send.  I'm
> not sure if we're sending some other information to be able to detect
> browsers from real svn clients or not.
 > ...

In which case you'll have to ensure that the server marks the response 
to these two types of GETs as to vary with the User-Agent header 
(otherwise, you will confuse caches). Varying on the User-Agent header 
really seems to be a bad bad idea, in particular given the fact that 
IE's handling of the Vary header is known to be broken.

I think it's much cleaner to treat all GET requests the same way. If 
there's some keyword expansion a svn-aware client wants to trigger, it 
should do that through an additional request header.

Julian R.

-- 
<green/>bytes GmbH -- http://www.greenbytes.de -- tel:+492512807760

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: HTTP GET doesn't do keyword replacement?

Posted by Karl Chen <qu...@hkn.eecs.berkeley.edu>.
>>>>> "Daniele" == Daniele Nicolodi <da...@grinta.net> writes:
    Daniele> You can write a "proxy" cgi script, peraps in python,
    Daniele> that given a path in the repository take the file and
    Daniele> do keyword substitution then return the result to the
    Daniele> browser. You can call it trasparently like

Well, that won't let you browse directories.  Then you'd have to
write an index generator etc...  I guess the answer is ViewCVS,
though its URLs are ugly.

(DAV/svn protocol consistency is certainly more important than
what browsers see, so I agree you shouldn't change behavior)


-- 
Karl 2003-12-20 06:07

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: HTTP GET doesn't do keyword replacement?

Posted by Daniele Nicolodi <da...@grinta.net>.
On Fri, Dec 19, 2003 at 11:05:08PM -0800, Ben Reser wrote:

> I'll get around to looking at it eventually, I certainly wanted to use
> urls like http://foo/project/current/filename.pl to link to the current
> version of some scripts without having to update them or export stuff
> out of the repo to another URL, but still provide keywords so I can tell
> what version they actually ended up with.

You can write a "proxy" cgi script, peraps in python, that given a path
in the repository take the file and do keyword substitution then return
the result to the browser. You can call it trasparently like

http://server/proxy.py/path/to/file/in/repository

and guess the path of file in the repository from REQUEST_PATH.

Ciao
-- 
Daniele

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: HTTP GET doesn't do keyword replacement?

Posted by Ben Reser <be...@reser.org>.
On Fri, Dec 19, 2003 at 09:35:16PM -0800, Karl Chen wrote:
> How come when you view a repository (in Apache 2) through a
> browser, keywords (e.g. $Id$) are not replaced?
> 
> (With svn co, export, cat they show up as $Id: ...$, but HTTP
> non-DAV GET they show up as $Id$)

The client is responsible for handling keywords, not the server.  I know
I asked this question on IRC a long time ago.  The response I got was
that it would be terribly time consuming for a server to do so, since it
would have to read through the file looking for the keywords.

For DAV I don't think this would be a huge deal to support, it pretty
much has to read through the file to send it anyway.  The only downside
would be that in order to send the proper Content-Length we'd have to do
so before sending the initial header response.

Additionally, we'd need a way to detect svn clients from web browsers.
One way we could do that was simply by the User-Agent they send.  I'm
not sure if we're sending some other information to be able to detect
browsers from real svn clients or not.

It's been on my todo list to look into this.  But I'm not sure how
welcome such work would be in this case.  I certainly don't plan on
looking at this before 1.0.  Even if the User-Agent is the only way to
tell, it would be an adequate work around for the time beeing and down
the line when we changed the protocol we could add some other header to
make this more explicit.

I'll get around to looking at it eventually, I certainly wanted to use
urls like http://foo/project/current/filename.pl to link to the current
version of some scripts without having to update them or export stuff
out of the repo to another URL, but still provide keywords so I can tell
what version they actually ended up with.

This is my thoughts only.  I don't have commit access so don't take my
comments to mean that it will get implemented either.

-- 
Ben Reser <be...@reser.org>
http://ben.reser.org

"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org