You should be sending/getting a data stream like:
200 OK\015\012 Some-Header: value\015\012 Other-Header: value\015\012 \015\012 Body\015\012 Body\015\012 Body\015\012
Presuming you send it by POST (as opposed to GET) it will arrive on STDIN for your script. You can then do:
# set input operator to CRLF $/ = "\015\012"; # read header line by line while ( my $head = <STDIN> ) { last if m/^\015\012/; # must be a header line # do stuff } # header finished so read body line-wise while ( my $body = <STDIN> ) { # do whatever }
I can't think of many good reasons to be doing all this by hand. There are plenty of ways to move data without getting back to basics as it were. Perhaps if you mention what your are trying to achieve we may be able to suggest the easy way to you.... You may well find that the library modules HTTP::Request HTTP::Message and LWP::UserAgent do everyting you need (and probably more).
Note that you have to wrap long lines if you want to conform to the RFCs with soft line breaks when you send data. You therefore have to unwrap it at the other end.
some very very very very very very very very very long single line that just keeps on and on and on going and going and going finally we get to a real new line.....
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Skirting the edges of RFC2616 in perl...
by tachyon
in thread Skirting the edges of RFC2616 in perl...
by tid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |