0

I wrote a simple Grizzly/Jersey application, which you can find here:

https://github.com/boldt/stackoverflow-14526627

I want to post some form data:

curl -X POST -F "name=test" -i http://localhost:9999/files

I'm getting the following response:

HTTP/1.1 100 Continue

HTTP/1.1 200 OK
Date: Fri, 25 Jan 2013 16:51:18 GMT
Transfer-Encoding: chunked

As you can see, the header is doubled, first a 100 Continue followed by a 200 OK. Is doesn't makes sense to get the 100 Continue.

Any suggestions?

Dennis
  • 4,011
  • 7
  • 36
  • 50

2 Answers2

2

This is normal. Curl is following the HTTP 1.1 spec. You are doing a POST which means you are going to be sending data to the server. Curl is sending a request header to the server with "Expect: 100-continue" in it.

This tells the server that the client wants permission to send a POST document and if the server responds with HTTP/1.1 100 Continue, then client sends the document (your form pairs in this case) otherwise the server may reject it for whatever reason with HTTP/1.1 417 Expectation Failed and this allows the client to not waste time sending lots of data possibly if it will be rejected.

Alex Chacha
  • 423
  • 2
  • 7
1

There is nothing wrong with the two headers. Read about the Expect header. http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
Check your request headers. You are probably sending HTTP Expect with curl.

curl -vv -X POST -F "name=test" -i http://localhost:9999/files
jdb
  • 4,419
  • 21
  • 21
  • Your're right. Curl is adding Expect, as soon I'm adding `-F`. See: http://the-stickman.com/web-development/php-and-curl-disabling-100-continue-header/ – Dennis Jan 25 '13 at 17:43
  • And you can see this (expect: 100-continue) when you turn on your server-side logging in Jersey. – Arul Dhesiaseelan Jan 25 '13 at 21:48