Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2024-08-25
05:21
Merge [26e42a0eeb5ea82a]: Fix http issues [8c3de50] and [bbaf69c]. check-in: 0ee44bb31d user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE
05:03
Merge [415cf45c118f8d96]: When http.tcl uses Thread, require Thread 2.8.9- to avoid failure of r/w o... check-in: 6722451fe3 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE
2023-12-13
11:18 • Closed ticket [8c3de5039a]: geturl not working with registered protocols except ... artifact: d09e6eba75 user: oehhar
2023-10-10
17:18 • Ticket [8c3de5039a]: 3 changes artifact: c54699775c user: apnadkarni
17:16 • Ticket [8c3de5039a]: 4 changes artifact: 35e23418b9 user: apnadkarni
17:09 • Ticket [8c3de5039a]: 3 changes artifact: 8e242ae692 user: anonymous
16:22 • Ticket [8c3de5039a]: 4 changes artifact: cde56a9586 user: oehhar
15:57 • Ticket [8c3de5039a]: 3 changes artifact: 8a2a81b81d user: apnadkarni
15:46 • Ticket [8c3de5039a]: 4 changes artifact: fa55047650 user: oehhar
15:35 • Ticket [8c3de5039a]: 3 changes artifact: b7b23f7a24 user: apnadkarni
09:33 • Ticket [8c3de5039a]: 4 changes artifact: 0a1933e21e user: oehhar
2023-10-07
19:34 • Add attachment httptest.tcl to ticket [8c3de5039a] artifact: 6f00ae7c0c user: anonymous
19:33 • New ticket [8c3de5039a] geturl not working with twapi::tls_socket anymore. artifact: 0daf1df9da user: anonymous

geturl not working with registered protocols except tls

Closed / Fixed8c3de5039a95a1a173c0ddfb7b5d27cae0d20fadCreated 3 years agoUpdated 3 years ago
Descriptionplain2023-10-07 19:33:04
Attached script worked with http versions 2.9.8 and 2.10a1 and using tls or twapi for https sockets.
Current http version does not work with twapi anymore.
Error message is as follows:
Invalid option '-type'. 
Must be one of -myaddr, -myport, -async, -socketcmd, -server, -peersubject, -requestclientcert, -credentials, -verifier

This seems to be caused by the new option "-type $token" when creating the openCmd:
set state(openCmd) [list {*}$defcmd {*}$sockopts -type  $token {*}$targetAddr]

If I remove the "-type" option, geturl works with twapi and tls:
set state(openCmd) [list {*}$defcmd {*}$sockopts {*}$targetAddr]

Paul
oehharwiki2023-10-10 09:33:10

I think, it is more an issue of twapi to pip-through the new option.

In consequence, I have transfered this ticket to TWAPI bugtracker (Bug 220):

https://sourceforge.net/p/twapi/bugs/220/

If this is ok for you, I may close this ticket.

Thank you and take care, Harald

apnadkarniplain2023-10-10 15:35:51
Let us keep this discussion here for now please, until I understand why this is a twapi issue.

What is the `-type` option and what is twapi::tls_socket supposed to do with it? The only -type option I see is for http::geturl which is a mime type but I don't think that is what this is.

Harald mentions twapi should pipe through the new option, but to what? twapi::tls_socket just opens a TLS socket.
oehharwiki2023-10-10 15:46:06

Maybe, I am just wrong. Harald

apnadkarnimarkdown2023-10-10 15:57:47

Here something curious. Am I configuring something wrong? Could someone verify you see the same result?

% package require http
2.10b1
% http::register http 80 [list socket]
80 socket
% set token [http::geturl "http://www.tcl3d.org/bawt/"]
bad option "-type": must be -async, -backlog, -myaddr, -myport, -reuseaddr, -reuseport, or -server
oehharwiki2023-10-10 16:22:21

Same result with branch main and MS_VC2015 32 bit.

Sorry to blame great TWAPI...

Harald

anonymousplain2023-10-10 17:09:33
Hi Ashok,

I see the same error message when executing your script.
It does work, if I remove the http::register command. 

Added a puts command to print the state(openCmd) value:
Using http::register  : socket -async -type ::http::1 www.tcl3d.org 80
Without http::register: ::http::socket -async -type ::http::1 www.tcl3d.org 80

In the latter case, the replacement proc http::socket is called, which uses the token value to store a thread id.
Maybe there should be a condition, when building the state(openCmd) string, if the called socket command is http::socket or a command specified with http::register?

Paul
apnadkarnimarkdown2023-10-10 17:16:11

Looking at why tls::socket works but not socket or twapi::tls_socket, the tls::socket is special cased by the http package and routed through socketForTls and SecureProxyConnect. The latter actually handles or at least checks for the -type option. But I don't really know how it all hangs together.

Given that http::register fails for plain old Tcl socket as well (Harald, thanks for verifying), I'm taking the liberty of changing the bug title.

apnadkarniplain2023-10-10 17:18:31
Paul,

You're probably on the right track but I'll let someone who knows the code (@kjnash?) look into it.

/Ashok
oehharwiki2023-12-13 11:18:25

Fixed by Keith, thanks !

Here is the commit to core-8-branch: [7759882996].

New docs explain what is going on.

Thank you all, Harald

Log in (anonymous is fine) to add a comment.