-
Notifications
You must be signed in to change notification settings - Fork 84
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
add HTTP request connection with authorization #33
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cspiel1
force-pushed
the
add_http_request
branch
from
October 11, 2020 17:58
f2f9b10
to
d2f2b47
Compare
This was referenced Oct 12, 2020
cspiel1
force-pushed
the
add_http_request
branch
from
October 12, 2020 09:20
d2f2b47
to
a209293
Compare
cspiel1
force-pushed
the
add_http_request
branch
4 times, most recently
from
October 15, 2020 09:56
05a30e0
to
1b7f10c
Compare
Function httpauth_digest_make_response takes a struct httpauth_digest_chall and creates an httpauth_digest_resp. Especially, it computes the response field due to RFC-2617. Function httpauth_digest_response_encode serializes the struct httpauth_digest_resp. The result is the Authorization header ready to send in a http request.
This commit adds functions httpauth_basic_decode, httpauth_basic_make_response and httpauth_basic_encode in order to generate a Basic Authorization header for the HTTP client.
The function http_request has a parsing problem with ipv6 uris. This patch adds function http_uri_decode to re_http.h that separates scheme, host, port and path for http uris, which works also for IPv6 addresses.
This function is useful if a trusted CA is already given as PEM string.
cspiel1
force-pushed
the
add_http_request
branch
3 times, most recently
from
October 15, 2020 14:16
cf346f9
to
dfe6ec2
Compare
Adds functions that sets the client certificate and private key for HTTPS. The certificate and key can be specified as: - file with http_client_set_cert(), http_client_set_key() or - directly as PEM string with http_client_set_certpem(), http_client_set_keypem(). The function http_client_set_cert() and http_client_set_certpem() accept PEM file/data where certificate and private key are combined or only certificate is contained. If the key is not contained then also http_client_set_key() or http_client_set_keypem() has to be used.
cspiel1
force-pushed
the
add_http_request
branch
from
October 15, 2020 17:32
dfe6ec2
to
0f9428a
Compare
- Wrong pointer notation in first parameter (char * instead of char **). But the function can be removed for simplicity. - Renames also http_cli.tls_hostname to http_cli.tlshn which might be more libre conform naming style.
cspiel1
force-pushed
the
add_http_request
branch
from
October 16, 2020 14:21
0f9428a
to
2e851d5
Compare
Adds a HTTP connection on top of client.c (struct http_cli) to handle the authorization process by answering 401/403 responses. Supports basic, digest and bearer authentication. Provides a high level interface for: - setting HTTP method (GET, POST, PUT), - setting content type and TLS host name, - setting user, password and bearer, - adding custom headers.
cspiel1
force-pushed
the
add_http_request
branch
from
October 16, 2020 14:53
2e851d5
to
39278fc
Compare
Thank you Sebastian! :-) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds client side basic and digest authorization and HTTP request code (request.c) that combines these with http_cli (client.c) in order to provide a higher level interface for performing HTTP request. Supports:
This new high level API should be usable from:
Tested with:
This PR is related to PR baresip/baresip#1099.