Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2022-05-30
16:25 • Closed ticket [4e5007ea1b]: Document use case: http::formatQuery key plus 4 ... artifact: df5e0d9264 user: kjnash
2022-05-13
08:57 • Ticket [4e5007ea1b]: 3 changes artifact: 181c3d7216 user: jan.nijtmans
2022-05-12
16:12 • Ticket [4e5007ea1b]: 4 changes artifact: a3b8680944 user: oehhar
13:36 • Ticket [4e5007ea1b]: 3 changes artifact: e34fa4aed8 user: kjnash
12:37 • Ticket [4e5007ea1b]: 4 changes artifact: 3f02f3bf30 user: oehhar
2022-05-10
21:16 • Ticket [4e5007ea1b]: 3 changes artifact: 371c27948e user: kjnash
2018-01-19
13:36 • Ticket [4e5007ea1b]: 4 changes artifact: 274745caf9 user: oehhar
2017-06-19
22:30 • Ticket [4e5007ea1b]: 4 changes artifact: 3b9a9ac3ab user: dkf
22:24 • Pending ticket [4e5007ea1b]. artifact: bf43f01fe6 user: gwlester
22:21
[4e5007ea1b285527] Added all code path tests for ::http::formatQuery. check-in: 286eddfbe6 user: gerald tags: tip-452
2015-02-16
14:45 • New ticket [4e5007ea1b] Document use case: http::formatQuery key. artifact: da77134a81 user: oehhar

Document use case: http::formatQuery key

Closed / Fixed4e5007ea1b2855277b349964ef1512ad884edaceCreated 12 years agoUpdated 5 years ago
Descriptionwiki2015-02-16 14:45:48
The http::formatQuery command is documented as:
http::formatQuery key value ?key value ...?

The function is also usable as:

http::formatQuery string
which just does the %xx translation for string.

For me (and Rolf via chat), this is a helpful use case.

Could we make this offical and document this use case ?

Thank you, Harald

gwlesterplain2017-06-19 22:24:35
Fixed in TIP 452 branch by having formatQuery raise an error if passed an odd number of arguments.

Creating new ticket to request that ::http::quoteString be exposed that will just do the %XX translation for a string.
dkfhtml2017-06-19 22:30:17

I guess that we can review how we do the quoting once this hits a main branch. It's the sort of thing for which I did regsub -command after all.

oehharplain2018-01-19 13:36:59
I would really enjoy to legalize this use-case.

Should I start a tip ?

Thank you,
Harald
kjnashplain2022-05-10 21:16:47
Hi Harald,

Does the "new" command ::http::quoteString do what you need?  If so, this bug can be closed.

Best wishes,

Keith.
oehharwiki2022-05-12 12:37:15

Thank you, Nash, for the message, first, I am amazed about all the patches this week, great.

To answer the discrete question: I look to the msgcat code in [dcc2f0bb90d2ced6].

http::quoteString is aliased on http::mapReply.

The function is great and what is IMHO helpful.

But mapReply starts with:

    if {$http(-urlencoding) ne ""} {

so, the http array must exist to use it. So, IMHO, it can not be used as an utility function disconnected from a http request (what was my intention).

As a side note, I am not sure what the "encoding convertto" following it does. If there is encoding envolved, I would do that after the percent encoding, not before, as an encoding applies to the percent encoded characters to.

Just my two pence, Harald

kjnashwiki2022-05-12 13:36:03

Hi Harald,

I'm not sure what your use case is. How would this command be useful for msgcat?

The array ::http::http is defined when package http is loaded: there is no need to make a HTTP request. You can use http::mapReply without ever making a request.

The "encoding convertto" is essential to produce a %-encoded string that corresponds to a sequence of bytes in a specific character set. Normally we use the default utf-8, e.g.

% package require http
2.10a1
% http::mapReply ©
%C2%A9

But if the recipient is expecting a different character set, the command can do that too:

% http::config -urlencoding iso8859-1
% http::mapReply ©
%A9

In HTTP applications there is no need to do encoding after the percent-encoding, because the latter produces a string in a subset of ASCII that HTTP clients and servers are required by the RFCs to understand.

Kind regards,

Keith.

oehharwiki2022-05-12 16:12:30

Sorry, Nash, all ok. My Covid-limitted brain just did not get it and thought the other way around. Like that it is ok and helpful.

Thank you for all the work and take care, Harald

jan.nijtmanswiki2022-05-13 08:57:59

Thanks, @kjnash, for taking all those tickets regarding the http package. Whenever you feel that the documentation is OK, just go ahead. I'm GTG.

kjnash Closed ticket [4e5007ea1b]. [History diff]2022-05-30 16:25:57
Log in (anonymous is fine) to add a comment.