I am just doing an HTTP message like this without using any library,
sub post { local($host,$port,$request,$data) = @_; ($fqdn, $aliases, $type, $len, $thataddr) = gethostbyname($host); $that = pack($sockaddr, &AF_INET, $port, $thataddr); socket(FS, &AF_INET, &SOCK_STREAM, $proto) || return undef; bind(FS, $thissock) || return undef; local($/); unless (eval q! $SIG{'ALRM'} = "timeout"; alarm($timeout); connect(FS, $that) || return undef; select(FS); $| = 1; select(STDOUT); print FS "POST $request HTTP/1.0\r\n$referer"; print FS "$useragent"; print FS "Host: $host:$port\r\n$mimeaccept"; print FS "$cnt_type"; $len = length($data); print FS "Content-length: $len\r\n\r\n$data\r\n"; undef($page); $/ = "\n"; $_ = <FS>; if (m:HTTP/1.0\s+\d+\s+:) {
I use this with a real old server (Apache httpd first generation). It does not support HTTP / 1.1, encoded encoding, etc., but you get this idea.
source share