From: Zbigniew Diaczyszyn on
Jeff Hobbs schrieb:

> The newer http package happens to be packaged as a module in AT 8.5,
> and you will find it at
> C:\Tcl\lib\tcl8\8.4\http-2.7.5.tm
>
> Jeff

Thank you very much. I found the file, copied it to http-2.7.5.tcl,
adapted it to my needs (some "puts" commands, renaming http::Log to
http::_Log and redefining it with: "http::Log {msg} {puts $msg}" and so
I am now capable to give some detailed information about the connection
issues to the support forum of Amazon aws.

Here is some output in Tkcon:

% source /home/dia/Projekte/tcl/http-2.7.5.tcl
% set res [::http::geturl http://zdia.homelinux.org -method TRACE]

{Using sock6 for zdia.homelinux.org:80} {}

-- Client request:
TRACE / HTTP/1.1
Accept: */*
{final chunk part}
{Closing socket sock6 (no connection info)}
::http::1
From: Zbigniew Diaczyszyn on
I would suggest to replace all the commands

puts $sock "request to the server"

with a debug "tee" option, for example:

------------------------------
proc send_msg {msg} {
global http::debug http::logoutchannel
puts $sock $msg
if $http::debug {puts $http::logoutchannel $msg}
}

# default
set http::debug 0
set http::logoutchannel stdout

# replacing: puts $sock args
send_msg "request to the server"
-------------------------------

Where could I put this suggestion?

I think this http package is a very flexible and comfortable instrument
for testing connection issues. Just typing in the telnet commands is
very annoying and otherwise there is only wireshark, tcpdump and so on
(Amazon people are recommending it) for seeing what is going on. But if
you are sitting behind a Wlan-Router with encryption wireshark will
loose all his teeth ...
From: drscrypt on
Zbigniew Diaczyszyn wrote:
>
> Here is some output in Tkcon:
>
> % source /home/dia/Projekte/tcl/http-2.7.5.tcl
> % set res [::http::geturl http://zdia.homelinux.org -method TRACE]
>
> {Using sock6 for zdia.homelinux.org:80} {}
>
> -- Client request:
> TRACE / HTTP/1.1
> Accept: */*
> {final chunk part}
> {Closing socket sock6 (no connection info)}
> ::http::1


I am using an older version of http and I do not see this error:

% info patchlevel
8.4.17
% package req http
2.5.3
% http::geturl http://zdia.homelinux.org/
::http::1
http::data ::http::1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>zdia.homelinux.org</title>
.....


So, it looks like it is working just fine from here. Is this the url
that is giving you trouble?

However, it does not support the -method option you are using. Maybe
turn that into a query parameter?



DrS




From: tom.rmadilo on
On Feb 21, 9:49 am, Zbigniew Diaczyszyn <z....(a)gmx.de> wrote:
> I would suggest to replace all the commands
>
> puts $sock "request to the server"
>
> with a debug "tee" option, for example:
>
> ------------------------------
> proc send_msg {msg} {
>         global http::debug http::logoutchannel
>         puts $sock $msg
>         if $http::debug {puts $http::logoutchannel $msg}
>
> }
>
> # default
> set http::debug 0
> set http::logoutchannel stdout
>
> # replacing: puts $sock args
> send_msg "request to the server"
> -------------------------------
>
> Where could I put this suggestion?
>
> I think this http package is a very flexible and comfortable instrument
> for testing connection issues. Just typing in the telnet commands is
> very annoying and otherwise there is only wireshark, tcpdump and so on
> (Amazon people are recommending it) for seeing what is going on. But if
> you are sitting behind a Wlan-Router with encryption wireshark will
> loose all his teeth ...

A better proc signature for logging is something like this:

proc ::logns::log { level args } {
variable logChan
if {[logLevel $level]} {
puts $logChan [join $args]
}
}

I have a namespace aware logger here:

http://www.junom.com/gitweb/gitweb.perl?p=tnt.git;a=blob;f=packages/tnt/tcl/log-procs.tcl

This allows you to tune logging per namespace so you can only debug
the one giving you problems. You can also turn on/off logging so that
it is on for one particular proc call.

However, back to the HTTP problem: Servers may not return anything
useful if they don't implement the METHOD you request. It looks like
your particular choice of urls didn't like the TRACE method and hung
up on you.

I guess this is a side issue. Are you unable to configure which
version of HTTP you send with the ::http::geturl ? That would be too
bad, since one way to disable chunked responses is to send only an
HTTP/1.0 request.

My experimental HTTP client (htclient) allows you to choose the HTTP
version. Then you can print the request using:

% ::htclient::getVar client1 request
GET /files/ HTTP/1.0
Host: rmadilo.com
User-Agent: TclClient/1.0
Connection: close

For instance the above request is generated like this:
% ::htclient::addClient rmadilo.com 80 /files/ GET {User-Agent
TclClient/1.0 Connection close} {} 1.0
client23

client23 is the handle, so you can prepare the request (testing only):

% ::htclient::htPrepare client23
GET /files/ HTTP/1.0
Host: rmadilo.com
User-Agent: TclClient/1.0
Connection: close

Otherwise to perform the request:

% ::htclient::machine client23
% catch {vwait forsomething}
%
Now the content is in ::htclient::clientContent(client23)

From: tom.rmadilo on
Here is an example of a POST with htclient:

http://www.junom.com/gitweb/gitweb.perl?p=htclient.git;a=blob;f=bin/test-post.tcl

htclient also accepts chunked downloads, so it is possible to use HTTP/
1.1. Since htclient doesn't really deal with individual method details
(except generating a content-length header for POST), you can use it
to write your own protocol over HTTP.

First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8
Prev: hard drive serial number
Next: uploading a file and form data