rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* SCRIPT_NAME and PATH_INFO
@ 2012-07-12 15:01 Torsten
  2012-07-18 16:48 ` Konstantin Haase
  0 siblings, 1 reply; 2+ messages in thread
From: Torsten @ 2012-07-12 15:01 UTC (permalink / raw)
  To: rack-devel

Hello,
I'm currently writing a server handler for a C++ comet server and I'm unsure how to divide a url path into these both variables. Does the sum of both have to be path part of the url (according to rfc3986)? If so, can I choose the SCRIPT_NAME freely and than just fill PATH_INFO with the remaining part and add a '/' if that remaining part is empty? Example:

path: '/' 
   => env['SCRIPT_NAME'] = '/'; env['PATH_INFO'] = '/'

path: '/a/b'
   => env['SCRIPT_NAME'] = '/'; env['PATH_INFO'] = '/a/b'
or  => env['SCRIPT_NAME'] = '/a'; env['PATH_INFO'] = '/b'
or  => env['SCRIPT_NAME'] = '/a/b'; env['PATH_INFO'] = '/'

is this right?

best regards
Torsten

-- 
Torrox GmbH & Co. KG
persönlich haftender Gesellschafter: Torrox Verwaltungs GmbH, Hannover (Amtsgericht Hannover, HRB 207530)
Geschäftsleitung:                                   Dipl.-Ing. Torsten Robitzki
Adresse:                                                  Stolzestr. 26; 30171 Hannover
Handelsregistereintrag:                       Amtsgericht Hannover, HRA 202170
Telefon:                                                  +49 511 31018758

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: SCRIPT_NAME and PATH_INFO
  2012-07-12 15:01 SCRIPT_NAME and PATH_INFO Torsten
@ 2012-07-18 16:48 ` Konstantin Haase
  0 siblings, 0 replies; 2+ messages in thread
From: Konstantin Haase @ 2012-07-18 16:48 UTC (permalink / raw)
  To: rack-devel

SCRIPT_NAME is used to mount an app nested somewhere.

If you run for instance a normal Rails or Sinatra app on http://localhost:5000/, then should SCRIPT_NAME == "" and PATH_INFO = "/".

Now if you want to run your Rails app from /foo instead of /, the /foo will be removed from PATH_INFO and added to SCRIPT_NAME.

This is used by so called Rack routers, for instance the `map` method you have in the Rack DSL.

Konstantin

On Jul 12, 2012, at 5:01 PM, Torsten@Robitzki.de wrote:

> Hello,
> I'm currently writing a server handler for a C++ comet server and I'm unsure how to divide a url path into these both variables. Does the sum of both have to be path part of the url (according to rfc3986)? If so, can I choose the SCRIPT_NAME freely and than just fill PATH_INFO with the remaining part and add a '/' if that remaining part is empty? Example:
> 
> path: '/' 
>   => env['SCRIPT_NAME'] = '/'; env['PATH_INFO'] = '/'
> 
> path: '/a/b'
>   => env['SCRIPT_NAME'] = '/'; env['PATH_INFO'] = '/a/b'
> or  => env['SCRIPT_NAME'] = '/a'; env['PATH_INFO'] = '/b'
> or  => env['SCRIPT_NAME'] = '/a/b'; env['PATH_INFO'] = '/'
> 
> is this right?
> 
> best regards
> Torsten
> 
> -- 
> Torrox GmbH & Co. KG
> persönlich haftender Gesellschafter: Torrox Verwaltungs GmbH, Hannover (Amtsgericht Hannover, HRB 207530)
> Geschäftsleitung:                                   Dipl.-Ing. Torsten Robitzki
> Adresse:                                                  Stolzestr. 26; 30171 Hannover
> Handelsregistereintrag:                       Amtsgericht Hannover, HRA 202170
> Telefon:                                                  +49 511 31018758
> 
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-18 16:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-12 15:01 SCRIPT_NAME and PATH_INFO Torsten
2012-07-18 16:48 ` Konstantin Haase

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).