optimize http basic auth
Signed-off-by: arraykeys@gmail.com <arraykeys@gmail.com>
This commit is contained in:
@ -411,6 +411,7 @@ func (req *HTTPRequest) BasicAuth() (err error) {
|
|||||||
// authorization = req.getHeader("Authorization")
|
// authorization = req.getHeader("Authorization")
|
||||||
// code = "401"
|
// code = "401"
|
||||||
// }
|
// }
|
||||||
|
authorization = strings.Trim(authorization, " \r\n\t")
|
||||||
if authorization == "" {
|
if authorization == "" {
|
||||||
fmt.Fprintf((*req.conn), "HTTP/1.1 %s Unauthorized\r\nWWW-Authenticate: Basic realm=\"\"\r\n\r\nUnauthorized", code)
|
fmt.Fprintf((*req.conn), "HTTP/1.1 %s Unauthorized\r\nWWW-Authenticate: Basic realm=\"\"\r\n\r\nUnauthorized", code)
|
||||||
CloseConn(req.conn)
|
CloseConn(req.conn)
|
||||||
|
|||||||
Reference in New Issue
Block a user