LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-17-2012, 05:05 AM   #1
areian
LQ Newbie
 
Registered: Oct 2012
Posts: 3

Rep: Reputation: Disabled
forging http headers with curl?


Hi guys...
im new here....

i want to make a bash script that can forge http headers with curl command

i want something like live http headers that is a plugin of firefox , it can reply specific http headers like content type or filename

please help me... (ssry for my bad eng)
 
Old 10-17-2012, 05:12 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
just read the curl manpage. it's the -H option.
 
1 members found this post helpful.
Old 10-17-2012, 05:52 AM   #3
areian
LQ Newbie
 
Registered: Oct 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
TNX for Reply (^_^)

i did read it befor , it doesn't work.... i used this command
upload.php:
Quote:
<input type="file" name="upload"/>
Quote:
curl -H "Filename=file.php" -F "upload=@file.jpg" localhost/upload.php
also i used thsi:

Quote:
curl --request POST -H "Filename=file.php" --data-binary "@file.jpg" localhost/upload.php
what should i do?
 
Old 10-17-2012, 05:55 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
HTTP Header format is "Name: Value" not "Name=Value"

But "Filename" is a weird sounding header... sounds like it would be more at home in a form value
 
1 members found this post helpful.
Old 10-17-2012, 06:24 AM   #5
areian
LQ Newbie
 
Registered: Oct 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
aha , TNX man

when i use -H switch , i should use --data-binary mode or it doesn't matter?
 
Old 10-17-2012, 06:38 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Headers have nothign to do with binary data. Every HTTP request has headers, it doesn't relate at all to POST data. I think you've got a few concepts at different levels a bit mixed up here.
 
2 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
curl and wget http post williebens Linux - Newbie 4 10-11-2010 11:03 PM
using curl to DL files from HTTP sites with wildcard dehuszar Programming 7 09-03-2009 04:52 AM
Yast and Curl error - HTTP 407 ? beta-tester SUSE / openSUSE 1 10-08-2007 05:06 AM
Curl...HTTP disable slapt-get Acron_0248 Slackware 5 05-08-2006 01:57 PM
Forging HTTP headers, OS fingerprinting, etc. ilan1 Linux - General 4 03-04-2006 07:40 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration