Skip to content

Commit 32ed881

Browse files
committed
update for gc weekly.2011-05-22
1 parent 9a6ba18 commit 32ed881

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

request.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func flattenParams(fullParams map[string][]string) map[string]string {
6464

6565
func newRequest(hr *http.Request, hc http.ResponseWriter) *Request {
6666

67-
remoteAddr, _ := net.ResolveTCPAddr(hr.RemoteAddr)
67+
remoteAddr, _ := net.ResolveTCPAddr("tcp", hr.RemoteAddr)
6868

6969
req := Request{
7070
Method: hr.Method,
@@ -275,7 +275,7 @@ func writeTo(s string, val reflect.Value) os.Error {
275275
// if we're writing to an interace value, just set the byte data
276276
// TODO: should we support writing to a pointer?
277277
case reflect.Interface:
278-
v.Set(reflect.NewValue(s))
278+
v.Set(reflect.ValueOf(s))
279279
case reflect.Bool:
280280
if strings.ToLower(s) == "false" || s == "0" {
281281
v.SetBool(false)
@@ -306,7 +306,7 @@ func writeTo(s string, val reflect.Value) os.Error {
306306
case reflect.Slice:
307307
typ := v.Type()
308308
if typ.Elem().Kind() == reflect.Uint || typ.Elem().Kind() == reflect.Uint8 || typ.Elem().Kind() == reflect.Uint16 || typ.Elem().Kind() == reflect.Uint32 || typ.Elem().Kind() == reflect.Uint64 || typ.Elem().Kind() == reflect.Uintptr {
309-
v.Set(reflect.NewValue([]byte(s)))
309+
v.Set(reflect.ValueOf([]byte(s)))
310310
}
311311
}
312312
return nil
@@ -329,7 +329,7 @@ func (r *Request) writeToContainer(val reflect.Value) os.Error {
329329
}
330330
elemtype := v.Type().Elem()
331331
for pk, pv := range r.Params {
332-
mk := reflect.NewValue(pk)
332+
mk := reflect.ValueOf(pk)
333333
mv := reflect.Zero(elemtype)
334334
writeTo(pv, mv)
335335
v.SetMapIndex(mk, mv)
@@ -360,7 +360,7 @@ func (r *Request) UnmarshalParams(val interface{}) os.Error {
360360
if strings.HasPrefix(r.Headers.Get("Content-Type"), "application/json") {
361361
return json.Unmarshal(r.ParamData, val)
362362
} else {
363-
err := r.writeToContainer(reflect.NewValue(val))
363+
err := r.writeToContainer(reflect.ValueOf(val))
364364
if err != nil {
365365
return err
366366
}

web.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func defaultStaticDir() string {
172172
}
173173

174174
func init() {
175-
contextType = reflect.Typeof(Context{})
175+
contextType = reflect.TypeOf(Context{})
176176
//find the location of the exe file
177177
arg0 := path.Clean(os.Args[0])
178178
wd, _ := os.Getwd()
@@ -201,7 +201,7 @@ func (s *Server) addRoute(r string, method string, handler interface{}) {
201201
if fv, ok := handler.(reflect.Value); ok {
202202
s.routes.Push(route{r, cr, method, fv})
203203
} else {
204-
fv := reflect.NewValue(handler)
204+
fv := reflect.ValueOf(handler)
205205
s.routes.Push(route{r, cr, method, fv})
206206
}
207207
}
@@ -358,10 +358,10 @@ func (s *Server) routeHandler(req *Request, c conn) {
358358
var args vector.Vector
359359
handlerType := route.handler.Type()
360360
if requiresContext(handlerType) {
361-
args.Push(reflect.NewValue(&ctx))
361+
args.Push(reflect.ValueOf(&ctx))
362362
}
363363
for _, arg := range match[1:] {
364-
args.Push(reflect.NewValue(arg))
364+
args.Push(reflect.ValueOf(arg))
365365
}
366366

367367
valArgs := make([]reflect.Value, args.Len())
@@ -590,7 +590,7 @@ func Urlencode(data map[string]string) string {
590590
//Extracts the method "name" from the value represented by "val"
591591
//This allows methods to be handlers
592592
func MethodHandler(val interface{}, name string) reflect.Value {
593-
v := reflect.NewValue(val)
593+
v := reflect.ValueOf(val)
594594
typ := v.Type()
595595
n := typ.NumMethod()
596596
for i := 0; i < n; i++ {

0 commit comments

Comments
 (0)