rpostiis-7.5httrhttp-status-code-411

r-project {httr} POST authentication gets HTTP ERROR 411 from IIS7.5


yI'm using the {httr} package to log into an internal web application (Theradoc on IIS7.5) in order to scrape some html (infection) data.

library(httr)
POST("http://ahdc372n2", authenticate("foo", "bar"), encode="multipart"), verbose())

The verbose console output says,

-> POST /theradoc/login/index.cfm HTTP/1.1
-> Authorization: Basic Y2xpbmludGVsbDowMWRFbmdsaXNo
-> User-Agent: curl/7.19.6 Rcurl/1.95.4.3 httr/0.4
-> Host: ahdc372n2.phs-sfalls.amck.net
-> Accept: */*
-> Accept-Encoding: gzip
-> Cookie: JSESSIONID=843052421c871dec2ac3a263b136d475a4a6
-> 
<- HTTP/1.1 411 Length Required
<- Content-Type: text/html; charset=us-ascii
<- Server: Microsoft-HTTPAPI/2.0
<- Date: Mon, 08 Sep 2014 15:53:02 GMT
<- Connection: close
<- Content-Length: 344
<- 
*  Closing connection #0

And ultimately I get an ">HTTP Error 411. The request must be chunked or have a content length."

I've reviewed this older post without and useful pointers.

Is there a way to force the Content-Length in the httr POST request?


Solution

  • UPDATE : Manually installing httr_0.5 from the zip archive seems to have solved the problem. Thank you hrbmstr.