download1002 2014-05-14 13:12
浏览 40
已采纳

在GAE下使用http.Server时运行时出现紧急情况

My code is here: http://play.golang.org/p/RehA28iJtA

Why when I enter "http://example.com:8080/download" to the browser it shows a following error?

Error:

the runtime process gave a bad HTTP response: ''

2014/05/14 13:07:50 http: panic serving 127.0.0.1:59525: runtime error: invalid memory address or nil pointer dereference
goroutine 3 [running]:
net/http.func·009()
    /tmp/appengine/go_appengine/goroot/src/pkg/net/http/server.go:1093 +0xae
runtime.panic(0x646520, 0x94ba48)
    /tmp/appengine/go_appengine/goroot/src/pkg/runtime/panic.c:248 +0x106
xflight.Download(0x7fcade6926b8, 0xc21000f6e0, 0xc21005ea90)
    xflight/xflight.go:21 +0x132
net/http.HandlerFunc.ServeHTTP(0x71b6e8, 0x7fcade6926b8, 0xc21000f6e0, 0xc21005ea90)
    /tmp/appengine/go_appengine/goroot/src/pkg/net/http/server.go:1220 +0x40
net/http.(*ServeMux).ServeHTTP(0xc21001e630, 0x7fcade6926b8, 0xc21000f6e0, 0xc21005ea90)
    /tmp/appengine/go_appengine/goroot/src/pkg/net/http/server.go:1496 +0x163
appengine_internal.handleFilteredHTTP(0x7fcade6926b8, 0xc21000f6e0, 0xc21005ea90)
    /tmp/appengine/go_appengine/goroot/src/pkg/appengine_internal/api_dev.go:98 +0x2e2
net/http.HandlerFunc.ServeHTTP(0x6fe040, 0x7fcade6926b8, 0xc21000f6e0, 0xc21005ea90)
    /tmp/appengine/go_appengine/goroot/src/pkg/net/http/server.go:1220 +0x40
net/http.serverHandler.ServeHTTP(0xc21000b640, 0x7fcade6926b8, 0xc21000f6e0, 0xc21005ea90)
    /tmp/appengine/go_appengine/goroot/src/pkg/net/http/server.go:1597 +0x16e
net/http.(*conn).serve(0xc210058380)
    /tmp/appengine/go_appengine/goroot/src/pkg/net/http/server.go:1167 +0x7b7
created by net/http.(*Server).Serve
    /tmp/appengine/go_appengine/goroot/src/pkg/net/http/server.go:1644 +0x28b
  • 写回答

2条回答 默认 最新

  • dongxiongshi9952 2014-05-14 13:35
    关注

    You cannot use default http client in App Engine. You need to use URL Fetch service here https://developers.google.com/appengine/docs/go/urlfetch/
    Example: http://play.golang.org/p/Gf-WzLmP09

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码