diff options
author | Michael Brown <mcb30@etherboot.org> | 2009-02-13 16:26:43 +0000 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2009-02-13 16:26:43 +0000 |
commit | 816a32aaeefc15c36a7d94f08927787d431fe7e7 (patch) | |
tree | 7d1126422eafe8a224483325ae0807d63dfe5dad | |
parent | ef70f879975d349ca51bb0b9bbfa826e1b0e19bf (diff) | |
download | ipxe-816a32aaeefc15c36a7d94f08927787d431fe7e7.tar.gz |
[http] Allow for URI encodings within username and password
-rw-r--r-- | src/net/tcp/http.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/net/tcp/http.c b/src/net/tcp/http.c index 1052400e..57487308 100644 --- a/src/net/tcp/http.c +++ b/src/net/tcp/http.c @@ -407,8 +407,21 @@ static void http_step ( struct process *process ) { /* Construct authorisation, if applicable */ if ( user_pw_len ) { - snprintf ( user_pw, sizeof ( user_pw ), "%s:%s", - user, password ); + char *buf = user_pw; + ssize_t remaining = sizeof ( user_pw ); + size_t len; + + /* URI-decode the username and password */ + len = uri_decode ( user, buf, remaining ); + buf += len; + remaining -= len; + *(remaining--, buf++) = ':'; + len = uri_decode ( password, buf, remaining ); + buf += len; + remaining -= len; + assert ( remaining >= 0 ); + + /* Base64-encode the "user:password" string */ base64_encode ( user_pw, user_pw_base64 ); } |