|
@@ -66,6 +66,8 @@ struct uri_resolve_test {
|
66
|
66
|
struct uri_tftp_test {
|
67
|
67
|
/** Next-server address */
|
68
|
68
|
struct in_addr next_server;
|
|
69
|
+ /** Port number */
|
|
70
|
+ unsigned int port;
|
69
|
71
|
/** Filename */
|
70
|
72
|
const char *filename;
|
71
|
73
|
/** URI */
|
|
@@ -330,7 +332,7 @@ static void uri_tftp_okx ( struct uri_tftp_test *test, const char *file,
|
330
|
332
|
size_t len;
|
331
|
333
|
|
332
|
334
|
/* Construct URI */
|
333
|
|
- uri = tftp_uri ( test->next_server, test->filename );
|
|
335
|
+ uri = tftp_uri ( test->next_server, test->port, test->filename );
|
334
|
336
|
okx ( uri != NULL, file, line );
|
335
|
337
|
if ( uri ) {
|
336
|
338
|
uri_okx ( uri, &test->uri, file, line );
|
|
@@ -674,7 +676,7 @@ static struct uri_resolve_test uri_fragment = {
|
674
|
676
|
|
675
|
677
|
/** TFTP URI with absolute path */
|
676
|
678
|
static struct uri_tftp_test uri_tftp_absolute = {
|
677
|
|
- { .s_addr = htonl ( 0xc0a80002 ) /* 192.168.0.2 */ },
|
|
679
|
+ { .s_addr = htonl ( 0xc0a80002 ) /* 192.168.0.2 */ }, 0,
|
678
|
680
|
"/absolute/path",
|
679
|
681
|
{
|
680
|
682
|
.scheme = "tftp",
|
|
@@ -686,7 +688,7 @@ static struct uri_tftp_test uri_tftp_absolute = {
|
686
|
688
|
|
687
|
689
|
/** TFTP URI with relative path */
|
688
|
690
|
static struct uri_tftp_test uri_tftp_relative = {
|
689
|
|
- { .s_addr = htonl ( 0xc0a80003 ) /* 192.168.0.3 */ },
|
|
691
|
+ { .s_addr = htonl ( 0xc0a80003 ) /* 192.168.0.3 */ }, 0,
|
690
|
692
|
"relative/path",
|
691
|
693
|
{
|
692
|
694
|
.scheme = "tftp",
|
|
@@ -698,7 +700,7 @@ static struct uri_tftp_test uri_tftp_relative = {
|
698
|
700
|
|
699
|
701
|
/** TFTP URI with path containing special characters */
|
700
|
702
|
static struct uri_tftp_test uri_tftp_icky = {
|
701
|
|
- { .s_addr = htonl ( 0x0a000006 ) /* 10.0.0.6 */ },
|
|
703
|
+ { .s_addr = htonl ( 0x0a000006 ) /* 10.0.0.6 */ }, 0,
|
702
|
704
|
"C:\\tftpboot\\icky#path",
|
703
|
705
|
{
|
704
|
706
|
.scheme = "tftp",
|
|
@@ -708,6 +710,19 @@ static struct uri_tftp_test uri_tftp_icky = {
|
708
|
710
|
"tftp://10.0.0.6/C%3A\\tftpboot\\icky%23path",
|
709
|
711
|
};
|
710
|
712
|
|
|
713
|
+/** TFTP URI with custom port */
|
|
714
|
+static struct uri_tftp_test uri_tftp_port = {
|
|
715
|
+ { .s_addr = htonl ( 0xc0a80001 ) /* 192.168.0.1 */ }, 4069,
|
|
716
|
+ "/another/path",
|
|
717
|
+ {
|
|
718
|
+ .scheme = "tftp",
|
|
719
|
+ .host = "192.168.0.1",
|
|
720
|
+ .port = "4069",
|
|
721
|
+ .path = "/another/path",
|
|
722
|
+ },
|
|
723
|
+ "tftp://192.168.0.1:4069/another/path",
|
|
724
|
+};
|
|
725
|
+
|
711
|
726
|
/** Current working URI test */
|
712
|
727
|
static struct uri_churi_test uri_churi[] = {
|
713
|
728
|
{
|
|
@@ -842,6 +857,7 @@ static void uri_test_exec ( void ) {
|
842
|
857
|
uri_tftp_ok ( &uri_tftp_absolute );
|
843
|
858
|
uri_tftp_ok ( &uri_tftp_relative );
|
844
|
859
|
uri_tftp_ok ( &uri_tftp_icky );
|
|
860
|
+ uri_tftp_ok ( &uri_tftp_port );
|
845
|
861
|
|
846
|
862
|
/* Current working URI tests */
|
847
|
863
|
uri_churi_ok ( uri_churi );
|