Incorrect out put from cmdurl when url has an explicit port

View: New views
6 Messages — Rating Filter:   Alert me  

Incorrect out put from cmdurl when url has an explicit port

by Ashok P. Nadkarni-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If I access a script using the URL
http://localhost:8080/printrequest.wtf (I'm using wtf as the extension
instead of ws3), then the command

web::put [web::cmdurl command -urlformat {scheme host port scriptname
pathinfo querystring}]

outputs "http://localhost:8080:8080/printrequest.wtf?XDxJ7kkLRVB75Hb..."
in the web page.

Note the port number 8080 is listed twice. Is this a bug or is port not
to be specified if host is specified?

Thanks

/Ashok


---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@...
For additional commands, e-mail: websh-user-help@...


Re: Incorrect out put from cmdurl when url has an explicit port

by Ronnie Brunner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> If I access a script using the URL
> http://localhost:8080/printrequest.wtf (I'm using wtf as the extension
> instead of ws3), then the command
>
> web::put [web::cmdurl command -urlformat {scheme host port scriptname
> pathinfo querystring}]
>
> outputs "http://localhost:8080:8080/printrequest.wtf?XDxJ7kkLRVB75Hb..."
> in the web page.
>
> Note the port number 8080 is listed twice. Is this a bug or is port not
> to be specified if host is specified?

No. I'd call it a bug. Depending on Browser and Web server the
HTTP_HOST is sometimes with port and sometimes without. That used to
be more often without port... (when the Websh code was written.)

I'll put it on the bug list. Work around it by using something like

  web::cmdurlcfg -host localhost

hth
Ronnie

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@...
For additional commands, e-mail: websh-user-help@...


Changing maxrequests on an interpreter in websh.conf when it is specific to each file

by Ashok P. Nadkarni-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm playing around with using namespaces and slaves to reduce the time
to deliver a web page by making the interpreter handle multiple
requests. The websh.conf file has the lines

    # individual scripts (each with its own interpreters)
    if {[string match *.ws3 $file]} {
    return $file
    }

in the web::interpmap command. The question is, not how do I write the
corresponding web::interpclasscfg command to change maxrequests to (say)
10 ? interpmap takes the class name as a parameter but since that
changes on a per file basis, how do I change it? The ws3 files may lie
in different directories so I don't want to hardcode or enumerate full
paths if possible.

A somewhat related question is that I want the html handler to be
specific to the directory that the html file lives in. So I've modified
the html handler fragment in web::interpmap in websh.conf to be

    # default html content (html that contains snipplets only)
    # all requests for *.html files share interpreters
    if {[string match *.html $file]} {
    return [file join [file dirname $file] htmlhandler.ws3]
    }

Again, I have the same question, how do I now configure interpclasscfg
for each to change the maxrequests without having to list out each
possible directory as a separate class ? (maxrequests will be same for all)

Any solutions ?

Thanks

/Ashok

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@...
For additional commands, e-mail: websh-user-help@...


Re: Changing maxrequests on an interpreter in websh.conf when it is specific to each file

by Ashok P. Nadkarni-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

To answer my own question, I landed up doing the following:

if {[string match *.html $file]} {
   set script [file join [file dirname $file] htmlhandler.ws3]
   web::interpclasscfg $script maxrequests 10
   return $script
}

Not sure what impact that might have on memory (separate interpclass
structures per file?) but it does what I want for the time being in
terms of quicker startup.

/Ashok

Ashok P. Nadkarni wrote:

> I'm playing around with using namespaces and slaves to reduce the time
> to deliver a web page by making the interpreter handle multiple
> requests. The websh.conf file has the lines
>
>    # individual scripts (each with its own interpreters)
>    if {[string match *.ws3 $file]} {
>    return $file
>    }
>
> in the web::interpmap command. The question is, not how do I write the
> corresponding web::interpclasscfg command to change maxrequests to
> (say) 10 ? interpmap takes the class name as a parameter but since
> that changes on a per file basis, how do I change it? The ws3 files
> may lie in different directories so I don't want to hardcode or
> enumerate full paths if possible.
>
> A somewhat related question is that I want the html handler to be
> specific to the directory that the html file lives in. So I've
> modified the html handler fragment in web::interpmap in websh.conf to be
>
>    # default html content (html that contains snipplets only)
>    # all requests for *.html files share interpreters
>    if {[string match *.html $file]} {
>    return [file join [file dirname $file] htmlhandler.ws3]
>    }
>
> Again, I have the same question, how do I now configure interpclasscfg
> for each to change the maxrequests without having to list out each
> possible directory as a separate class ? (maxrequests will be same for
> all)
>
> Any solutions ?
>
> Thanks
>
> /Ashok
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: websh-user-unsubscribe@...
> For additional commands, e-mail: websh-user-help@...
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@...
For additional commands, e-mail: websh-user-help@...


Re: Changing maxrequests on an interpreter in websh.conf when it is specific to each file

by Ronnie Brunner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> To answer my own question, I landed up doing the following:
>
> if {[string match *.html $file]} {
>   set script [file join [file dirname $file] htmlhandler.ws3]
>   web::interpclasscfg $script maxrequests 10
>   return $script
> }
>
> Not sure what impact that might have on memory (separate interpclass
> structures per file?) but it does what I want for the time being in
> terms of quicker startup.

There's no impact on memory as you have an interpclass for every
script you use anyway. The only impact is that you call
web::interpclasscfg way too often. It is not really an expensive call
though, but it needs an additional lock on some internal resource and
locks can be bottlenecks. I can't tell you however whether this is
worse than creating the overhead of tracking the files you already
have configured:

 if {[string match *.html $file]} {
   set script [file join [file dirname $file] htmlhandler.ws3]
   if {![info exists pool($script)]} {
      web::interpclasscfg $script maxrequests 10
      set pool($script) 1
   }
   return $script
 }

This takes a bit more memory (the pool array) but as I said: don't
know if it actually makes a difference. Could be even slower...

Ronnie
--
Ronnie Brunner | ronnie.brunner@...
phone +41-44-247 79 79 | fax +41-44-247 70 75
Netcetera AG | 8040 Zürich | Switzerland | http://netcetera.ch

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@...
For additional commands, e-mail: websh-user-help@...


Re: Incorrect out put from cmdurl when url has an explicit port

by Ronnie Brunner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> If I access a script using the URL  
> http://localhost:8080/printrequest.wtf (I'm using wtf as the extension  
> instead of ws3), then the command
>
> web::put [web::cmdurl command -urlformat {scheme host port scriptname  
> pathinfo querystring}]
>
> outputs "http://localhost:8080:8080/printrequest.wtf?XDxJ7kkLRVB75Hb..."  
> in the web page.

I commited a fix today. If you want to check it out: Get the latest
source from http://svn.apache.org/repos/asf/tcl/websh/trunk

hth
Ronnie
--
Ronnie Brunner | ronnie.brunner@...
phone +41-44-247 79 79 | fax +41-44-247 70 75
Netcetera AG | 8040 Zürich | Switzerland | http://netcetera.ch

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@...
For additional commands, e-mail: websh-user-help@...