2008-09-24 22:19:27 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								USING:  assocs  hashtables  help.markup  help.syntax 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-15 01:01:06 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								io.streams.string io.files io.pathnames kernel strings present
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								math multiline ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-24 22:19:27 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								IN:  urls 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  url 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $class-description "The class of URLs. The slots correspond to the standard components of a URL."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  <url> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "url"  url } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Creates an empty URL."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  >url 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "obj"  object  } { "url"  url } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Converts an object into a URL. If the object is already a URL, does nothing; if it is a string, then it is parsed as a URL."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $errors "Throws an error if the object is of the wrong type, or if it is a string which is not a valid URL."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    "If we convert a string to a URL and print it out again, it will print similarly to the input string, except some normalization may have occurred:" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $example
							 
						 
					
						
							
								
									
										
										
										
											2008-09-25 03:46:37 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "USING: accessors prettyprint urls ;" 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-24 22:19:27 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        "\"http://www.apple.com\" >url ." 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-25 03:46:37 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "URL\" http://www.apple.com/\"" 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-24 22:19:27 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    "We can examine the URL object:" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "USING: accessors io urls ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "\"http://www.apple.com\" >url host>> print" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "www.apple.com" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2008-09-25 03:46:37 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    "A relative URL does not have a protocol, host or port:" 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-24 22:19:27 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    { $example
							 
						 
					
						
							
								
									
										
										
										
											2008-09-25 03:46:37 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "USING: accessors prettyprint urls ;" 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-24 22:19:27 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        "\"file.txt\" >url protocol>> ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "f" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  URL" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $syntax "URL\" url...\""  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "URL literal syntax."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "USING: accessors prettyprint urls ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "URL\" http://factorcode.org:80\" port>> ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "80" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  derive-url 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "base"  url } { "url"  url } { "url'"  url } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Builds a URL by filling in missing components of "  { $snippet "url"  } " from "  { $snippet "base"  } "."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "USING: prettyprint urls ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "URL\" http://factorcode.org\"" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "URL\" binaries.fhtml\" derive-url ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "URL\" http://factorcode.org/binaries.fhtml\"" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "USING: prettyprint urls ;" 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-24 22:35:12 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "URL\" http://www.truecasey.com/drinks/kombucha\"" 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-24 22:19:27 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        "URL\" master-cleanser\" derive-url ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "URL\" http://www.truecasey.com/drinks/master-cleanser\"" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  ensure-port 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "url"  url } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "If the URL does not specify a port number, fill in the default for the URL's protocol. If the protocol is unknown, the port number is not changed."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $side-effects "url"  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "USING: accessors prettyprint urls ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "URL\" https://concatenative.org\" ensure-port port>> ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "443" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  parse-host 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-16 07:02:13 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "string"  string  } { "host"  string  } { "port"  { $maybe integer  } } }
							 
						 
					
						
							
								
									
										
										
										
											2008-09-24 22:19:27 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Splits a string of the form "  { $snippet "host:port"  } " into a host and a port number. If the port number is not specified, outputs "  { $link f  } "."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $notes "This word is used by "  { $link >url } ". It can also be used directly to parse "  { $snippet "host:port"  } " strings which are not full URLs."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "USING: prettyprint urls ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "\"sbcl.org:80\" parse-host .s" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "\"sbcl.org\"\n80" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  protocol-port 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-16 07:02:13 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "protocol"  "a protocol string"  } { "port"  { $maybe integer  } } }
							 
						 
					
						
							
								
									
										
										
										
											2008-09-24 22:19:27 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Outputs the port number associated with a protocol, or "  { $link f  } " if the protocol is unknown."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  query-param 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     { "url"  url } { "key"  string  }
							 
						 
					
						
							
								
									
										
										
										
											2008-11-16 07:02:13 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    { "value"  { $maybe string  } } }
							 
						 
					
						
							
								
									
										
										
										
											2008-09-24 22:19:27 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Outputs the URL-decoded value of a URL query parameter."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "USING: io urls ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "URL\" http://food.com/calories?item=French+Fries\"" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "\"item\" query-param print" 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-25 03:46:37 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "French Fries" 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-24 22:19:27 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  set-query-param 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "url"  url } { "value"  object  } { "key"  string  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Sets a query parameter. The value can be any object supported by "  { $link present } ", or "  { $link f  } ", in which case the key is removed."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $notes "This word always returns the same URL object that was input. This allows for a ``pipeline'' coding style, where several query parameters are set in a row. Since it mutates the input object, you must "  { $link clone  } " it first if it is literal, as in the below example." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $code
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        <" USING:  kernel  http.client  urls  ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								URL" http://search.yahooapis.com/WebSearchService/V1/webSearch"  clone
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    "concatenative programming (NSFW)"  "query"  set-query-param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    "1"  "adult_ok"  set-query-param
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								http-get">
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    "(For a complete Yahoo! search web service implementation, see the "  { $vocab-link "yahoo"  } " vocabulary.)" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $side-effects "url"  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  relative-url 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "url"  url } { "url'"  url } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Outputs a new URL with the same path and query components as the input value, but with the protocol, host and port set to "  { $link f  } "."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "USING: prettyprint urls ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "URL\" http://factorcode.org/binaries.fhtml\"" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "relative-url ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "URL\" /binaries.fhtml\"" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-10-04 14:26:17 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								HELP:  relative-url? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     { "url"  url }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     { "?"  "a boolean"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-10-05 15:33:06 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $description "Tests whether a URL is relative."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-10-04 14:26:17 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-09-24 22:19:27 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								HELP:  secure-protocol? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "protocol"  string  } { "?"  "a boolean"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Tests if protocol connections must be made with secure sockets (SSL/TLS)."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "USING: prettyprint urls ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "\"https\" secure-protocol? ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "t" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  url-addr 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "url"  url } { "addr"  "an address specifier"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Outputs an address specifier for use with "  { $link "network-connection"  } "."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "USING: prettyprint urls ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "URL\" ftp://ftp.cdrom.com\" url-addr ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "T{ inet { host \"ftp.cdrom.com\" } { port 21 } }" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  url-append-path 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "path1"  string  } { "path2"  string  } { "path"  string  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Like "  { $link append-path } ", but intended for use with URL paths and not filesystem paths."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								ARTICLE: "url-utilities"  "URL implementation utilities" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $subsection parse-host }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $subsection secure-protocol? }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $subsection url-append-path } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-09-25 05:47:42 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								ARTICLE: "urls"  "URL objects" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								"The "  { $vocab-link "urls"  } " vocabulary implements a URL data type. The benefit of using a data type to prepresent URLs rather than a string is that the parsing, printing and escaping logic is encapsulated and reused, rather than re-implemented in a potentially buggy manner every time." 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-24 22:19:27 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								$nl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								"URL objects are used heavily by the "  { $vocab-link "http"  } " and "  { $vocab-link "furnace"  } " vocabularies, and are also useful on their own." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								$nl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								"The class of URLs, and a constructor:" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $subsection url }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $subsection <url> }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								"Converting strings to URLs:" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $subsection >url }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								"URLs can be converted back to strings using the "  { $link present } " word." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								$nl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								"URL literal syntax:" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $subsection POSTPONE:  URL"  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								"Manipulating URLs:" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $subsection derive-url }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $subsection relative-url }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $subsection ensure-port }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $subsection query-param }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $subsection set-query-param }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								"Creating "  { $link "network-addressing"  } " from URLs:" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $subsection url-addr }
							 
						 
					
						
							
								
									
										
										
										
											2008-09-29 20:43:04 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								"The URL implemention encodes and decodes components of "  { $link url } " instances automatically, but sometimes this functionality is needed for non-URL strings." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $subsection "url-encoding"  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								"Utility words used by the URL implementation:" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $subsection "url-utilities"  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-24 22:19:27 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								ABOUT: "urls"