mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 17:31:42 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			71 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
			
		
		
	
	
			71 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
| {
 | |
|     $Id$
 | |
|     This file is part of the Free Pascal run time library.
 | |
|     Copyright (c) 2003 by the Free Pascal development team
 | |
| 
 | |
|     Test uriparser unit
 | |
|     
 | |
|     See the file COPYING.FPC, included in this distribution,
 | |
|     for details about the copyright.
 | |
| 
 | |
|     This program is distributed in the hope that it will be useful,
 | |
|     but WITHOUT ANY WARRANTY; without even the implied warranty of
 | |
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 | |
| 
 | |
|  **********************************************************************}
 | |
| {$MODE objfpc}
 | |
| {$H+}
 | |
| 
 | |
| program Testuri;
 | |
| 
 | |
| uses URIParser;
 | |
| 
 | |
| var
 | |
|   URI: TURI;
 | |
|   s: String;
 | |
| begin
 | |
|   with URI do
 | |
|   begin
 | |
|     Protocol := 'http';
 | |
|     Username := 'user';
 | |
|     Password := 'pass';
 | |
|     Host := 'localhost';
 | |
|     Port := 8080;
 | |
|     Path := '/test/dir';
 | |
|     Document := 'some index.html';
 | |
|     Params := 'param1=value1¶m2=value2';
 | |
|     Bookmark := 'bookmark';
 | |
|   end;
 | |
| 
 | |
|   s := EncodeURI(URI);
 | |
|   WriteLn(s);
 | |
| 
 | |
|   FillChar(URI, SizeOf(URI), #0);
 | |
| 
 | |
| //  URI := ParseURI(s, 'defaultprotocol', 1234);
 | |
|   URI:=ParseURI('http://www.lazarus.freepascal.org/main.php');
 | |
|   with URI do
 | |
|   begin
 | |
|     WriteLn('Protocol: ', Protocol);
 | |
|     WriteLn('Username: ', Username);
 | |
|     WriteLn('Password: ', Password);
 | |
|     WriteLn('Host: ', Host);
 | |
|     WriteLn('Port: ', Port);
 | |
|     WriteLn('Path: ', Path);
 | |
|     WriteLn('Document: ', Document);
 | |
|     WriteLn('Params: ', Params);
 | |
|     WriteLn('Bookmark: ', Bookmark);
 | |
|   end;
 | |
| 
 | |
| end.
 | |
| 
 | |
| {
 | |
|   $Log$
 | |
|   Revision 1.2  2003-11-22 23:17:50  michael
 | |
|   Patch for ipv6 and CNAME record support from Johannes Berg
 | |
| 
 | |
|   Revision 1.1  2003/05/17 20:54:03  michael
 | |
|   + uriparser unit added. Header/Footer blocks added
 | |
| 
 | |
| }
 | 
