0

I am writing a http server in java using ServerSocket and Socket respectively.

In specification it says that the request can be of "chunked" type. So how could I enable this option in any browser to test the parsing of the request?

hasrthur
  • 1,410
  • 15
  • 31

2 Answers2

1

You can easily make up the request on your own:

POST /search HTTP/1.1
Host: www.example.com
Transfer-Encoding: chunked
Content-Length: 25

000a
q=23456789
000a
0123456789
0005
01234
0

This request is split into three parts, and your server should receive q=23456789012345678901234 as the POST data.

Note: you need another CRLF at the end of the request, which this markup language cannot display.

Roland Illig
  • 40,703
  • 10
  • 88
  • 121
1

AFAIK most desktop browsers don't send chunked requests because some web servers don't handle them correctly (or at all) and it's easier to calculate the length than to detect/guess/remember which servers support it.

The curl command-line tool can send chunked requests:

curl -v -d "name=value" --header "Transfer-Encoding: chunked" http://foo.com/bar
SimonJ
  • 21,076
  • 1
  • 35
  • 50