Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[helper/webpagtool] HTTP Authorization vs Authentication #136

Closed
gnh1201 opened this issue Feb 1, 2021 · 1 comment
Closed

[helper/webpagtool] HTTP Authorization vs Authentication #136

gnh1201 opened this issue Feb 1, 2021 · 1 comment

Comments

@gnh1201
Copy link
Owner

gnh1201 commented Feb 1, 2021

Since the word is used confused in practice, we need to support both at the same time.

        if(count($headers) > 0) {
            foreach($headers as $k=>$v) {
                if(is_array($v)) {
                    if($k == "Authorization" || $k == "Authentication") {
                        if($v[0] == "Basic" && check_array_length($v, 3) == 0) {
                            $options[CURLOPT_USERPWD] = sprintf("%s:%s", make_safe_argument($v[1]), make_safe_argument($v[2]));
                        } else {
                            $_headers[] = sprintf("%s: %s", make_safe_argument($k), make_safe_argument(implode(" ", $v)));
                        }
                    }
                } else {
                    $_headers[] = sprintf("%s: %s", make_safe_argument($k), make_safe_argument($v));
                }
            }
            $options[CURLOPT_HTTPHEADER] = $_headers;
        }
@gnh1201
Copy link
Owner Author

gnh1201 commented Feb 5, 2021

fixed

@gnh1201 gnh1201 closed this as completed Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant