Skip to content

Commit

Permalink
* sh (bash, ksh, zsh) is in use, stderr is redirected to /dev/tty.
Browse files Browse the repository at this point in the history
  • Loading branch information
py0n authored and mattn committed Mar 7, 2012
1 parent 6253ecd commit 6fea207
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions autoload/http.vim
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ function! http#get(url, ...)
if strlen(getdatastr)
let url .= "?" . getdatastr
endif
let old_shellredir = &shellredir
if &shell =~ "\\(ba\\|k\\|z\\)\\?sh"
set shellredir =>%s\ 2>/dev/tty
endif
if executable('curl')
let command = 'curl -L -s -k -i '
let quote = &shellxquote == '"' ? "'" : '"'
Expand All @@ -149,6 +153,7 @@ function! http#get(url, ...)
let command .= " ".quote.url.quote
let res = system(command)
endif
let &shellredir = old_shellredir
if res =~ '^HTTP/1.\d 3' || res =~ '^HTTP/1\.\d 200 Connection established'
let pos = stridx(res, "\r\n\r\n")
if pos != -1
Expand Down Expand Up @@ -181,6 +186,10 @@ function! http#post(url, ...)
else
let postdatastr = postdata
endif
let old_shellredir = &shellredir
if &shell =~ "\\(ba\\|k\\|z\\)\\?sh"
set shellredir =>%s\ 2>/dev/tty
endif
if executable('curl')
let command = 'curl -L -s -k -i -X '.method
let quote = &shellxquote == '"' ? "'" : '"'
Expand Down Expand Up @@ -211,6 +220,7 @@ function! http#post(url, ...)
call writefile(split(postdatastr, "\n"), file, "b")
let res = system(command . " --post-data @" . quote.file.quote)
endif
let &shellredir = old_shellredir
call delete(file)
if res =~ '^HTTP/1.\d 3' || res =~ '^HTTP/1\.\d 200 Connection established'
let pos = stridx(res, "\r\n\r\n")
Expand Down

0 comments on commit 6fea207

Please sign in to comment.