NYCPHP Meetup

NYPHP.org

[nycphp-talk] Secure/insecure items

D C Krook dkrook at hotmail.com
Fri Jun 6 10:54:40 EDT 2003


>Can you tell us more about the //img/some.gif syntax? I have never seen it
>before. Is it documented anywhere?


Kushner,

I had never used the syntax prior to my current job, but it is apparently a 
long standing spec in HTTP 1.0 and HTTP 1.1.  My experience is limited in 
its use and quirks, but it seems to work for the browsers we support: IE 5+, 
Mozilla, Netscape 4-7 (View source of http://www.ibm.com/ to see how it's 
implemented)

Essentially what this syntax allows you to do is specfiy a an absolute path 
to a resource on a different hostname, but force the protocol to remain the 
same.

So, if your images are hosted on a separate server, you could link to them 
securely from your standard file web server like so:

On http://server.ibm.com/index.jsp:
   img src="//images.ibm.com/some.gif"
   img src="//img/some.gif"

Following is some cryptic info on the spec, but which seems to prove that 
it's been around a while:


http://web.access.net.au/felixadv/files/output/book/x3288.html
http://www.w3.org/Protocols/rfc2068/rfc2068.txt

3.2.1 General Syntax

   URIs in HTTP can be represented in absolute form or relative to some
   known base URI, depending upon the context of their use. The two
   forms are differentiated by the fact that absolute URIs always begin
   with a scheme name followed by a colon.

          URI            = ( absoluteURI | relativeURI ) [ "#" fragment ]

          absoluteURI    = scheme ":" *( uchar | reserved )

          relativeURI    = net_path | abs_path | rel_path

          net_path       = "//" net_loc [ abs_path ]
          abs_path       = "/" rel_path
          rel_path       = [ path ] [ ";" params ] [ "?" query ]

          path           = fsegment *( "/" segment )
          fsegment       = 1*pchar
          segment        = *pchar

          params         = param *( ";" param )
          param          = *( pchar | "/" )

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail




More information about the talk mailing list