mirror of https://github.com/ipxe/ipxe.git
[uri] Make URI schemes case-insensitive
RFC 3986 section 3.1 defines URI schemes as case-insensitive (though the canonical form is always lowercase). Use strcasecmp() rather than strcmp() to allow for case insensitivity in URI schemes. Requested-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/406/head
parent
4aa0375821
commit
2690f73096
|
@ -25,6 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <errno.h>
|
||||
#include <ipxe/xfer.h>
|
||||
#include <ipxe/uri.h>
|
||||
|
@ -47,7 +48,7 @@ struct uri_opener * xfer_uri_opener ( const char *scheme ) {
|
|||
struct uri_opener *opener;
|
||||
|
||||
for_each_table_entry ( opener, URI_OPENERS ) {
|
||||
if ( strcmp ( scheme, opener->scheme ) == 0 )
|
||||
if ( strcasecmp ( scheme, opener->scheme ) == 0 )
|
||||
return opener;
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
@ -32,6 +32,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <errno.h>
|
||||
#include <byteswap.h>
|
||||
#include <ipxe/tcpip.h>
|
||||
|
@ -63,7 +64,7 @@ static struct http_scheme * http_scheme ( struct uri *uri ) {
|
|||
|
||||
/* Identify scheme */
|
||||
for_each_table_entry ( scheme, HTTP_SCHEMES ) {
|
||||
if ( strcmp ( uri->scheme, scheme->name ) == 0 )
|
||||
if ( strcasecmp ( uri->scheme, scheme->name ) == 0 )
|
||||
return scheme;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue