Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-10-22
17:19 • Ticket [2d9b31130b] Need Http option to control srvurl in proxied https requests... artifact: 9025bc142f user: serhiy.storchaka
2026-10-14
13:43 • Closed ticket [2d9b31130b]. artifact: df6097844d user: serhiy.storchaka
2021-04-21
16:59 • New ticket [2d9b31130b]. artifact: bdfe647faa user: christian.nassau

Need Http option to control srvurl in proxied https requests

Closed / Fixed2d9b31130be2084e206524536978a37c17d2f887Created 6 years agoUpdated 42 days ago
Descriptionplain2021-04-21 16:59:50
I'm trying to access the Microsoft MSGraph API through Tcl's http package, using tls and autoproxy to tunnel through a proxy. The code

  package require http 2.9.1
  package require autoproxy
  autoproxy::init
  http::register https 443 [list ::autoproxy::tls_socket]
  set req [http::geturl https://graph.microsoft.com/v1.0/me/messages -headers {Authorization {Bearer ...}}]

ends up sending a HTTP request of the form 
   GET https://graph.microsoft.com/v1.0/me/messages HTTP/1.1

Microsoft does not like this because of the full URI, and answers with 
    "code": "ResourceNotFound",
    "message": "Invalid version: graph.microsoft.com",

It instead expects the request without the full URI: 
   GET /v1.0/me/messages HTTP/1.1

From a quick internet search it seems to me that the inclusion of the full path might be the right choice for plain HTTP proxies. For HTTPS the proxy uses a "CONNECT" call to establish the connection and the full URI is neither needed nor helpful (as this problem shows).

It might be helpful to let the users of the http package control the handling of this proxy/url issue using a new option for the http connection
serhiy.storchakawiki2026-10-14 13:43:03

Implemented in Tcl 9.0 (http 2.10): register https with the endToEndProxy argument, e.g. http::register https 443 ::tls::socket ::tls::socketCmd 1 1. Then http opens the tunnel with CONNECT itself and sends GET /v1.0/me/messages; autoproxy is not needed.

serhiy.storchaka Ticket [2d9b31130b]: 3 changes [History diff]2026-10-22 17:19:25
Log in (anonymous is fine) to add a comment.