testuri.pp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2003 by the Free Pascal development team
  5. Test uriparser unit
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {$MODE objfpc}
  13. {$H+}
  14. program Testuri;
  15. uses URIParser;
  16. var
  17. URI: TURI;
  18. s: String;
  19. begin
  20. with URI do
  21. begin
  22. Protocol := 'http';
  23. Username := 'user';
  24. Password := 'pass';
  25. Host := 'localhost';
  26. Port := 8080;
  27. Path := '/test/dir';
  28. Document := 'some index.html';
  29. Params := 'param1=value1&param2=value2';
  30. Bookmark := 'bookmark';
  31. end;
  32. s := EncodeURI(URI);
  33. WriteLn(s);
  34. FillChar(URI, SizeOf(URI), #0);
  35. URI := ParseURI(s, 'defaultprotocol', 1234);
  36. with URI do
  37. begin
  38. WriteLn('Protocol: ', Protocol);
  39. WriteLn('Username: ', Username);
  40. WriteLn('Password: ', Password);
  41. WriteLn('Host: ', Host);
  42. WriteLn('Port: ', Port);
  43. WriteLn('Path: ', Path);
  44. WriteLn('Document: ', Document);
  45. WriteLn('Params: ', Params);
  46. WriteLn('Bookmark: ', Bookmark);
  47. end;
  48. end.
  49. {
  50. $Log$
  51. Revision 1.1 2003-05-17 20:54:03 michael
  52. + uriparser unit added. Header/Footer blocks added
  53. }