comparison webserver.rhope @ 165:47ab97730865

Fix a couple of issues in networking lib
author Mike Pavone <pavone@retrodev.com>
date Thu, 10 Mar 2011 04:15:37 +0000
parents 804e48af1027
children
comparison
equal deleted inserted replaced
161:f5095855c878 165:47ab97730865
162 162
163 } 163 }
164 164
165 Connection Start[con,address,handlers] 165 Connection Start[con,address,handlers]
166 { 166 {
167 Print["Connection Start"]
167 ,client <- [con]Read Delim[["\r\n"]Buffer >>] 168 ,client <- [con]Read Delim[["\r\n"]Buffer >>]
168 { request <- String[~] } 169 { request <- String[~] } {}
170 {
171 Print["Error reading request line"]
172 Close[con]
173 }
169 parts <- [request]Split[" "] 174 parts <- [request]Split[" "]
170 Print[[[request]Append[" "]]Append[address]] 175 Print[[[request]Append[" "]]Append[address]]
171 [client]Read Delim[["\r\n\r\n"]Buffer >>] 176 [client]Read Delim[["\r\n\r\n"]Buffer >>]
172 { 177 {
173 headers <- Map[Dict Split[String[~], ":", "\r\n"], Trim[?, " \t"]] 178 headers <- Map[Dict Split[String[~], ":", "\r\n"], Trim[?, " \t"]]
174 }{ 179 }{
175 Handle Request[~, [parts]Index[0], [parts]Index[1], headers, handlers] 180 Handle Request[~, [parts]Index[0], [parts]Index[1], headers, handlers]
181 }{
182 Print["Error reading headers"]
176 } 183 }
177 } 184 }
178 185