mirror of https://bitbucket.org/ausocean/av.git
Finished writing httpPost - need to build and test
This commit is contained in:
parent
f7c9719d5b
commit
2dd7b344f8
25
rtmp/rtmp.go
25
rtmp/rtmp.go
|
@ -52,7 +52,7 @@ import "C"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
_ "fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"math"
|
"math"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
@ -605,6 +605,29 @@ func writeN(r *C.RTMP, buffer unsafe.Pointer, n int) int {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func httpPost(r *C.RTMP, cmd RTMPTCmd, buf *byte, len int) int {
|
||||||
|
length := 512
|
||||||
|
var hbuf [length]byte
|
||||||
|
fString := fmt.Sprintf("POST /%s%s/%d HTTP/1.1\r\n"
|
||||||
|
"Host: %.*s:%d\r\n"
|
||||||
|
"Accept: */*\r\n"
|
||||||
|
"User-Agent: Shockwave Flash\r\n"
|
||||||
|
"Connection: Keep-Alive\r\n"
|
||||||
|
"Cache-Control: no-cache\r\n"
|
||||||
|
"Content-type: application/x-fcs\r\n"
|
||||||
|
"Content-length: %d\r\n\r\n", RTMPT_cmds[cmd],
|
||||||
|
r->m_clientID.av_val ? r->m_clientID.av_val : "",
|
||||||
|
r->m_msgCounter, r->Link.hostname.av_len, r->Link.hostname.av_val,
|
||||||
|
r->Link.port, len)
|
||||||
|
hlen := len(fString)
|
||||||
|
hbuf = (*byte)(unsafe.Pointer(&(([]byte{fString})[0])))
|
||||||
|
// TODO: port this
|
||||||
|
C.RTMPSockBuf_Send(&r.m_sb, (*C.char)(hbuf), hlen)
|
||||||
|
hlen = c.RTMPSockBuf_Send(&r.m_sb, buf, len)
|
||||||
|
r.m_msgCounter++
|
||||||
|
r.m_unackd++
|
||||||
|
return hlen
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: port RTMP_METHOD
|
// TODO: port RTMP_METHOD
|
||||||
func avQueue(vals **C.RTMP_METHOD, num *int, av *C.AVal, txn int ) {
|
func avQueue(vals **C.RTMP_METHOD, num *int, av *C.AVal, txn int ) {
|
||||||
|
|
Loading…
Reference in New Issue