- Question about the "Content-length:" header.. and servers using HTTP/1.1
- Posted by Matt Whitton on August 4th, 2003
i'm the same guy who asked the question about HTTP headers, and if Corey
Murtagh is reading this, it was indeed a bug in my code eating the blank
line after the header :P. but anyway a new problem has arisin. now i cant
figure out how my program can determin the end of the responses content, i
very briefly read the RFC, and it said something about the content-length
header, and how every HTTP/1.0 response with a message body must have one.
So i thought my question was answered, i coded it to scan for the
"Content-length:" header and get the value, and read that many bytes after
the header. Worked great on the google site, which uses HTTP/1.0, but i went
on to Yahoo and got this...
HTTP/1.1 200 OK
Date: Mon, 04 Aug 2003 06:19:55 GMT
P3P: policyref="http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM
DEV T
AI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL
UNI
PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"
Cache-Control: private
Connection: close
Content-Type: text/html
<html>
<head>
<title>Yahoo! Canada</title>
<meta http-equiv="PICS-Label"
content='(
PICS-1.1 "http://www.icra.org/ratingsv02.html" l r (cz 1 lz 1 nz 1 oz 1 vz
1) ge
n true for "http://ca.yahoo.com" r (cz etc etc etc................
the header here did not include a length, and my program returned a BLANK
webpage... so i broiled it down to a difference between HTTP/1.0 and
HTTP/1.1 How can i determine the end of the message body, without this
tag.....
Matt Whitton
computergeek2025@shaw.ca
- Posted by Programmer Dude on August 4th, 2003
Matt Whitton wrote:
Content-Length: is not a required header. (It's hard to calculate
on dynamically-created sends.)
The server will close the connection when it is done sending.
This is the most *reliable* way to detect you've gotten what
there is to get.
--
|_ CJSonnack <Chris@Sonnack.com> _____________| How's my programming? |
|_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL |
|_____________________________________________|___ ____________________|
- Posted by Matt Whitton on August 5th, 2003
Yea i know the server closes the connection, the prob with that is Java's
Socket class has a broken method "isConnected()" which returns true even
though the other party has closed the connection, its not the server, it
does this every time no matter what the circumstance... i guess i really
gotta study up. Well i am only a high school student with only 1 semester of
programming expiriance... so i think i'm doin pretty good =) btw if anyone
uses MSN i'd greatly appreciate you helping me out 1 to 1. my MSN address is
computergeek2025@hotmail.com add me if u are interested in working on this
project... i believe its worth it, since it can be used on almost any
proxy... If its any use to you i'm going to give i brief explaination of how
this program works...
First off it listens on port 2002 (arbitrarily chosen), the user changes the
proxy setting in IE to connect to localhost on this port. When a conneciton
is detected it initiates a "tunnel" through the proxy server (by sending
CONNECT command) to another proxy on my home computer... all it needs to do
now is listen for the users request, and forward it through the tunnel, and
listen for the proxys response, and forward it to IE! and voila!!! blocked
webpages at your fingertips =) if this works it could be widely deployed...
to bypass any proxy secured system (well any that allow secure
connections..) if u think this is worth your time PLEASE add me to your MSN
or contact me via E-mail.
MSN: computergeek2025@hotmail.com
E-mail: computergeek2025@shaw.ca
All help is appreciated =)
"Matt Whitton" <computergeek2025@shaw.ca> wrote in message
news:f5nXa.609149$3C2.15087607@news3.calgary.shaw. ca...
- "Restricted Content" error message in playback (Windows Media Center Edition) by Craig
- Restricted Content "Crackling" sound (Windows Media Center Edition) by Lawn Chair Mechanic
- {OT} er. slightly - list of open and "active" irc servers ? (Software & Applications) by *ProteanThread*
- Concerning "Restricted Content" & "Loss of Signal" probs (long)... (Windows Media Center Edition) by Bubba
- Re: Cancel "Re: Bad Pool Header" (Computers & Technology) by Kadaitcha Man

