This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

http post event ..?..?

Old posts that have not been replied to for several years.
Locked
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

http post event ..?..?

Post by Ofloo »

got a small problem i wrote a http server in tcl for an http admin script that i am writeing and i don't get the post event in this script (post variable is not shown) why is that is there a specific reason for tis or ..

Code: Select all

if {![info exists hs(sock)]} {
  catch {socket -server hs 8888} hs(sock)
  putlog "Setting up http server, .."
  utimer 1 [list putlog "Server listening on port 8888."]
} else {
  putlog "Server listening on port 8888."
}

proc hs {s host port} {
  global hs
  fconfigure $s -blocking 0 -buffering line
  for {set i 0} {$i<=30} {incr i} {
    gets $s file($i)
    putlog "ID $i: $file($i)"
  }
  close $s
}
XplaiN but think of me as stupid
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Maybe because you close the socket in your reader?
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

yes but other wize it won't auto close ..
XplaiN but think of me as stupid
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

You close it after you've read all the data... see "content-length"
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

suggestions on how you would do that ??

it sends like this right
header
crlf
variable=content
so i read 30 lines that should be enough for at least shoing partial message .. or something cause i can see the header just not the variable .. even when i remove close $s it still doesn't send the variable but when i set the target to a netcat shell i can see it so it is sending it just don't know why it breaks up .. if the brouwser freezes it is allready send and this means it's waithing for the server to close the connection on this moment it still hasn't send the variable well it did but not that i can see .. unless there is a char error in there some where .. when u set the variable with gets .. but i don't see how that is possible ..
XplaiN but think of me as stupid
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Easiest solution is to use blocking sockets.

2nd is to create a fileevent readable callback.
Locked