Skip to content

Commit

Permalink
post: move multipart and -d vs -F into the POST sub-section
Browse files Browse the repository at this point in the history
  • Loading branch information
bagder committed Jan 14, 2024
1 parent 62eb5cc commit 806e2fc
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 16 deletions.
4 changes: 2 additions & 2 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@
* [Hidden form fields](http/post/hiddenfields.md)
* [Figure out what a browser sends](http/post/browsersends.md)
* [JavaScript and forms](http/post/javascript.md)
* [Multipart formposts](http/multipart.md)
* [-d vs -F](http/postvspost.md)
* [Multipart formposts](http/post/multipart.md)
* [-d vs -F](http/post/postvspost.md)
* [Redirects](http/redirects.md)
* [Modify the HTTP request](http/requests.md)
* [Request method](http/modify/method.md)
Expand Down
5 changes: 0 additions & 5 deletions http.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@ the specific HTTPS section.
* [Authentication](http/auth.md)
* [Ranges](http/ranges.md)
* [HTTP versions](http/versions.md)
* [HTTP/0.9](http/versions/http09.md)
* [HTTP/2](http/versions/http2.md)
* [HTTP/3](http/versions/http3.md)
* [Conditionals](http/conditionals.md)
* [HTTPS](http/https.md)
* [HTTP POST](http/post.md)
* [Multipart formposts](http/multipart.md)
* [-d vs -F](http/postvspost.md)
* [Redirects](http/redirects.md)
* [Modify the HTTP request](http/requests.md)
* [HTTP PUT](http/put.md)
Expand Down
5 changes: 2 additions & 3 deletions http/post.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ application, and it is how most common HTML forms on the web
work. It usually sends a chunk of relatively small amounts of data to the
receiver.

This section describes the simple posts, for multipart formposts done with
`-F`, check out [Multipart formposts](multipart.md).

* [Simple POST](post/simple.md)
* [Content-Type](post/content-type.md)
* [Posting binary](post/binary.md)
Expand All @@ -19,3 +16,5 @@ This section describes the simple posts, for multipart formposts done with
* [Hidden form fields](post/hiddenfields.md)
* [Figure out what a browser sends](post/browsersends.md)
* [JavaScript and forms](post/javascript.md)
* [Multipart formposts](post/multipart.md)
* [-d vs -F](post/postvspost.md)
File renamed without changes
4 changes: 2 additions & 2 deletions http/multipart.md → http/post/multipart.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ request headers to the host example.com:
**Content-Length**, of course, tells the server how much data to expect. This
example's 313 bytes is really small.

The **Expect** header is explained in the [Expect 100 continue](post/expect100.md)
The **Expect** header is explained in the [Expect 100 continue](expect100.md)
chapter.

The **Content-Type** header is a bit special. It tells that this is a
Expand Down Expand Up @@ -111,7 +111,7 @@ to submit a multipart form as seen in HTML.
2. Use the development tools in your favorite browser and inspect the POST
request in the network tab after you have submitted it. Then convert that
HTTP data to a curl command line. Unfortunately, the
[copy as curl](../usingcurl/copyas.md) feature in the browsers usually do
[copy as curl](../../usingcurl/copyas.md) feature in the browsers usually do
not actually do multipart formposts particularly well.

3. Inspect the source HTML and convert into a curl command line directly from
Expand Down
6 changes: 3 additions & 3 deletions http/postvspost.md → http/post/postvspost.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -d vs -F

Previous chapters talked about [regular POST](post.md) and
Previous chapters talked about [regular POST](simple.md) and
[multipart formpost](multipart.md), and in your typical command lines you do
them with `-d` or `-F`.

Expand All @@ -26,7 +26,7 @@ type=file>` tag, for file uploads.
The default `enctype` used by forms, which is rarely spelled out in HTML since
it is default, is `application/x-www-form-urlencoded`. It makes the browser
URL encode the input as name=value pairs with the data encoded to avoid unsafe
characters. We often refer to that as a [regular POST](post.md), and you
characters. We often refer to that as a [regular POST](simple.md), and you
perform one with curl's `-d` and friends.

## POST outside of HTML
Expand All @@ -36,7 +36,7 @@ by HTML or involve a browser. Lots of services, APIs and other systems allow
you to pass in data these days in order to get things done.

If these services expect plain raw data or perhaps data formatted as JSON or
similar, you want the [regular POST](post.md) approach. curl's `-d` option
similar, you want the [regular POST](simple.md) approach. curl's `-d` option
does not alter or encode the data at all but just sends exactly what you tell
it to. Just pay attention that `-d` sets a default `Content-Type:` that might
not be what you want.
2 changes: 1 addition & 1 deletion usingcurl/uploads.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ which type of POST to use at your own whim but it entirely depends on what the
receiving server end expects and can handle.

HTTP multipart formposts are done with `-F`. See the detailed description in
the [HTTP multipart formposts](../http/multipart.md) chapter.
the [HTTP multipart formposts](../http/post/multipart.md) chapter.

### PUT

Expand Down

0 comments on commit 806e2fc

Please sign in to comment.