Open thibaultmeyer opened 2 years ago
Hi @thibaultmeyer, thanks for reporting this.
By any chance, are you able to reproduce this sort of thing if you issue a curl
on console and set it to follow redirects?
Hi,
Yes, i have other weird issue by using curl directly. Insomnia, in my usecase, lead to a "400 Bad Request" and "curl" to an infinite loop, Because, rather than the message "Switch to GET" is printed, the next query is still POST.
$ curl --version
curl 7.82.0 (x86_64-pc-msys) libcurl/7.82.0 OpenSSL/1.1.1n zlib/1.2.12 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.2 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.10.0 nghttp2/1.47.0
Release-Date: 2022-03-05
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets zstd
$ curl -vvvvv --location --post303 --url http://127.0.0.1:9000/upload --header 'Content-Type: multipart/form-data' --form 'formFile=@C:\Users\thiba\OneDrive\Pictures\Picture.jpg'
* Trying 127.0.0.1:9000...
* Connected to 127.0.0.1 (127.0.0.1) port 9000 (#0)
> POST /upload HTTP/1.1
> Host: 127.0.0.1:9000
> User-Agent: curl/7.82.0
> Accept: */*
> Content-Length: 44831
> Content-Type: multipart/form-data; boundary=------------------------d905ed5baf1c91b8
>
* We are completely uploaded and fine
* Mark bundle as not supporting multiuse
< HTTP/1.1 303 See Other
< Connection: keep-alive
< Cross-Origin-Resource-Policy: same-origin
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Frame-Options: DENY
< Location: /upload
< Content-Length: 0
< Date: Mon, 31 Oct 2022 18:52:44 GMT
<
* Connection #0 to host 127.0.0.1 left intact
* Issue another request to this URL: 'http://127.0.0.1:9000/upload'
* Switch to GET
* Found bundle for host 127.0.0.1: 0x800091520 [serially]
* Can not multiplex, even if we wanted to!
* Re-using existing connection! (#0) with host 127.0.0.1
* Connected to 127.0.0.1 (127.0.0.1) port 9000 (#0)
> POST /upload HTTP/1.1
> Host: 127.0.0.1:9000
> User-Agent: curl/7.82.0
> Accept: */*
> Content-Type: multipart/form-data
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 303 See Other
< Connection: keep-alive
< Cross-Origin-Resource-Policy: same-origin
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Frame-Options: DENY
< Location: /upload
< Content-Length: 0
< Date: Mon, 31 Oct 2022 18:52:44 GMT
<
* Connection #0 to host 127.0.0.1 left intact
* Issue another request to this URL: 'http://127.0.0.1:9000/upload'
* Found bundle for host 127.0.0.1: 0x800091520 [serially]
* Can not multiplex, even if we wanted to!
* Re-using existing connection! (#0) with host 127.0.0.1
* Connected to 127.0.0.1 (127.0.0.1) port 9000 (#0)
> POST /upload HTTP/1.1
> Host: 127.0.0.1:9000
> User-Agent: curl/7.82.0
> Accept: */*
> Content-Type: multipart/form-data
>
...
* We are completely uploaded and fine
* Mark bundle as not supporting multiuse
< HTTP/1.1 303 See Other
< Connection: keep-alive
< Cross-Origin-Resource-Policy: same-origin
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Frame-Options: DENY
< Location: /upload
< Content-Length: 0
< Date: Mon, 31 Oct 2022 19:05:17 GMT
<
* Connection #0 to host 127.0.0.1 left intact
* Maximum (50) redirects followed
I see, thanks @thibaultmeyer
Perhaps it might be a good idea to raise the curl
related infinite loop issue on https://github.com/curl/curl repository
As for the bug on Insomnia side, we would likely need to fix this on our node-libcurl dependency
Issue open on cURL project : https://github.com/curl/curl/issues/9859
hi @filfreire
I have a feedback from the open ticket on cURL, the problem is the use of "-X POST" (or other --postXXX) flag.
Expected Behavior
Insomnia must switch from POST/PUT to GET method when 303 "See Other" redirection occur (and Following redirection option is enabled).
Actual Behavior
Reproduction Steps
No response
Is there an existing issue for this?
Additional Information
According to HTTP Redirections (developer.mozilla.org), client must switch to GET method when a "See Other" redirection occur.
Insomnia Version
2021.6.0
What operating system are you using?
Windows
Operating System Version
Windows 11 x64
Installation method
Downloaded from official website
Last Known Working Insomnia version
No response