Re: [WebDNA] TCPDoh
This WebDNA talk-list message is from 2009
It keeps the original formatting.
numero = 103317
interpreted = N
texte = Great !!I was going to suggest putting in a user agent. It seems that it has become increasingly necessary these days as so many sites/services display the site differently based on user agent.RegardsStuart TremainIDFK Web DevelopmentsAUSTRALIAwebdna@idfk.com.auOn 19/08/2009, at 10:45 AM, Patrick McCormick wrote:> Figured it out - I thought I had to put the name variable pairs into > TCPsend as content, but they go in the first part of TCPsend, right > after POST. Stuart's ironically well timed post reminded me of how > it really works. Thanks!>> This fixed my problem:>>> > [the_variables]
> [middle startafter=&endbefore=][!]> [/!][tcpconnect host=ssdi.rootsweb.ancestry.com&port=80][!]> [/!][tcpsend skipheader=T]POST /cgi-bin/ssdi.cgi?[the_variables] > HTTP/1.0[UnURL]%0D%0A[/UnURL][!]> [/!]USER-AGENT: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)> [UnURL]%0D%0A[/UnURL][!]> [/!][/TCPSend][!]> [/!][/tcpconnect][!]> [/!][/middle]> >>>> On Aug 18, 2009, at 7:16 PM, Patrick McCormick wrote:>>> I tweaked the code a little. Only did a single %0D%0A for [crlf], >> but added a second [crlf] before [/tcpsend]>>>> added /cgi-bin/ssdi.cgi? to the front of [the_variables]. Now I'm >> getting this error:>>>> Bad Request>> Your browser sent a request that this server could not understand.>> Request header field is missing ':' separator.>>>> /cgi-bin/ssdi.cgi? >> stat >> = >> a >> &lastname >> = >> McCormick >> &nt >> = >> exact >> &firstname >> = >> Raymond >> &middlename >> = >> A >> &ssn >> =&zip=54155&ls=WI&lc=&lct=Oneida&birth=&bmo=&bda=&death=&dmo=&issue=>>>> Apache/2.2.3 (CentOS) Server at ssdi.rootsweb.ancestry.com Port 80>>>>>> This is what tcpdump shows:>>>> POST /cgi-bin/ssdi.cgi HTTP/1.1>> Content-type: application/x-www-form-urlencoded>> Content-length: 155>> /cgi-bin/ssdi.cgi? >> stat >> = >> a >> &lastname >> = >> McCormick >> &nt >> = >> exact >> &firstname >> = >> Raymond >> &middlename >> = >> A >> &ssn >> =&zip=54155&ls=WI&lc=&lct=Oneida&birth=&bmo=&bda=&death=&dmo=&issue=>>>>>>>> here's the tweaked code I used:>>>>>> >> [text]crlf=[unurl]%0D%0A[/unurl][/text]>> [search >> db=people.db&eqfirstNamedata=Raymond&max=1]numfound=[numfound]
> >[founditems]>> [text]the_variables=/cgi-bin/ssdi.cgi? >> stat >> = >> a >> &lastname >> = >> [lastName >> ]&nt >> = >> exact >> &firstname >> = >> [firstName >> ]&middlename >> = >> [middle >> ]&ssn >> = >> [ssn >> ]&zip >> = >> [zip >> ]&ls >> = >> [state >> ]&lc >> = >> [county >> ]&lct >> = >> [city >> ]&birth >> = >> [birthYear >> ]&bmo >> = >> [birthMonth >> ]&bda >> =[birthDay]&death=[deathYear]&dmo=[deathMonth]&issue=[issueState][/ >> text]>> [/founditems][/search]>>>> [middle startafter=&endbefore=][tcpconnect >> host=ssdi.rootsweb.ancestry.com&port=80]>> [tcpsend]POST /cgi-bin/ssdi.cgi HTTP/1.1[crlf][!]>> [/!]Content-type: application/x-www-form-urlencoded[crlf][!]>> [/!]Content-length: [countchars][the_variables][/countchars][crlf][!]>> [/!][the_variables][crlf][crlf][!]>> [/!][/tcpsend]>> [/tcpconnect]>> [/middle]>> >>>> On Aug 18, 2009, at 6:45 PM, Patrick McCormick wrote:>>>>> I need some fellow programmer's eyes to see what I'm missing:>>>>>> I'm sending a request to a CGI program on another server.>>>>>> If I paste this URL into a browser, it works fine:>>>>>> ssdi.rootsweb.ancestry.com/cgi-bin/ssdi.cgi? >>> stat >>> = >>> a >>> &lastname >>> = >>> McCormick >>> &nt >>> = >>> exact >>> &firstname >>> = >>> Raymond >>> &middlename >>> = >>> A >>> &ssn >>> =&zip=54155&ls=WI&lc=&lct=Oneida&birth=&bmo=&bda=&death=&dmo=&issue=>>>>>> If I want to do that same thing using TCP connect/send, I put this >>> in my page:>>>>>> ------------------------------------------------>>> >>>>>> [text]crlf=[unurl]%0D%0A%0D%0A[/unurl][/text]>>>>>> [search db=people.db&eqfirstNamedata=Raymond&max=1][founditems]>>>>>> [text]the_variables=stat=a&lastname=[lastName]&nt=exact&firstname=[firstName]&middlename=[middle]&ssn=[ssn]&zip=[zip]&ls=[state]&lc=[county]&lct=[city]&birth=[birthYear]&bmo=[birthMonth]&bda=[birthDay]&death=[deathYear]&dmo=[deathMonth]&issue=[issueState][/text]>>>>>> [/founditems][/search]>>>>>> [middle startafter=&endbefore=][tcpconnect >>> host=ssdi.rootsweb.ancestry.com&port=80]>>> [tcpsend]POST /cgi-bin/ssdi.cgi HTTP/1.1[crlf][!]>>> [/!]Content-type: application/x-www-form-urlencoded[crlf][!]>>> [/!]Content-length: [countchars][the_variables][/countchars][crlf] >>> [!]>>> [/!][the_variables][crlf][!]>>> [/!][/tcpsend]>>> [/tcpconnect]>>> [/middle]>>>>>> >>> ------------------------------------------------>>>>>> But I get:>>>>>> Bad Request>>> Your browser sent a request that this server could not understand.>>>>>> Apache/2.2.3 (CentOS) Server at ssdi.rootsweb.ancestry.com Port 80>>>>>>>>> Can anyone see where I've messed up?>>>>>> Thanks,>>> Pat>>>
Associated Messages, from the most recent to the oldest:
Great !!I was going to suggest putting in a user agent. It seems that it has become increasingly necessary these days as so many sites/services display the site differently based on user agent.RegardsStuart TremainIDFK Web DevelopmentsAUSTRALIAwebdna@idfk.com.auOn 19/08/2009, at 10:45 AM, Patrick McCormick wrote:> Figured it out - I thought I had to put the name variable pairs into > TCPsend as content, but they go in the first part of TCPsend, right > after POST. Stuart's ironically well timed post reminded me of how > it really works. Thanks!>> This fixed my problem:>>> > [the_variables]
> [middle startafter=&endbefore=]
[!]> [/!][tcpconnect host=ssdi.rootsweb.ancestry.com&port=80]
[!]> [/!][tcpsend skipheader=T]POST /cgi-bin/ssdi.cgi?[the_variables] > HTTP/1.0
[unurl]%0D%0A[/UnURL]
[!]> [/!]USER-AGENT: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)>
[unurl]%0D%0A[/UnURL]
[!]> [/!][/TCPSend]
[!]> [/!][/tcpconnect]
[!]> [/!][/middle]> >>>> On Aug 18, 2009, at 7:16 PM, Patrick McCormick wrote:>>> I tweaked the code a little. Only did a single %0D%0A for [crlf], >> but added a second [crlf] before [/tcpsend]>>>> added /cgi-bin/ssdi.cgi? to the front of [the_variables]. Now I'm >> getting this error:>>>> Bad Request>> Your browser sent a request that this server could not understand.>> Request header field is missing ':' separator.>>>> /cgi-bin/ssdi.cgi? >> stat >> = >> a >> &lastname >> = >> McCormick >> &nt >> = >> exact >> &firstname >> = >> Raymond >> &middlename >> = >> A >> &ssn >> =&zip=54155&ls=WI&lc=&lct=Oneida&birth=&bmo=&bda=&death=&dmo=&issue=>>>> Apache/2.2.3 (CentOS) Server at ssdi.rootsweb.ancestry.com Port 80>>>>>> This is what tcpdump shows:>>>> POST /cgi-bin/ssdi.cgi HTTP/1.1>> Content-type: application/x-www-form-urlencoded>> Content-length: 155>> /cgi-bin/ssdi.cgi? >> stat >> = >> a >> &lastname >> = >> McCormick >> &nt >> = >> exact >> &firstname >> = >> Raymond >> &middlename >> = >> A >> &ssn >> =&zip=54155&ls=WI&lc=&lct=Oneida&birth=&bmo=&bda=&death=&dmo=&issue=>>>>>>>> here's the tweaked code I used:>>>>>> >>
[text]crlf=
[unurl]%0D%0A[/unurl][/text]>> [search >> db=people.db&eqfirstNamedata=Raymond&max=1]numfound=[numfound]
> >
[founditems]>>
[text]the_variables=/cgi-bin/ssdi.cgi? >> stat >> = >> a >> &lastname >> = >> [lastName >> ]&nt >> = >> exact >> &firstname >> = >> [firstName >> ]&middlename >> = >> [middle >> ]&ssn >> = >> [ssn >> ]&zip >> = >> [zip >> ]&ls >> = >> [state >> ]&lc >> = >> [county >> ]&lct >> = >> [city >> ]&birth >> = >> [birthYear >> ]&bmo >> = >> [birthMonth >> ]&bda >> =[birthDay]&death=[deathYear]&dmo=[deathMonth]&issue=[issueState][/ >> text]>> [/founditems][/search]>>>> [middle startafter=&endbefore=][tcpconnect >> host=ssdi.rootsweb.ancestry.com&port=80]>>
[tcpsend]POST /cgi-bin/ssdi.cgi HTTP/1.1[crlf]
[!]>> [/!]Content-type: application/x-www-form-urlencoded[crlf]
[!]>> [/!]Content-length:
[countchars][the_variables][/countchars][crlf]
[!]>> [/!][the_variables][crlf][crlf]
[!]>> [/!][/tcpsend]>> [/tcpconnect]>> [/middle]>> >>>> On Aug 18, 2009, at 6:45 PM, Patrick McCormick wrote:>>>>> I need some fellow programmer's eyes to see what I'm missing:>>>>>> I'm sending a request to a CGI program on another server.>>>>>> If I paste this URL into a browser, it works fine:>>>>>> ssdi.rootsweb.ancestry.com/cgi-bin/ssdi.cgi? >>> stat >>> = >>> a >>> &lastname >>> = >>> McCormick >>> &nt >>> = >>> exact >>> &firstname >>> = >>> Raymond >>> &middlename >>> = >>> A >>> &ssn >>> =&zip=54155&ls=WI&lc=&lct=Oneida&birth=&bmo=&bda=&death=&dmo=&issue=>>>>>> If I want to do that same thing using TCP connect/send, I put this >>> in my page:>>>>>> ------------------------------------------------>>> >>>>>>
[text]crlf=
[unurl]%0D%0A%0D%0A[/unurl][/text]>>>>>> [search db=people.db&eqfirstNamedata=Raymond&max=1]
[founditems]>>>>>>
[text]the_variables=stat=a&lastname=[lastName]&nt=exact&firstname=[firstName]&middlename=
[middle]&ssn=[ssn]&zip=[zip]&ls=[state]&lc=[county]&lct=[city]&birth=[birthYear]&bmo=[birthMonth]&bda=[birthDay]&death=[deathYear]&dmo=[deathMonth]&issue=[issueState][/text]>>>>>> [/founditems][/search]>>>>>> [middle startafter=&endbefore=][tcpconnect >>> host=ssdi.rootsweb.ancestry.com&port=80]>>>
[tcpsend]POST /cgi-bin/ssdi.cgi HTTP/1.1[crlf]
[!]>>> [/!]Content-type: application/x-www-form-urlencoded[crlf]
[!]>>> [/!]Content-length:
[countchars][the_variables][/countchars][crlf] >>>
[!]>>> [/!][the_variables][crlf]
[!]>>> [/!][/tcpsend]>>> [/tcpconnect]>>> [/middle]>>>>>> >>> ------------------------------------------------>>>>>> But I get:>>>>>> Bad Request>>> Your browser sent a request that this server could not understand.>>>>>> Apache/2.2.3 (CentOS) Server at ssdi.rootsweb.ancestry.com Port 80>>>>>>>>> Can anyone see where I've messed up?>>>>>> Thanks,>>> Pat>>>
Stuart Tremain
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
RE: pricing continued (1998)
Still Stumped on ShowNext...HELP! (1997)
2.1b3 --> way slow (1997)
WebCat2 - [include] tags (1997)
Exists? (1997)
carriage returns in data (1997)
SKU lookup (1997)
RE: WebCatalog2 for NT Beta Request (1997)
Cart Number sequence (1997)
[WebDNA] [if] or [case] or something else (2012)
Emailer setup (1997)
Web Developer Product Awards (1997)
Creating main- and sub-category search (1997)
4.5 on Apache 2 (2005)
Summing fields (1997)
Renumbering Database Records (1999)
Read and Write (2001)
NT or Mac (1997)
[WriteFile] problems (1997)
WebCat2 - [format thousands] (1997)